<!DOCTYPE html>
<html lang='en'>
<head>
<title>General.sql « chart « at « coa « sql - ledger-smb - Unnamed repository; edit this file to name it for gitweb.</title>
<meta name='generator' content='cgit v1.2.3'/>
<meta name='robots' content='index, nofollow'/>
<link rel='stylesheet' type='text/css' href='/cgit-css/cgit.css'/>
<link rel='stylesheet' type='text/css' href='/cgit-local/local.css'/>
<script type='text/javascript' src='/cgit.js'></script>
<link rel='shortcut icon' href='/favicon.ico'/>
<link rel='alternate' title='Atom feed' href='https://source.jones.dk/ledger-smb/atom/sql/coa/at/chart/General.sql?h=master' type='application/atom+xml'/>
<link rel='vcs-git' href='https://source.jones.dk/ledger-smb' title='ledger-smb Git repository'/>
<link rel='vcs-git' href='user@source.jones.dk:ledger-smb' title='ledger-smb Git repository'/>
</head>
<body>
<div id='cgit'><table id='header'>
<tr>
<td class='logo' rowspan='2'><a href='/'><img src='/cgit-css/cgit.png' alt='cgit logo'/></a></td>
<td class='main'><a href='/'>index</a> : <a href='/ledger-smb/'>ledger-smb</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='f8ab8a2145dd0ca051d54a0ce2d83658fa9e5f24'/><select name='h' onchange='this.form.submit();'>
<option value='1.2.13+jones'>1.2.13+jones</option>
<option value='1.2.16+jones'>1.2.16+jones</option>
<option value='1.2.17+jones'>1.2.17+jones</option>
<option value='master' selected='selected'>master</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>Unnamed repository; edit this file to name it for gitweb.</td><td class='sub right'>Jonas Smedegaard</td></tr></table>
<table class='tabs'><tr><td>
<a href='/ledger-smb/'>summary</a><a href='/ledger-smb/refs/?id=f8ab8a2145dd0ca051d54a0ce2d83658fa9e5f24'>refs</a><a href='/ledger-smb/log/sql/coa/at/chart/General.sql'>log</a><a class='active' href='/ledger-smb/tree/sql/coa/at/chart/General.sql?id=f8ab8a2145dd0ca051d54a0ce2d83658fa9e5f24'>tree</a><a href='/ledger-smb/commit/sql/coa/at/chart/General.sql?id=f8ab8a2145dd0ca051d54a0ce2d83658fa9e5f24'>commit</a><a href='/ledger-smb/diff/sql/coa/at/chart/General.sql?id=f8ab8a2145dd0ca051d54a0ce2d83658fa9e5f24'>diff</a></td><td class='form'><form class='right' method='get' action='/ledger-smb/log/sql/coa/at/chart/General.sql'>
<input type='hidden' name='id' value='f8ab8a2145dd0ca051d54a0ce2d83658fa9e5f24'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/ledger-smb/tree/?id=f8ab8a2145dd0ca051d54a0ce2d83658fa9e5f24'>root</a>/<a href='/ledger-smb/tree/sql?id=f8ab8a2145dd0ca051d54a0ce2d83658fa9e5f24'>sql</a>/<a href='/ledger-smb/tree/sql/coa?id=f8ab8a2145dd0ca051d54a0ce2d83658fa9e5f24'>coa</a>/<a href='/ledger-smb/tree/sql/coa/at?id=f8ab8a2145dd0ca051d54a0ce2d83658fa9e5f24'>at</a>/<a href='/ledger-smb/tree/sql/coa/at/chart?id=f8ab8a2145dd0ca051d54a0ce2d83658fa9e5f24'>chart</a>/<a href='/ledger-smb/tree/sql/coa/at/chart/General.sql?id=f8ab8a2145dd0ca051d54a0ce2d83658fa9e5f24'>General.sql</a></div><div class='content'>blob: 477cce832e0eaaebca0af<ol class="hl">
<li id="n_1" class="hl"><span class="hl slc">#!/usr/bin/perl</span></li>
<li id="n_2" class="hl"></li>
<li id="n_3" class="hl"><span class="hl kwa">package&nbsp;</span>IkiWiki<span class="hl opt"<ol class="hl">
<li id="n_1" class="hl"><span class="hl kwa">begin</span><span class="hl opt">;</span></li>
<li id="n_2" class="hl"><span class="hl slc">--&nbsp;Kontoplan für Österreich</span></li>
<li id="n_3" class="hl"><span class="hl slc">-- Ferdinand Gassauer, Tue, 5 Feb 2002</span></li>
<li id="n_4" class="hl"><span class="hl slc">-- checked and completed, Thu, 7 Feb 2002, Dieter Simader</span></li>
<li id="n_5" class="hl"><span class="hl slc">--</span></li>
<li id="n_6" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;0000&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;AUFWENDUNGEN FÜR INGANGSETZEN UND ERWEITERN DES BETRIEBES&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;H&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;00&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_7" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;0010&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Firmenwert&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;015&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;AP_amount&#39;</span><span class="hl opt">);</span></li>
<li id="n_8" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;0100&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;IMMATERIELLE VERMÖGENSGEGENSTÄNDE&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;H&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;01&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_9" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;0110&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Rechte&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;011&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;AP_amount&#39;</span><span class="hl opt">);</span></li>
<li id="n_10" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;0200&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;GRUNDSTÜCKE&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;H&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;02-03&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_11" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;0210&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;unbebaute Grundstücke&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;020&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;AP_amount&#39;</span><span class="hl opt">);</span></li>
<li id="n_12" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;0220&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;bebaute Grundstücke&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;021&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;AP_amount&#39;</span><span class="hl opt">);</span></li>
<li id="n_13" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">,</span>contra<span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;0229&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;kum. Abschreibung bebaute Grundstücke&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;039&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;1&#39;</span><span class="hl opt">);</span></li>
<li id="n_14" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;0400&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;MASCHINEN&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;H&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;04-05&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_15" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;0410&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Maschinen&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;041&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;AP_amount&#39;</span><span class="hl opt">);</span></li>
<li id="n_16" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">,</span>contra<span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;0419&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;kum. Abschreibung Maschinen&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;069&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;1&#39;</span><span class="hl opt">);</span></li>
<li id="n_17" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;0500&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;FAHRZEUGE&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;H&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;06&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_18" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;0510&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Fahrzeuge&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;063&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;AP_amount&#39;</span><span class="hl opt">);</span></li>
<li id="n_19" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">,</span>contra<span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;0519&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;kum. Abschreibung Fahrzeuge&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;069&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;1&#39;</span><span class="hl opt">);</span></li>
<li id="n_20" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;0600&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;BETRIEBS- UND GESCHÄFTSAUSSTATTUNG&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;H&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;06&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_21" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;0620&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Büroeinrichtungen&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;066&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;AP_amount&#39;</span><span class="hl opt">);</span></li>
<li id="n_22" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">,</span>contra<span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;0625&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;kum. Abschreibung Betriebs- und Geschäftsausstattung&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;069&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;1&#39;</span><span class="hl opt">);</span></li>
<li id="n_23" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;0700&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;GELEISTETE ANZAHLUNGEN&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;H&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;07&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_24" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>cat</span></li>
<li id="n_115" class="hl">    <span class="hl kwc">my </span><span class="hl opt">(</span><span class="hl kwb">$newFileID</span><span class="hl opt">) = (</span><span class="hl kwb">$out </span><span class="hl opt">=~ </span><span class="hl kwd">m/^($sha1_pattern)$/</span><span class="hl opt">);</span></li>
<li id="n_116" class="hl">    error<span class="hl opt">(</span><span class="hl sng">&quot;Failed to store file data for </span><span class="hl ipl">$wsfilename </span><span class="hl sng">in repository&quot;</span><span class="hl opt">)</span></li>
<li id="n_117" class="hl">        <span class="hl kwa">if </span><span class="hl opt">(! </span><span class="hl kwc">defined </span><span class="hl kwb">$newFileID </span><span class="hl opt">|| </span><span class="hl kwc">length </span><span class="hl kwb">$newFileID </span><span class="hl opt">!= </span><span class="hl num">40</span><span class="hl opt">);</span></li>
<li id="n_118" class="hl"></li>
<li id="n_119" class="hl">    <span class="hl slc"># get the mtn filename rather than the workspace filename</span></li>
<li id="n_120" class="hl">    <span class="hl opt">(</span><span class="hl kwb">$out</span><span class="hl opt">, </span><span class="hl kwb">$err</span><span class="hl opt">) = </span><span class="hl kwb">$automator</span><span class="hl opt">-&gt;</span><span class="hl kwd">call</span><span class="hl opt">(</span><span class="hl sng">&quot;get_corresponding_path&quot;</span><span class="hl opt">, </span><span class="hl kwb">$oldrev</span><span class="hl opt">, </span><span class="hl kwb">$wsfilename</span><span class="hl opt">, </span><span class="hl kwb">$oldrev</span><span class="hl opt">);</span></li>
<li id="n_121" class="hl">    <span class="hl kwc">my </span><span class="hl opt">(</span><span class="hl kwb">$filename</span><span class="hl opt">) = (</span><span class="hl kwb">$out </span><span class="hl opt">=~ </span><span class="hl kwd">m/^file &quot;(.*)&quot;$/</span><span class="hl opt">);</span></li>
<li id="n_122" class="hl">    error<span class="hl opt">(</span><span class="hl sng">&quot;Couldn&#39;t find monotone repository path for file </span><span class="hl ipl">$wsfilename</span><span class="hl sng">&quot;</span><span class="hl opt">) </span><span class="hl kwa">if </span><span class="hl opt">(! </span><span class="hl kwb">$filename</span><span class="hl opt">);</span></li>
<li id="n_123" class="hl">    debug<span class="hl opt">(</span><span class="hl sng">&quot;Converted ws filename of </span><span class="hl ipl">$wsfilename </span><span class="hl sng">to repos filename of </span><span class="hl ipl">$filename</span><span class="hl sng">&quot;</span><span class="hl opt">);</span></li>
<li id="n_124" class="hl"></li>
<li id="n_125" class="hl">    <span class="hl slc"># then stick in a new revision for this file</span></li>
<li id="n_126" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$manifest </span><span class="hl opt">= </span><span class="hl sng">&quot;format_version </span><span class="hl esc">\&quot;</span><span class="hl sng">1</span><span class="hl esc">\&quot;\n\n</span><span class="hl sng">&quot;</span><span class="hl opt">.</span></li>
<li id="n_127" class="hl">                   <span class="hl sng">&quot;new_manifest [0000000000000000000000000000000000000000]</span><span class="hl esc">\n\n</span><span class="hl sng">&quot;</span><span class="hl opt">.</span></li>
<li id="n_128" class="hl">                   <span class="hl sng">&quot;old_revision [</span><span class="hl ipl">$oldrev</span><span class="hl sng">]</span><span class="hl esc">\n\n</span><span class="hl sng">&quot;</span><span class="hl opt">.</span></li>
<li id="n_129" class="hl">                   <span class="hl sng">&quot;patch </span><span class="hl esc">\&quot;</span><span class="hl sng"></span><span class="hl ipl">$filename</span><span class="hl sng"></span><span class="hl esc">\&quot;\n</span><span class="hl sng">&quot;</span><span class="hl opt">.</span></li>
<li id="n_130" class="hl">                   <span class="hl sng">&quot; from [</span><span class="hl ipl">$oldFileID</span><span class="hl sng">]</span><span class="hl esc">\n</span><span class="hl sng">&quot;</span><span class="hl opt">.</span></li>
<li id="n_131" class="hl">                   <span class="hl sng">&quot;   to [</span><span class="hl ipl">$newFileID</span><span class="hl sng">]</span><span class="hl esc">\n</span><span class="hl sng">&quot;</span><span class="hl opt">;</span></li>
<li id="n_132" class="hl">    <span class="hl opt">(</span><span class="hl kwb">$out</span><span class="hl opt">, </span><span class="hl kwb">$err</span><span class="hl opt">) = </span><span class="hl kwb">$automator</span><span class="hl opt">-&gt;</span><span class="hl kwd">call</span><span class="hl opt">(</span><span class="hl sng">&quot;put_revision&quot;</span><span class="hl opt">, </span><span class="hl kwb">$manifes</span></li>
<li id="n_30" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;1220&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Vorräte - bezogene Teile&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;120-129&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;IC&#39;</span><span class="hl opt">);</span></li>
<li id="n_31" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span clas</span></li>
<li id="n_139" class="hl">    <span class="hl slc"># author, branch, changelog, date</span></li>
<li id="n_140" class="hl">    <span class="hl kwb">$automator</span><span class="hl opt">-&gt;</span><span class="hl kwd">call</span><span class="hl opt">(</span><span class="hl sng">&quot;cert&quot;</span><span class="hl opt">, </span><span class="hl kwb">$newRevID</span><span class="hl opt">, </span><span class="hl sng">&quot;author&quot;</span><span class="hl opt">, </span><span class="hl kwb">$author</span><span class="hl opt">);</span></li>
<li id="n_141" class="hl">    <span class="hl kwb">$automator</span><span class="hl opt">-&gt;</span><span class="hl kwd">call</span><span class="hl opt">(</span><span class="hl sng">&quot;cert&quot;</span><span class="hl opt">, </span><span class="hl kwb">$newRevID</span><span class="hl opt">, </span><span class="hl sng">&quot;branch&quot;</span><span class="hl opt">, </span><span class="hl kwb">$branch</span><span class="hl opt">);</span></li>
<li id="n_142" class="hl">    <span class="hl kwb">$automator</span><span class="hl opt">-&gt;</span><span class="hl kwd">call</span><span class="hl opt">(</span><span class="hl sng">&quot;cert&quot;</span><span class="hl opt">, </span><span class="hl kwb">$newRevID</span><span class="hl opt">, </span><span class="hl sng">&quot;changelog&quot;</span><span class="hl opt">, </span><span class="hl kwb">$message</span><span class="hl opt">);</span></li>
<li id="n_143" class="hl">    <span class="hl kwb">$automator</span><span class="hl opt">-&gt;</span><span class="hl kwd">call</span><span class="hl opt">(</span><span class="hl sng">&quot;cert&quot;</span><span class="hl opt">, </span><span class="hl kwb">$newRevID</span><span class="hl opt">, </span><span class="hl sng">&quot;date&quot;</span><span class="hl opt">,</span></li>
<li id="n_144" class="hl">        time2str<span class="hl opt">(</span><span class="hl sng">&quot;</span><span class="hl ipl">%Y</span><span class="hl sng">-</span><span class="hl ipl">%m</span><span class="hl sng">-</span><span class="hl ipl">%dT%T</span><span class="hl sng">&quot;</span><span class="hl opt">, </span><span class="hl kwc">time</span><span class="hl opt">, </span><span class="hl sng">&quot;UTC&quot;</span><span class="hl opt">));</span></li>
<li id="n_145" class="hl">    </li>
<li id="n_146" class="hl">    debug<span class="hl opt">(</span><span class="hl sng">&quot;Added certs for rev: </span><span class="hl ipl">$newRevID</span><span class="hl sng">&quot;</span><span class="hl opt">);</span></li>
<li id="n_147" class="hl">    <span class="hl kwa">return </span><span class="hl kwb">$newRevID</span><span class="hl opt">;</span></li>
<li id="n_148" class="hl"><span class="hl opt">} </span><span class="hl slc">#}}}</span></li>
<li id="n_149" class="hl"></li>
<li id="n_150" class="hl"><span class="hl kwa">sub </span>read_certs <span class="hl opt">(</span><span class="hl kwb">$$</span><span class="hl opt">) { </span><span class="hl slc">#{{{</span></li>
<li id="n_151" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$automator</span><span class="hl opt">=</span><span class="hl kwc">shift</span><span class="hl opt">;</span></li>
<li id="n_152" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$rev</span><span class="hl opt">=</span><span class="hl kwc">shift</span><span class="hl opt">;</span></li>
<li id="n_153" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">&#64;results </span><span class="hl opt">= </span><span class="hl kwb">$automator</span><span class="hl opt">-&gt;</span><span class="hl kwd">call</span><span class="hl opt">(</span><span class="hl sng">&quot;certs&quot;</span><span class="hl opt">, </span><span class="hl kwb">$rev</span><span class="hl opt">);</span></li>
<li id="n_154" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">&#64;ret</span><span class="hl opt">;</span></li>
<li id="n_155" class="hl"></li>
<li id="n_156" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$line </span><span class="hl opt">= </span><span class="hl kwb">$results</span><span class="hl opt">[</span><span class="hl num">0</span><span class="hl opt">];</span></li>
<li id="n_157" class="hl">    <span class="hl kwa">while </span><span class="hl opt">(</span><span class="hl kwb">$line </span><span class="hl opt">=~ </span><span class="hl kwd">m/\s+key\s&quot;(.*?)&quot;\nsignature\s&quot;(ok|bad|unknown)&quot;\n\s+name\s&quot;(.*?)&quot;\n\s+value\s&quot;(.*?)&quot;\n\s+trust\s&quot;(trusted|untrusted)&quot;\n/sg</span><span class="hl opt">) {</span></li>
<li id="n_158" class="hl">        <span class="hl kwc">push </span><span class="hl kwb">&#64;ret</span><span class="hl opt">, {</span></li>
<li id="n_159" class="hl">            key <span class="hl opt">=&gt; </span><span class="hl kwb">$1</span><span class="hl opt">,</span></li>
<li id="n_160" class="hl">            signature <span class="hl opt">=&gt; </span><span class="hl kwb">$2</span><span class="hl opt">,</span></li>
<li id="n_161" class="hl">            name <span class="hl opt">=&gt; </span><span class="hl kwb">$3</span><span class="hl opt">,</span></li>
<li id="n_162" class="hl">            value <span class="hl opt">=&gt; </span><span class="hl kwb">$4</span><span class="hl opt">,</span></li>
<li id="n_163" class="hl">            trust <span class="hl opt">=&gt; </span><span class="hl kwb">$5</span><span class="hl opt">,</span></li>
<li id="n_164" class="hl">        <span class="hl opt">};</span></li>
<li id="n_165" class="hl">    <span class="hl opt">}</span></li>
<li id="n_166" class="hl"></li>
<li id="n_167" class="hl">    <span class="hl kwa">return </span><span class="hl kwb">&#64;ret</span><span class="hl opt">;</span></li>
<li id="n_168" class="hl"><span class="hl opt">} </span><span class="hl slc">#}}}</span></li>
<li id="n_169" class="hl"></li>
<li id="n_170" class="hl"><span class="hl kwa">sub </span>get_changed_files <span class="hl opt">(</span><span class="hl kwb">$$</span><span class="hl opt">) { </span><span class="hl slc">#{{{</span></li>
<li id="n_171" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$automator</span><span class="hl opt">=</span><span class="hl kwc">shift</span><span class="hl opt">;</span></li>
<li id="n_172" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$rev</span><span class="hl opt">=</span><span class="hl kwc">shift</span><span class="hl opt">;</span></li>
<li id="n_173" class="hl">    </li>
<li id="n_174" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">&#64;results </span><span class="hl opt">= </span><span class="hl kwb">$automator</span><span class="hl opt">-&gt;</span><span class="hl kwd">call</span><span class="hl opt">(</span><span class="hl sng">&quot;get_revision&quot;</span><span class="hl opt">, </span><span class="hl kwb">$rev</span><span class="hl opt">);</span></li>
<li id="n_175" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$changes</span><span class="hl opt">=</span><span class="hl kwb">$results</span><span class="hl opt">[</span><span class="hl num">0</span><span class="hl opt">];</span></li>
<li id="n_176" class="hl"></li>
<li id="n_177" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">&#64;ret</span><span class="hl opt">;</span></li>
<li id="n_178" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">%seen </span><span class="hl opt">= ();</span></li>
<li id="n_179" class="hl">    </li>
<li id="n_180" class="hl">    <span class="hl kwa">while </span><span class="hl opt">(</span><span class="hl kwb">$changes </span><span class="hl opt">=~ </span><span class="hl kwd">m/\s*(add_file|patch|delete|rename)\s&quot;(.*?)(?&lt;!\\)&quot;\n/sg</span><span class="hl opt">) {</span></li>
<li id="n_181" class="hl">        <span class="hl kwc">my </span><span class="hl kwb">$file </span><span class="hl opt">= </span><span class="hl kwb">$2</span><span class="hl opt">;</span></li>
<li id="n_182" class="hl">        <span class="hl slc"># don&#39;t add the same file multiple times</span></li>
<li id="n_183" class="hl">        <span class="hl kwa">if </span><span class="hl opt">(! </span><span class="hl kwb">$seen</span><span class="hl opt">{</span><span class="hl kwb">$file</span><span class="hl opt">}) {</span></li>
<li id="n_184" class="hl">            <span class="hl kwc">push </span><span class="hl kwb">&#64;ret</span><span class="hl opt">, </span><span class="hl kwb">$file</span><span class="hl opt">;</span></li>
<li id="n_185" class="hl">            <span class="hl kwb">$seen</span><span class="hl opt">{</span><span class="hl kwb">$file</span><span class="hl opt">} = </span><span class="hl num">1</span><span class="hl opt">;</span></li>
<li id="n_186" class="hl">        <span class="hl opt">}</span></li>
<li id="n_187" class="hl">    <span class="hl opt">}</span></li>
<li id="n_188" class="hl">    </li>
<li id="n_189" class="hl">    <span class="hl kwa">return </span><span class="hl kwb">&#64;ret</span><span class="hl opt">;</span></li>
<li id="n_190" class="hl"><span class="hl opt">} </span><span class="hl slc">#}}}</span></li>
<li id="n_191" class="hl"></li>
<li id="n_192" class="hl"><span class="hl kwa">sub </span>rcs_update <span class="hl opt">() { </span><span class="hl slc">#{{{</span></li>
<li id="n_193" class="hl">    check_config<span class="hl opt">();</span></li>
<li id="n_194" class="hl"></li>
<li id="n_195" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">defined</span><span class="hl opt">(</span><span class="hl kwb">$config</span><span class="hl opt">{</span>mtnsync<span class="hl opt">}) &amp;&amp; </span><span class="hl kwb">$config</span><span class="hl opt">{</span>mtnsync<span class="hl opt">}) {</span></li>
<li id="n_196" class="hl">        <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">system</span><span class="hl opt">(</span><span class="hl sng">&quot;mtn&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--root=</span><span class="hl ipl">$config</span><span class="hl sng">{mtnrootdir}&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;sync&quot;</span><span class="hl opt">,</span></li>
<li id="n_197" class="hl">                   <span class="hl sng">&quot;--quiet&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--ticker=none&quot;</span><span class="hl opt">, </span></li>
<li id="n_198" class="hl">                   <span class="hl sng">&quot;--key&quot;</span><span class="hl opt">, </span><span class="hl kwb">$config</span><span class="hl opt">{</span>mtnkey<span class="hl opt">}) != </span><span class="hl num">0</span><span class="hl opt">) {</span></li>
<li id="n_199" class="hl">            debug<span class="hl opt">(</span><span class="hl sng">&quot;monotone sync failed before update&quot;</span><span class="hl opt">);</span></li>
<li id="n_200" class="hl">        <span class="hl opt">}</span></li>
<li id="n_201" class="hl">    <span class="hl opt">}</span></li>
<li id="n_202" class="hl"></li>
<li id="n_203" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">system</span><span class="hl opt">(</span><span class="hl sng">&quot;mtn&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--root=</span><span class="hl ipl">$config</span><span class="hl sng">{mtnrootdir}&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;update&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--quiet&quot;</span><span class="hl opt">) != </span><span class="hl num">0</span><span class="hl opt">) {</span></li>
<li id="n_204" class="hl">        debug<span class="hl opt">(</span><span class="hl sng">&quot;monotone update failed&quot;</span><span class="hl opt">);</span></li>
<li id="n_205" class="hl">    <span class="hl opt">}</span></li>
<li id="n_206" class="hl"><span class="hl opt">} </span><span class="hl slc">#}}}</span></li>
<li id="n_207" class="hl"></li>
<li id="n_208" class="hl"><span class="hl kwa">sub </span>rcs_prepedit <span class="hl opt">($) { </span><span class="hl slc">#{{{</span></li>
<li id="n_209" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$file</span><span class="hl opt">=</span><span class="hl kwc">shift</span><span class="hl opt">;</span></li>
<li id="n_210" class="hl"></li>
<li id="n_211" class="hl">    check_config<span class="hl opt">();</span></li>
<li id="n_212" class="hl"></li>
<li id="n_213" class="hl">    <span class="hl slc"># For monotone, return the revision of the file when</span></li>
<li id="n_214" class="hl">    <span class="hl slc"># editing begins.</span></li>
<li id="n_215" class="hl">    <span class="hl kwa">return </span>get_rev<span class="hl opt">();</span></li>
<li id="n_216" class="hl"><span class="hl opt">} </span><span class="hl slc">#}}}</span></li>
<li id="n_217" class="hl"></li>
<li id="n_218" class="hl"><span class="hl kwa">sub </span>rcs_commit <span class="hl opt">(</span><span class="hl kwb">$$$</span><span class="hl opt">;</span><span class="hl kwb">$$</span><span class="hl opt">) { </span><span class="hl slc">#{{{</span></li>
<li id="n_219" class="hl">    <span class="hl slc"># Tries to commit the page; returns undef on _success_ and</span></li>
<li id="n_220" class="hl">    <span class="hl slc"># a version of the page with the rcs&#39;s conflict markers on failure.</span></li>
<li id="n_221" class="hl">    <span class="hl slc"># The file is relative to the srcdir.</span></li>
<li id="n_222" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$file</span><span class="hl opt">=</span><span class="hl kwc">shift</span><span class="hl opt">;</span></li>
<li id="n_223" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$message</span><span class="hl opt">=</span><span class="hl kwc">shift</span><span class="hl opt">;</span></li>
<li id="n_224" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$rcstoken</span><span class="hl opt">=</span><span class="hl kwc">shift</span><span class="hl opt">;</span></li>
<li id="n_225" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$user</span><span class="hl opt">=</span><span class="hl kwc">shift</span><span class="hl opt">;</span></li>
<li id="n_226" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$ipaddr</span><span class="hl opt">=</span><span class="hl kwc">shift</span><span class="hl opt">;</span></li>
<li id="n_227" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$author</span><span class="hl opt">;</span></li>
<li id="n_228" class="hl"></li>
<li id="n_229" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">defined </span><span class="hl kwb">$user</span><span class="hl opt">) {</span></li>
<li id="n_230" class="hl">        <span class="hl kwb">$author</span><span class="hl opt">=</span><span class="hl sng">&quot;Web user: &quot;</span> <span class="hl opt">. </span><span class="hl kwb">$user</span><span class="hl opt">;</span></li>
<li id="n_231" class="hl">    <span class="hl opt">}</span></li>
<li id="n_232" class="hl">    <span class="hl kwa">elsif </span><span class="hl opt">(</span><span class="hl kwc">defined </span><span class="hl kwb">$ipaddr</span><span class="hl opt">) {</span></li>
<li id="n_233" class="hl">        <span class="hl kwb">$author</span><span class="hl opt">=</span><span class="hl sng">&quot;Web IP: &quot;</span> <span class="hl opt">. </span><span class="hl kwb">$ipaddr</span><span class="hl opt">;</span></li>
<li id="n_234" class="hl">    <span class="hl opt">}</span></li>
<li id="n_235" class="hl">    <span class="hl kwa">else </span><span class="hl opt">{</span></li>
<li id="n_236" class="hl">        <span class="hl kwb">$author</span><span class="hl opt">=</span><span class="hl sng">&quot;Web: Anonymous&quot;</span><span class="hl opt">;</span></li>
<li id="n_237" class="hl">    <span class="hl opt">}</span></li>
<li id="n_238" class="hl"></li>
<li id="n_239" class="hl">    check_config<span class="hl opt">();</span></li>
<li id="n_240" class="hl"></li>
<li id="n_241" class="hl">    <span class="hl kwc">my </span><span class="hl opt">(</span><span class="hl kwb">$oldrev</span><span class="hl opt">)= </span><span class="hl kwb">$rcstoken</span><span class="hl opt">=~ </span><span class="hl kwd">m/^($sha1_pattern)$/</span><span class="hl opt">; </span><span class="hl slc"># untaint</span></li>
<li id="n_242" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$rev </span><span class="hl opt">= </span>get_rev<span class="hl opt">();</span></li>
<li id="n_243" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">defined </span><span class="hl kwb">$rev </span><span class="hl opt">&amp;&amp; </span><span class="hl kwc">defined </span><span class="hl kwb">$oldrev </span><span class="hl opt">&amp;&amp; </span><span class="hl kwb">$rev </span><span class="hl kwc">ne </span><span class="hl kwb">$oldrev</span><span class="hl opt">) {</span></li>
<li id="n_244" class="hl">        <span class="hl kwc">my </span><span class="hl kwb">$automator </span><span class="hl opt">= </span>Monotone-<span class="hl opt">&gt;</span><span class="hl kwd">new</span><span class="hl opt">();</span></li>
<li id="n_245" class="hl">        <span class="hl kwb">$automator</span><span class="hl opt">-&gt;</span><span class="hl kwd">open_args</span><span class="hl opt">(</span><span class="hl sng">&quot;--root&quot;</span><span class="hl opt">, </span><span class="hl kwb">$config</span><span class="hl opt">{</span>mtnrootdir<span class="hl opt">}, </span><span class="hl sng">&quot;--key&quot;</span><span class="hl opt">, </span><span class="hl kwb">$config</span><span class="hl opt">{</span>mtnkey<span class="hl opt">});</span></li>
<li id="n_246" class="hl"></li>
<li id="n_247" class="hl">        <span class="hl slc"># Something has been committed, has this file changed?</span></li>
<li id="n_248" class="hl">        <span class="hl kwc">my </span><span class="hl opt">(</span><span class="hl kwb">$out</span><span class="hl opt">, </span><span class="hl kwb">$err</span><span class="hl opt">);</span></li>
<li id="n_249" class="hl">        <span class="hl kwb">$automator</span><span class="hl opt">-&gt;</span><span class="hl kwd">setOpts</span><span class="hl opt">(</span><span class="hl sng">&quot;r&quot;</span><span class="hl opt">, </span><span class="hl kwb">$oldrev</span><span class="hl opt">, </span><span class="hl sng">&quot;r&quot;</span><span class="hl opt">, </span><span class="hl kwb">$rev</span><span class="hl opt">);</span></li>
<li id="n_250" class="hl">        <span class="hl opt">(</span><span class="hl kwb">$out</span><span class="hl opt">, </span><span class="hl kwb">$err</span><span class="hl opt">) = </span><span class="hl kwb">$automator</span><span class="hl opt">-&gt;</span><span class="hl kwd">call</span><span class="hl opt">(</span><span class="hl sng">&quot;content_diff&quot;</span><span class="hl opt">, </span><span class="hl kwb">$file</span><span class="hl opt">);</span></li>
<li id="n_251" class="hl">        debug<span class="hl opt">(</span><span class="hl sng">&quot;Problem committing </span><span class="hl ipl">$file</span><span class="hl sng">&quot;</span><span class="hl opt">) </span><span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$err </span><span class="hl kwc">ne </span><span class="hl sng">&quot;&quot;</span><span class="hl opt">);</span></li>
<li id="n_252" class="hl">        <span class="hl kwc">my </span><span class="hl kwb">$diff </span><span class="hl opt">= </span><span class="hl kwb">$out</span><span class="hl opt">;</span></li>
<li id="n_253" class="hl">        </li>
<li id="n_254" class="hl">        <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$diff</span><span class="hl opt">) {</span></li>
<li id="n_255" class="hl">            <span class="hl slc"># Commit a revision with just this file changed off</span></li>
<li id="n_256" class="hl">            <span class="hl slc"># the old revision.</span></li>
<li id="n_257" class="hl">            <span class="hl slc">#</span></li>
<li id="n_258" class="hl">            <span class="hl slc"># first get the contents</span></li>
<li id="n_259" class="hl">            debug<span class="hl opt">(</span><span class="hl sng">&quot;File changed: forming branch&quot;</span><span class="hl opt">);</span></li>
<li id="n_260" class="hl">            <span class="hl kwc">my </span><span class="hl kwb">$newfile</span><span class="hl opt">=</span>readfile<span class="hl opt">(</span><span class="hl sng">&quot;</span><span class="hl ipl">$config</span><span class="hl sng">{srcdir}/</span><span class="hl ipl">$file</span><span class="hl sng">&quot;</span><span class="hl opt">);</span></li>
<li id="n_261" class="hl">            </li>
<li id="n_262" class="hl">            <span class="hl slc"># then get the old content ID from the diff</span></li>
<li id="n_263" class="hl">            <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$diff </span><span class="hl opt">!~ </span><span class="hl kwd">m/^---\s$file\s+($sha1_pattern)$/m</span><span class="hl opt">) {</span></li>
<li id="n_264" class="hl">                error<span class="hl opt">(</span><span class="hl sng">&quot;Unable to find previous file ID for </span><span class="hl ipl">$file</span><span class="hl sng">&quot;</span><span class="hl opt">);</span></li>
<li id="n_265" class="hl">            <span class="hl opt">}</span></li>
<li id="n_266" class="hl">            <span class="hl kwc">my </span><span class="hl kwb">$oldFileID </span><span class="hl opt">= </span><span class="hl kwb">$1</span><span class="hl opt">;</span></li>
<li id="n_267" class="hl"></li>
<li id="n_268" class="hl">            <span class="hl slc"># get the branch we&#39;re working in</span></li>
<li id="n_269" class="hl">            <span class="hl opt">(</span><span class="hl kwb">$out</span><span class="hl opt">, </span><span class="hl kwb">$err</span><span class="hl opt">) = </span><span class="hl kwb">$automator</span><span class="hl opt">-&gt;</span><span class="hl kwd">call</span><span class="hl opt">(</span><span class="hl sng">&quot;get_option&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;branch&quot;</span><span class="hl opt">);</span></li>
<li id="n_270" class="hl">            <span class="hl kwc">chomp </span><span class="hl kwb">$out</span><span class="hl opt">;</span></li>
<li id="n_271" class="hl">            error<span class="hl opt">(</span><span class="hl sng">&quot;Illegal branch name in monotone workspace&quot;</span><span class="hl opt">) </span><span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$out </span><span class="hl opt">!~ </span><span class="hl kwd">m/^([-\&#64;\w\.]+)$/</span><span class="hl opt">);</span></li>
<li id="n_272" class="hl">            <span class="hl kwc">my </span><span class="hl kwb">$branch </span><span class="hl opt">= </span><span class="hl kwb">$1</span><span class="hl opt">;</span></li>
<li id="n_273" class="hl"></li>
<li id="n_274" class="hl">            <span class="hl slc"># then put the new content into the DB (and record the new content ID)</span></li>
<li id="n_275" class="hl">            <span class="hl kwc">my </span><span class="hl kwb">$newRevID </span><span class="hl opt">= </span>commit_file_to_new_rev<span class="hl opt">(</span><span class="hl kwb">$automator</span><span class="hl opt">, </span><span class="hl kwb">$file</span><span class="hl opt">, </span><span class="hl kwb">$oldFileID</span><span class="hl opt">, </span><span class="hl kwb">$newfile</span><span class="hl opt">, </span><span class="hl kwb">$oldrev</span><span class="hl opt">, </span><span class="hl kwb">$branch</span><span class="hl opt">, </span><span class="hl kwb">$author</span><span class="hl opt">, </span><span class="hl kwb">$message</span><span class="hl opt">);</span></li>
<li id="n_276" class="hl"></li>
<li id="n_277" class="hl">            <span class="hl kwb">$automator</span><span class="hl opt">-&gt;</span><span class="hl kwc">close</span><span class="hl opt">();</span></li>
<li id="n_278" class="hl"></li>
<li id="n_279" class="hl">            <span class="hl slc"># if we made it to here then the file has been committed... revert the local copy</span></li>
<li id="n_280" class="hl">            <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">system</span><span class="hl opt">(</span><span class="hl sng">&quot;mtn&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--root=</span><span class="hl ipl">$config</span><span class="hl sng">{mtnrootdir}&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;revert&quot;</span><span class="hl opt">, </span><span class="hl kwb">$file</span><span class="hl opt">) != </span><span class="hl num">0</span><span class="hl opt">) {</span></li>
<li id="n_281" class="hl">                debug<span class="hl opt">(</span><span class="hl sng">&quot;Unable to revert </span><span class="hl ipl">$file </span><span class="hl sng">after merge on conflicted commit!&quot;</span><span class="hl opt">);</span></li>
<li id="n_282" class="hl">            <span class="hl opt">}</span></li>
<li id="n_283" class="hl">            debug<span class="hl opt">(</span><span class="hl sng">&quot;Divergence created! Attempting auto-merge.&quot;</span><span class="hl opt">);</span></li>
<li id="n_284" class="hl"></li>
<li id="n_285" class="hl">            <span class="hl slc"># see if it will merge cleanly</span></li>
<li id="n_286" class="hl">            <span class="hl kwb">$ENV</span><span class="hl opt">{</span>MTN_MERGE<span class="hl opt">}=</span><span class="hl sng">&quot;fail&quot;</span><span class="hl opt">;</span></li>
<li id="n_287" class="hl">            <span class="hl kwc">my </span><span class="hl kwb">$mergeResult </span><span class="hl opt">= </span>mtn_merge<span class="hl opt">(</span><span class="hl kwb">$newRevID</span><span class="hl opt">, </span><span class="hl kwb">$rev</span><span class="hl opt">, </span><span class="hl kwb">$branch</span><span class="hl opt">, </span><span class="hl kwb">$author</span><span class="hl opt">);</span></li>
<li id="n_288" class="hl">            <span class="hl kwb">$ENV</span><span class="hl opt">{</span>MTN_MERGE<span class="hl opt">}=</span><span class="hl sng">&quot;&quot;</span><span class="hl opt">;</span></li>
<li id="n_289" class="hl"></li>
<li id="n_290" class="hl">            <span class="hl slc"># push any changes so far</span></li>
<li id="n_291" class="hl">            <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">defined</span><span class="hl opt">(</span><span class="hl kwb">$config</span><span class="hl opt">{</span>mtnsync<span class="hl opt">}) &amp;&amp; </span><span class="hl kwb">$config</span><span class="hl opt">{</span>mtnsync<span class="hl opt">}) {</span></li>
<li id="n_292" class="hl">                <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">system</span><span class="hl opt">(</span><span class="hl sng">&quot;mtn&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--root=</span><span class="hl ipl">$config</span><span class="hl sng">{mtnrootdir}&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;push&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--quiet&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--ticker=none&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--key&quot;</span><span class="hl opt">, </span><span class="hl kwb">$config</span><span class="hl opt">{</span>mtnkey<span class="hl opt">}) != </span><span class="hl num">0</span><span class="hl opt">) {</span></li>
<li id="n_293" class="hl">                    debug<span class="hl opt">(</span><span class="hl sng">&quot;monotone push failed&quot;</span><span class="hl opt">);</span></li>
<li id="n_294" class="hl">                <span class="hl opt">}</span></li>
<li id="n_295" class="hl">            <span class="hl opt">}</span></li>
<li id="n_296" class="hl">            </li>
<li id="n_297" class="hl">            <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">defined</span><span class="hl opt">(</span><span class="hl kwb">$mergeResult</span><span class="hl opt">)) {</span></li>
<li id="n_298" class="hl">                <span class="hl slc"># everything is merged - bring outselves up to date</span></li>
<li id="n_299" class="hl">                <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">system</span><span class="hl opt">(</span><span class="hl sng">&quot;mtn&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--root=</span><span class="hl ipl">$config</span><span class="hl sng">{mtnrootdir}&quot;</span><span class="hl opt">,</span></li>
<li id="n_300" class="hl">                           <span class="hl sng">&quot;update&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;-r&quot;</span><span class="hl opt">, </span><span class="hl kwb">$mergeResult</span><span class="hl opt">) != </span><span class="hl num">0</span><span class="hl opt">) {</span></li>
<li id="n_301" class="hl">                    debug<span class="hl opt">(</span><span class="hl sng">&quot;Unable to update to rev </span><span class="hl ipl">$mergeResult </span><span class="hl sng">after merge on conflicted commit!&quot;</span><span class="hl opt">);</span></li>
<li id="n_302" class="hl">                <span class="hl opt">}</span></li>
<li id="n_303" class="hl">            <span class="hl opt">}</span></li>
<li id="n_304" class="hl">            <span class="hl kwa">else </span><span class="hl opt">{</span></li>
<li id="n_305" class="hl">                debug<span class="hl opt">(</span><span class="hl sng">&quot;Auto-merge failed.  Using diff-merge to add conflict markers.&quot;</span><span class="hl opt">);</span></li>
<li id="n_306" class="hl">                </li>
<li id="n_307" class="hl">                <span class="hl kwb">$ENV</span><span class="hl opt">{</span>MTN_MERGE<span class="hl opt">}=</span><span class="hl sng">&quot;diffutils&quot;</span><span class="hl opt">;</span></li>
<li id="n_308" class="hl">                <span class="hl kwb">$ENV</span><span class="hl opt">{</span>MTN_MERGE_DIFFUTILS<span class="hl opt">}=</span><span class="hl sng">&quot;partial=true&quot;</span><span class="hl opt">;</span></li>
<li id="n_309" class="hl">                <span class="hl kwb">$mergeResult </span><span class="hl opt">= </span>mtn_merge<span class="hl opt">(</span><span class="hl kwb">$newRevID</span><span class="hl opt">, </span><span class="hl kwb">$rev</span><span class="hl opt">, </span><span class="hl kwb">$branch</span><span class="hl opt">, </span><span class="hl kwb">$author</span><span class="hl opt">);</span></li>
<li id="n_310" class="hl">                <span class="hl kwb">$ENV</span><span class="hl opt">{</span>MTN_MERGE<span class="hl opt">}=</span><span class="hl sng">&quot;&quot;</span><span class="hl opt">;</span></li>
<li id="n_311" class="hl">                <span class="hl kwb">$ENV</span><span class="hl opt">{</span>MTN_MERGE_DIFFUTILS<span class="hl opt">}=</span><span class="hl sng">&quot;&quot;</span><span class="hl opt">;</span></li>
<li id="n_312" class="hl">                </li>
<li id="n_313" class="hl">                <span class="hl kwa">if </span><span class="hl opt">(!</span><span class="hl kwc">defined</span><span class="hl opt">(</span><span class="hl kwb">$mergeResult</span><span class="hl opt">)) {</span></li>
<li id="n_314" class="hl">                    debug<span class="hl opt">(</span><span class="hl sng">&quot;Unable to insert conflict markers!&quot;</span><span class="hl opt">);</span></li>
<li id="n_315" class="hl">                    error<span class="hl opt">(</span><span class="hl sng">&quot;Your commit succeeded. Unfortunately, someone else committed something to the same &quot;</span><span class="hl opt">.</span></li>
<li id="n_316" class="hl">                        <span class="hl sng">&quot;part of the wiki at the same time. Both versions are stored in the monotone repository, &quot;</span><span class="hl opt">.</span></li>
<li id="n_317" class="hl">                        <span class="hl sng">&quot;but at present the different versions cannot be reconciled through the web interface. &quot;</span><span class="hl opt">.</span></li>
<li id="n_318" class="hl">                        <span class="hl sng">&quot;Please use the non-web interface to resolve the conflicts.&quot;</span><span class="hl opt">);</span></li>
<li id="n_319" class="hl">                <span class="hl opt">}</span></li>
<li id="n_320" class="hl">                </li>
<li id="n_321" class="hl">                <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">system</span><span class="hl opt">(</span><span class="hl sng">&quot;mtn&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--root=</span><span class="hl ipl">$config</span><span class="hl sng">{mtnrootdir}&quot;</span><span class="hl opt">,</span></li>
<li id="n_322" class="hl">                           <span class="hl sng">&quot;update&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;-r&quot;</span><span class="hl opt">, </span><span class="hl kwb">$mergeResult</span><span class="hl opt">) != </span><span class="hl num">0</span><span class="hl opt">) {</span></li>
<li id="n_323" class="hl">                    debug<span class="hl opt">(</span><span class="hl sng">&quot;Unable to update to rev </span><span class="hl ipl">$mergeResult </span><span class="hl sng">after conflict-enhanced merge on conflicted commit!&quot;</span><span class="hl opt">);</span></li>
<li id="n_324" class="hl">                <span class="hl opt">}</span></li>
<li id="n_325" class="hl">                </li>
<li id="n_326" class="hl">                <span class="hl slc"># return &quot;conflict enhanced&quot; file to the user</span></li>
<li id="n_327" class="hl">                <span class="hl slc"># for cleanup note, this relies on the fact</span></li>
<li id="n_328" class="hl">                <span class="hl slc"># that ikiwiki seems to call rcs_prepedit()</span></li>
<li id="n_329" class="hl">                <span class="hl slc"># again after we return</span></li>
<li id="n_330" class="hl">                <span class="hl kwa">return </span>readfile<span class="hl opt">(</span><span class="hl sng">&quot;</span><span class="hl ipl">$config</span><span class="hl sng">{srcdir}/</span><span class="hl ipl">$file</span><span class="hl sng">&quot;</span><span class="hl opt">);</span></li>
<li id="n_331" class="hl">            <span class="hl opt">}</span></li>
<li id="n_332" class="hl">            <span class="hl kwa">return </span><span class="hl kwc">undef</span><span class="hl opt">;</span></li>
<li id="n_333" class="hl">        <span class="hl opt">}</span></li>
<li id="n_334" class="hl">        <span class="hl kwb">$automator</span><span class="hl opt">-&gt;</span><span class="hl kwc">close</span><span class="hl opt">();</span></li>
<li id="n_335" class="hl">    <span class="hl opt">}</span></li>
<li id="n_336" class="hl"></li>
<li id="n_337" class="hl">    <span class="hl slc"># If we reached here then the file we&#39;re looking at hasn&#39;t changed</span></li>
<li id="n_338" class="hl">    <span class="hl slc"># since $oldrev. Commit it.</span></li>
<li id="n_339" class="hl"></li>
<li id="n_340" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">system</span><span class="hl opt">(</span><span class="hl sng">&quot;mtn&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--root=</span><span class="hl ipl">$config</span><span class="hl sng">{mtnrootdir}&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;commit&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--quiet&quot;</span><span class="hl opt">,</span></li>
<li id="n_341" class="hl">               <span class="hl sng">&quot;--author&quot;</span><span class="hl opt">, </span><span class="hl kwb">$author</span><span class="hl opt">, </span><span class="hl sng">&quot;--key&quot;</span><span class="hl opt">, </span><span class="hl kwb">$config</span><span class="hl opt">{</span>mtnkey<span class="hl opt">}, </span><span class="hl sng">&quot;-m&quot;</span><span class="hl opt">,</span></li>
<li id="n_342" class="hl">           possibly_foolish_untaint<span class="hl opt">(</span><span class="hl kwb">$message</span><span class="hl opt">), </span><span class="hl kwb">$file</span><span class="hl opt">) != </span><span class="hl num">0</span><span class="hl opt">) {</span></li>
<li id="n_343" class="hl">        debug<span class="hl opt">(</span><span class="hl sng">&quot;Traditional commit failed! Returning data as conflict.&quot;</span><span class="hl opt">);</span></li>
<li id="n_344" class="hl">        <span class="hl kwc">my </span><span class="hl kwb">$conflict</span><span class="hl opt">=</span>readfile<span class="hl opt">(</span><span class="hl sng">&quot;</span><span class="hl ipl">$config</span><span class="hl sng">{srcdir}/</span><span class="hl ipl">$file</span><span class="hl sng">&quot;</span><span class="hl opt">);</span></li>
<li id="n_345" class="hl">        <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">system</span><span class="hl opt">(</span><span class="hl sng">&quot;mtn&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--root=</span><span class="hl ipl">$config</span><span class="hl sng">{mtnrootdir}&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;revert&quot;</span><span class="hl opt">,</span></li>
<li id="n_346" class="hl">                   <span class="hl sng">&quot;--quiet&quot;</span><span class="hl opt">, </span><span class="hl kwb">$file</span><span class="hl opt">) != </span><span class="hl num">0</span><span class="hl opt">) {</span></li>
<li id="n_347" class="hl">            debug<span class="hl opt">(</span><span class="hl sng">&quot;monotone revert failed&quot;</span><span class="hl opt">);</span></li>
<li id="n_348" class="hl">        <span class="hl opt">}</span></li>
<li id="n_349" class="hl">        <span class="hl kwa">return </span><span class="hl kwb">$conflict</span><span class="hl opt">;</span></li>
<li id="n_350" class="hl">    <span class="hl opt">}</span></li>
<li id="n_351" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">defined</span><span class="hl opt">(</span><span class="hl kwb">$config</span><span class="hl opt">{</span>mtnsync<span class="hl opt">}) &amp;&amp; </span><span class="hl kwb">$config</span><span class="hl opt">{</span>mtnsync<span class="hl opt">}) {</span></li>
<li id="n_352" class="hl">        <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">system</span><span class="hl opt">(</span><span class="hl sng">&quot;mtn&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--root=</span><span class="hl ipl">$config</span><span class="hl sng">{mtnrootdir}&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;push&quot;</span><span class="hl opt">,</span></li>
<li id="n_353" class="hl">                   <span class="hl sng">&quot;--quiet&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--ticker=none&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--key&quot;</span><span class="hl opt">,</span></li>
<li id="n_354" class="hl">                   <span class="hl kwb">$config</span><span class="hl opt">{</span>mtnkey<span class="hl opt">}) != </span><span class="hl num">0</span><span class="hl opt">) {</span></li>
<li id="n_355" class="hl">            debug<span class="hl opt">(</span><span class="hl sng">&quot;monotone push failed&quot;</span><span class="hl opt">);</span></li>
<li id="n_356" class="hl">        <span class="hl opt">}</span></li>
<li id="n_357" class="hl">    <span class="hl opt">}</span></li>
<li id="n_358" class="hl"></li>
<li id="n_359" class="hl">    <span class="hl kwa">return </span><span class="hl kwc">undef </span><span class="hl slc"># success</span></li>
<li id="n_360" class="hl"><span class="hl opt">} </span><span class="hl slc">#}}}</span></li>
<li id="n_361" class="hl"></li>
<li id="n_362" class="hl"><span class="hl kwa">sub </span>rcs_commit_staged <span class="hl opt">(</span><span class="hl kwb">$$$</span><span class="hl opt">) {</span></li>
<li id="n_363" class="hl">    <span class="hl slc"># Commits all staged changes. Changes can be staged using rcs_add,</span></li>
<li id="n_364" class="hl">    <span class="hl slc"># rcs_remove, and rcs_rename.</span></li>
<li id="n_365" class="hl">    <span class="hl kwc">my </span><span class="hl opt">(</span><span class="hl kwb">$message</span><span class="hl opt">, </span><span class="hl kwb">$user</span><span class="hl opt">, </span><span class="hl kwb">$ipaddr</span><span class="hl opt">)=</span><span class="hl kwb">&#64;_</span><span class="hl opt">;</span></li>
<li id="n_366" class="hl">    </li>
<li id="n_367" class="hl">    <span class="hl slc"># Note - this will also commit any spurious changes that happen to be</span></li>
<li id="n_368" class="hl">    <span class="hl slc"># lying around in the working copy.  There shouldn&#39;t be any, but...</span></li>
<li id="n_369" class="hl">    </li>
<li id="n_370" class="hl">    check_config<span class="hl opt">();</span></li>
<li id="n_371" class="hl"></li>
<li id="n_372" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$author</span><span class="hl opt">;</span></li>
<li id="n_373" class="hl"></li>
<li id="n_374" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">defined </span><span class="hl kwb">$user</span><span class="hl opt">) {</span></li>
<li id="n_375" class="hl">        <span class="hl kwb">$author</span><span class="hl opt">=</span><span class="hl sng">&quot;Web user: &quot;</span> <span class="hl opt">. </span><span class="hl kwb">$user</span><span class="hl opt">;</span></li>
<li id="n_376" class="hl">    <span class="hl opt">}</span></li>
<li id="n_377" class="hl">    <span class="hl kwa">elsif </span><span class="hl opt">(</span><span class="hl kwc">defined </span><span class="hl kwb">$ipaddr</span><span class="hl opt">) {</span></li>
<li id="n_378" class="hl">        <span class="hl kwb">$author</span><span class="hl opt">=</span><span class="hl sng">&quot;Web IP: &quot;</span> <span class="hl opt">. </span><span class="hl kwb">$ipaddr</span><span class="hl opt">;</span></li>
<li id="n_379" class="hl">    <span class="hl opt">}</span></li>
<li id="n_380" class="hl">    <span class="hl kwa">else </span><span class="hl opt">{</span></li>
<li id="n_381" class="hl">        <span class="hl kwb">$author</span><span class="hl opt">=</span><span class="hl sng">&quot;Web: Anonymous&quot;</span><span class="hl opt">;</span></li>
<li id="n_382" class="hl">    <span class="hl opt">}</span></li>
<li id="n_383" class="hl"></li>
<li id="n_384" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">system</span><span class="hl opt">(</span><span class="hl sng">&quot;mtn&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--root=</span><span class="hl ipl">$config</span><span class="hl sng">{mtnrootdir}&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;commit&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--quiet&quot;</span><span class="hl opt">,</span></li>
<li id="n_385" class="hl">               <span class="hl sng">&quot;--author&quot;</span><span class="hl opt">, </span><span class="hl kwb">$author</span><span class="hl opt">, </span><span class="hl sng">&quot;--key&quot;</span><span class="hl opt">, </span><span class="hl kwb">$config</span><span class="hl opt">{</span>mtnkey<span class="hl opt">}, </span><span class="hl sng">&quot;-m&quot;</span><span class="hl opt">,</span></li>
<li id="n_386" class="hl">           possibly_foolish_untaint<span class="hl opt">(</span><span class="hl kwb">$message</span><span class="hl opt">)) != </span><span class="hl num">0</span><span class="hl opt">) {</span></li>
<li id="n_387" class="hl">        error<span class="hl opt">(</span><span class="hl sng">&quot;Monotone commit failed&quot;</span><span class="hl opt">);</span></li>
<li id="n_388" class="hl">    <span class="hl opt">}</span></li>
<li id="n_389" class="hl"><span class="hl opt">}</span></li>
<li id="n_390" class="hl"></li>
<li id="n_391" class="hl"><span class="hl kwa">sub </span>rcs_add <span class="hl opt">($) { </span><span class="hl slc">#{{{</span></li>
<li id="n_392" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$file</span><span class="hl opt">=</span><span class="hl kwc">shift</span><span class="hl opt">;</span></li>
<li id="n_393" class="hl"></li>
<li id="n_394" class="hl">    check_config<span class="hl opt">();</span></li>
<li id="n_395" class="hl"></li>
<li id="n_396" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">system</span><span class="hl opt">(</span><span class="hl sng">&quot;mtn&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--root=</span><span class="hl ipl">$config</span><span class="hl sng">{mtnrootdir}&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;add&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--quiet&quot;</span><span class="hl opt">,</span></li>
<li id="n_397" class="hl">               <span class="hl kwb">$file</span><span class="hl opt">) != </span><span class="hl num">0</span><span class="hl opt">) {</span></li>
<li id="n_398" class="hl">        error<span class="hl opt">(</span><span class="hl sng">&quot;Monotone add failed&quot;</span><span class="hl opt">);</span></li>
<li id="n_399" class="hl">    <span class="hl opt">}</span></li>
<li id="n_400" class="hl"><span class="hl opt">} </span><span class="hl slc">#}}}</span></li>
<li id="n_401" class="hl"></li>
<li id="n_402" class="hl"><span class="hl kwa">sub </span>rcs_remove <span class="hl opt">($) { </span><span class="hl slc"># {{{</span></li>
<li id="n_403" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$file </span><span class="hl opt">= </span><span class="hl kwc">shift</span><span class="hl opt">;</span></li>
<li id="n_404" class="hl"></li>
<li id="n_405" class="hl">    check_config<span class="hl opt">();</span></li>
<li id="n_406" class="hl"></li>
<li id="n_407" class="hl">    <span class="hl slc"># Note: it is difficult to undo a remove in Monotone at the moment.</span></li>
<li id="n_408" class="hl">    <span class="hl slc"># Until this is fixed, it might be better to make &#39;rm&#39; move things</span></li>
<li id="n_409" class="hl">    <span class="hl slc"># into an attic, rather than actually remove them.</span></li>
<li id="n_410" class="hl">    <span class="hl slc"># To resurrect a file, you currently add a new file with the contents</span></li>
<li id="n_411" class="hl">    <span class="hl slc"># you want it to have.  This loses all connectivity and automated</span></li>
<li id="n_412" class="hl">    <span class="hl slc"># merging with the &#39;pre-delete&#39; versions of the file.</span></li>
<li id="n_413" class="hl"></li>
<li id="n_414" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">system</span><span class="hl opt">(</span><span class="hl sng">&quot;mtn&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--root=</span><span class="hl ipl">$config</span><span class="hl sng">{mtnrootdir}&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;rm&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--quiet&quot;</span><span class="hl opt">,</span></li>
<li id="n_415" class="hl">               <span class="hl kwb">$file</span><span class="hl opt">) != </span><span class="hl num">0</span><span class="hl opt">) {</span></li>
<li id="n_416" class="hl">        error<span class="hl opt">(</span><span class="hl sng">&quot;Monotone remove failed&quot;</span><span class="hl opt">);</span></li>
<li id="n_417" class="hl">    <span class="hl opt">}</span></li>
<li id="n_418" class="hl"><span class="hl opt">} </span><span class="hl slc">#}}}</span></li>
<li id="n_419" class="hl"></li>
<li id="n_420" class="hl"><span class="hl kwa">sub </span>rcs_rename <span class="hl opt">(</span><span class="hl kwb">$$</span><span class="hl opt">) { </span><span class="hl slc"># {{{</span></li>
<li id="n_421" class="hl">    <span class="hl kwc">my </span><span class="hl opt">(</span><span class="hl kwb">$src</span><span class="hl opt">, </span><span class="hl kwb">$dest</span><span class="hl opt">) = </span><span class="hl kwb">&#64;_</span><span class="hl opt">;</span></li>
<li id="n_422" class="hl"></li>
<li id="n_423" class="hl">    check_config<span class="hl opt">();</span></li>
<li id="n_424" class="hl"></li>
<li id="n_425" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">system</span><span class="hl opt">(</span><span class="hl sng">&quot;mtn&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--root=</span><span class="hl ipl">$config</span><span class="hl sng">{mtnrootdir}&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;rename&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--quiet&quot;</span><span class="hl opt">,</span></li>
<li id="n_426" class="hl">               <span class="hl kwb">$src</span><span class="hl opt">, </span><span class="hl kwb">$dest</span><span class="hl opt">) != </span><span class="hl num">0</span><span class="hl opt">) {</span></li>
<li id="n_427" class="hl">        error<span class="hl opt">(</span><span class="hl sng">&quot;Monotone rename failed&quot;</span><span class="hl opt">);</span></li>
<li id="n_428" class="hl">    <span class="hl opt">}</span></li>
<li id="n_429" class="hl"><span class="hl opt">} </span><span class="hl slc">#}}}</span></li>
<li id="n_430" class="hl"></li>
<li id="n_431" class="hl"><span class="hl kwa">sub </span>rcs_recentchanges <span class="hl opt">($) { </span><span class="hl slc">#{{{</span></li>
<li id="n_432" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$num</span><span class="hl opt">=</span><span class="hl kwc">shift</span><span class="hl opt">;</span></li>
<li id="n_433" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">&#64;ret</span><span class="hl opt">;</span></li>
<li id="n_434" class="hl"></li>
<li id="n_435" class="hl">    check_config<span class="hl opt">();</span></li>
<li id="n_436" class="hl"></li>
<li id="n_437" class="hl">    <span class="hl slc"># use log --brief to get a list of revs, as this</span></li>
<li id="n_438" class="hl">    <span class="hl slc"># gives the results in a nice order</span></li>
<li id="n_439" class="hl">    <span class="hl slc"># (otherwise we&#39;d have to do our own date sorting)</span></li>
<li id="n_440" class="hl"></li>
<li id="n_441" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">&#64;revs</span><span class="hl opt">;</span></li>
<li id="n_442" class="hl"></li>
<li id="n_443" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$child </span><span class="hl opt">= </span><span class="hl kwc">open</span><span class="hl opt">(</span>MTNLOG<span class="hl opt">, </span><span class="hl sng">&quot;-|&quot;</span><span class="hl opt">);</span></li>
<li id="n_444" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(! </span><span class="hl kwb">$child</span><span class="hl opt">) {</span></li>
<li id="n_445" class="hl">        <span class="hl kwc">exec</span><span class="hl opt">(</span><span class="hl sng">&quot;mtn&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;log&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--root=</span><span class="hl ipl">$config</span><span class="hl sng">{mtnrootdir}&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--no-graph&quot;</span><span class="hl opt">,</span></li>
<li id="n_446" class="hl">             <span class="hl sng">&quot;--brief&quot;</span><span class="hl opt">) || </span>error<span class="hl opt">(</span><span class="hl sng">&quot;mtn log failed to run&quot;</span><span class="hl opt">);</span></li>
<li id="n_447" class="hl">    <span class="hl opt">}</span></li>
<li id="n_448" class="hl"></li>
<li id="n_449" class="hl">    <span class="hl kwa">while </span><span class="hl opt">((</span><span class="hl kwb">$num </span><span class="hl opt">&gt;= </span><span class="hl num">0</span><span class="hl opt">) </span><span class="hl kwc">and </span><span class="hl opt">(</span><span class="hl kwc">my </span><span class="hl kwb">$line </span><span class="hl opt">= &lt;</span>MTNLOG<span class="hl opt">&gt;)) {</span></li>
<li id="n_450" class="hl">        <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$line </span><span class="hl opt">=~ </span><span class="hl kwd">m/^($sha1_pattern)/</span><span class="hl opt">) {</span></li>
<li id="n_451" class="hl">            <span class="hl kwc">push </span><span class="hl kwb">&#64;revs</span><span class="hl opt">, </span><span class="hl kwb">$1</span><span class="hl opt">;</span></li>
<li id="n_452" class="hl">            <span class="hl kwb">$num </span><span class="hl opt">-= </span><span class="hl num">1</span><span class="hl opt">;</span></li>
<li id="n_453" class="hl">        <span class="hl opt">}</span></li>
<li id="n_454" class="hl">    <span class="hl opt">}</span></li>
<li id="n_455" class="hl">    <span class="hl kwc">close </span>MTNLOG <span class="hl opt">|| </span>debug<span class="hl opt">(</span><span class="hl sng">&quot;mtn log exited </span><span class="hl ipl">$?</span><span class="hl sng">&quot;</span><span class="hl opt">);</span></li>
<li id="n_456" class="hl"></li>
<li id="n_457" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$automator </span><span class="hl opt">= </span>Monotone-<span class="hl opt">&gt;</span><span class="hl kwd">new</span><span class="hl opt">();</span></li>
<li id="n_458" class="hl">    <span class="hl kwb">$automator</span><span class="hl opt">-&gt;</span><span class="hl kwc">open</span><span class="hl opt">(</span><span class="hl kwc">undef</span><span class="hl opt">, </span><span class="hl kwb">$config</span><span class="hl opt">{</span>mtnrootdir<span class="hl opt">});</span></li>
<li id="n_459" class="hl"></li>
<li id="n_460" class="hl">    <span class="hl kwa">while </span><span class="hl opt">(</span><span class="hl kwb">&#64;revs </span><span class="hl opt">!= </span><span class="hl num">0</span><span class="hl opt">) {</span></li>
<li id="n_461" class="hl">        <span class="hl kwc">my </span><span class="hl kwb">$rev </span><span class="hl opt">= </span><span class="hl kwc">shift </span><span class="hl kwb">&#64;revs</span><span class="hl opt">;</span></li>
<li id="n_462" class="hl">        <span class="hl slc"># first go through and figure out the messages, etc</span></li>
<li id="n_463" class="hl"></li>
<li id="n_464" class="hl">        <span class="hl kwc">my </span><span class="hl kwb">$certs </span><span class="hl opt">= [</span>read_certs<span class="hl opt">(</span><span class="hl kwb">$automator</span><span class="hl opt">, </span><span class="hl kwb">$rev</span><span class="hl opt">)];</span></li>
<li id="n_465" class="hl">        </li>
<li id="n_466" class="hl">        <span class="hl kwc">my </span><span class="hl kwb">$user</span><span class="hl opt">;</span></li>
<li id="n_467" class="hl">        <span class="hl kwc">my </span><span class="hl kwb">$when</span><span class="hl opt">;</span></li>
<li id="n_468" class="hl">        <span class="hl kwc">my </span><span class="hl kwb">$committype</span><span class="hl opt">;</span></li>
<li id="n_469" class="hl">        <span class="hl kwc">my </span><span class="hl opt">(</span><span class="hl kwb">&#64;pages</span><span class="hl opt">, </span><span class="hl kwb">&#64;message</span><span class="hl opt">);</span></li>
<li id="n_470" class="hl">        </li>
<li id="n_471" class="hl">        <span class="hl kwa">foreach </span><span class="hl kwc">my </span><span class="hl kwb">$cert </span><span class="hl opt">(</span><span class="hl kwb">&#64;$certs</span><span class="hl opt">) {</span></li>
<li id="n_472" class="hl">            <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$cert</span><span class="hl opt">-&gt;{</span>signature<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&quot;ok&quot;</span> <span class="hl opt">&amp;&amp;</span></li>
<li id="n_473" class="hl">                <span class="hl kwb">$cert</span><span class="hl opt">-&gt;{</span>trust<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&quot;trusted&quot;</span><span class="hl opt">) {</span></li>
<li id="n_474" class="hl">                <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$cert</span><span class="hl opt">-&gt;{</span>name<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&quot;author&quot;</span><span class="hl opt">) {</span></li>
<li id="n_475" class="hl">                    <span class="hl kwb">$user </span><span class="hl opt">= </span><span class="hl kwb">$cert</span><span class="hl opt">-&gt;{</span>value<span class="hl opt">};</span></li>
<li id="n_476" class="hl">                    <span class="hl slc"># detect the source of the commit</span></li>
<li id="n_477" class="hl">                    <span class="hl slc"># from the changelog</span></li>
<li id="n_478" class="hl">                    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$cert</span><span class="hl opt">-&gt;{</span>key<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl kwb">$config</span><span class="hl opt">{</span>mtnkey<span class="hl opt">}) {</span></li>
<li id="n_479" class="hl">                        <span class="hl kwb">$committype </span><span class="hl opt">= </span><span class="hl sng">&quot;web&quot;</span><span class="hl opt">;</span></li>
<li id="n_480" class="hl">                    <span class="hl opt">} </span><span class="hl kwa">else </span><span class="hl opt">{</span></li>
<li id="n_481" class="hl">                        <span class="hl kwb">$committype </span><span class="hl opt">= </span><span class="hl sng">&quot;monotone&quot;</span><span class="hl opt">;</span></li>
<li id="n_482" class="hl">                    <span class="hl opt">}</span></li>
<li id="n_483" class="hl">                <span class="hl opt">} </span><span class="hl kwa">elsif </span><span class="hl opt">(</span><span class="hl kwb">$cert</span><span class="hl opt">-&gt;{</span>name<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&quot;date&quot;</span><span class="hl opt">) {</span></li>
<li id="n_484" class="hl">                    <span class="hl kwb">$when </span><span class="hl opt">= </span>str2time<span class="hl opt">(</span><span class="hl kwb">$cert</span><span class="hl opt">-&gt;{</span>value<span class="hl opt">}, </span><span class="hl sng">&#39;UTC&#39;</span><span class="hl opt">);</span></li>
<li id="n_485" class="hl">                <span class="hl opt">} </span><span class="hl kwa">elsif </span><span class="hl opt">(</span><span class="hl kwb">$cert</span><span class="hl opt">-&gt;{</span>name<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&quot;changelog&quot;</span><span class="hl opt">) {</span></li>
<li id="n_486" class="hl">                    <span class="hl kwc">my </span><span class="hl kwb">$messageText </span><span class="hl opt">= </span><span class="hl kwb">$cert</span><span class="hl opt">-&gt;{</span>value<span class="hl opt">};</span></li>
<li id="n_487" class="hl">                    <span class="hl slc"># split the changelog into multiple</span></li>
<li id="n_488" class="hl">                    <span class="hl slc"># lines</span></li>
<li id="n_489" class="hl">                    <span class="hl kwa">foreach </span><span class="hl kwc">my </span><span class="hl kwb">$msgline </span><span class="hl opt">(</span><span class="hl kwc">split</span><span class="hl opt">(</span><span class="hl kwd">/\n/</span><span class="hl opt">, </span><span class="hl kwb">$messageText</span><span class="hl opt">)) {</span></li>
<li id="n_490" class="hl">                        <span class="hl kwc">push </span><span class="hl kwb">&#64;message</span><span class="hl opt">, { </span>line <span class="hl opt">=&gt; </span><span class="hl kwb">$msgline </span><span class="hl opt">};</span></li>
<li id="n_491" class="hl">                    <span class="hl opt">}</span></li>
<li id="n_492" class="hl">                <span class="hl opt">}</span></li>
<li id="n_493" class="hl">            <span class="hl opt">}</span></li>
<li id="n_494" class="hl">        <span class="hl opt">}</span></li>
<li id="n_495" class="hl">        </li>
<li id="n_496" class="hl">        <span class="hl kwc">my </span><span class="hl kwb">&#64;changed_files </span><span class="hl opt">= </span>get_changed_files<span class="hl opt">(</span><span class="hl kwb">$automator</span><span class="hl opt">, </span><span class="hl kwb">$rev</span><span class="hl opt">);</span></li>
<li id="n_497" class="hl">        <span class="hl kwc">my </span><span class="hl kwb">$file</span><span class="hl opt">;</span></li>
<li id="n_498" class="hl">        </li>
<li id="n_499" class="hl">        <span class="hl kwc">my </span><span class="hl opt">(</span><span class="hl kwb">$out</span><span class="hl opt">, </span><span class="hl kwb">$err</span><span class="hl opt">) = </span><span class="hl kwb">$automator</span><span class="hl opt">-&gt;</span><span class="hl kwd">call</span><span class="hl opt">(</span><span class="hl sng">&quot;parents&quot;</span><span class="hl opt">, </span><span class="hl kwb">$rev</span><span class="hl opt">);</span></li>
<li id="n_500" class="hl">        <span class="hl kwc">my </span><span class="hl kwb">&#64;parents </span><span class="hl opt">= (</span><span class="hl kwb">$out </span><span class="hl opt">=~ </span><span class="hl kwd">m/^($sha1_pattern)$/</span><span class="hl opt">);</span></li>
<li id="n_501" class="hl">        <span class="hl kwc">my </span><span class="hl kwb">$parent </span><span class="hl opt">= </span><span class="hl kwb">$parents</span><span class="hl opt">[</span><span class="hl num">0</span><span class="hl opt">];</span></li>
<li id="n_502" class="hl"></li>
<li id="n_503" class="hl">        <span class="hl kwa">foreach </span><span class="hl kwb">$file </span><span class="hl opt">(</span><span class="hl kwb">&#64;changed_files</span><span class="hl opt">) {</span></li>
<li id="n_504" class="hl">            <span class="hl kwa">next unless </span><span class="hl kwc">length </span><span class="hl kwb">$file</span><span class="hl opt">;</span></li>
<li id="n_505" class="hl">            </li>
<li id="n_506" class="hl">            <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">defined </span><span class="hl kwb">$config</span><span class="hl opt">{</span>diffurl<span class="hl opt">} </span><span class="hl kwc">and </span><span class="hl opt">(</span><span class="hl kwb">&#64;parents </span><span class="hl opt">== </span><span class="hl num">1</span><span class="hl opt">)) {</span></li>
<li id="n_507" class="hl">                <span class="hl kwc">my </span><span class="hl kwb">$diffurl</span><span class="hl opt">=</span><span class="hl kwb">$config</span><span class="hl opt">{</span>diffurl<span class="hl opt">};</span></li>
<li id="n_508" class="hl">                <span class="hl kwb">$diffurl</span><span class="hl opt">=~</span><span class="hl kwd">s/\[\[r1\]\]/$parent/g</span><span class="hl opt">;</span></li>
<li id="n_509" class="hl">                <span class="hl kwb">$diffurl</span><span class="hl opt">=~</span><span class="hl kwd">s/\[\[r2\]\]/$rev/g</span><span class="hl opt">;</span></li>
<li id="n_510" class="hl">                <span class="hl kwb">$diffurl</span><span class="hl opt">=~</span><span class="hl kwd">s/\[\[file\]\]/$file/g</span><span class="hl opt">;</span></li>
<li id="n_511" class="hl">                <span class="hl kwc">push </span><span class="hl kwb">&#64;pages</span><span class="hl opt">, {</span></li>
<li id="n_512" class="hl">                    page <span class="hl opt">=&gt; </span>pagename<span class="hl opt">(</span><span class="hl kwb">$file</span><span class="hl opt">),</span></li>
<li id="n_513" class="hl">                    diffurl <span class="hl opt">=&gt; </span><span class="hl kwb">$diffurl</span><span class="hl opt">,</span></li>
<li id="n_514" class="hl">                <span class="hl opt">};</span></li>
<li id="n_515" class="hl">            <span class="hl opt">}</span></li>
<li id="n_516" class="hl">            <span class="hl kwa">else </span><span class="hl opt">{</span></li>
<li id="n_517" class="hl">                <span class="hl kwc">push </span><span class="hl kwb">&#64;pages</span><span class="hl opt">, {</span></li>
<li id="n_518" class="hl">                    page <span class="hl opt">=&gt; </span>pagename<span class="hl opt">(</span><span class="hl kwb">$file</span><span class="hl opt">),</span></li>
<li id="n_519" class="hl">                <span class="hl opt">}</span></li>
<li id="n_520" class="hl">            <span class="hl opt">}</span></li>
<li id="n_521" class="hl">        <span class="hl opt">}</span></li>
<li id="n_522" class="hl">        </li>
<li id="n_523" class="hl">        <span class="hl kwc">push </span><span class="hl kwb">&#64;ret</span><span class="hl opt">, {</span></li>
<li id="n_524" class="hl">            rev <span class="hl opt">=&gt; </span><span class="hl kwb">$rev</span><span class="hl opt">,</span></li>
<li id="n_525" class="hl">            user <span class="hl opt">=&gt; </span><span class="hl kwb">$user</span><span class="hl opt">,</span></li>
<li id="n_526" class="hl">            committype <span class="hl opt">=&gt; </span><span class="hl kwb">$committype</span><span class="hl opt">,</span></li>
<li id="n_527" class="hl">            <span class="hl kwa">when </span><span class="hl opt">=&gt; </span><span class="hl kwb">$when</span><span class="hl opt">,</span></li>
<li id="n_528" class="hl">            message <span class="hl opt">=&gt; [</span><span class="hl kwb">&#64;message</span><span class="hl opt">],</span></li>
<li id="n_529" class="hl">            pages <span class="hl opt">=&gt; [</span><span class="hl kwb">&#64;pages</span><span class="hl opt">],</span></li>
<li id="n_530" class="hl">        <span class="hl opt">} </span><span class="hl kwa">if </span><span class="hl kwb">&#64;pages</span><span class="hl opt">;</span></li>
<li id="n_531" class="hl">    <span class="hl opt">}</span></li>
<li id="n_532" class="hl"></li>
<li id="n_533" class="hl">    <span class="hl kwb">$automator</span><span class="hl opt">-&gt;</span><span class="hl kwc">close</span><span class="hl opt">();</span></li>
<li id="n_534" class="hl"></li>
<li id="n_535" class="hl">    <span class="hl kwa">return </span><span class="hl kwb">&#64;ret</span><span class="hl opt">;</span></li>
<li id="n_536" class="hl"><span class="hl opt">} </span><span class="hl slc">#}}}</span></li>
<li id="n_537" class="hl"></li>
<li id="n_538" class="hl"><span class="hl kwa">sub </span>rcs_diff <span class="hl opt">($) { </span><span class="hl slc">#{{{</span></li>
<li id="n_539" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$rev</span><span class="hl opt">=</span><span class="hl kwc">shift</span><span class="hl opt">;</span></li>
<li id="n_540" class="hl">    <span class="hl kwc">my </span><span class="hl opt">(</span><span class="hl kwb">$sha1</span><span class="hl opt">) = </span><span class="hl kwb">$rev </span><span class="hl opt">=~ </span><span class="hl kwd">/^($sha1_pattern)$/</span><span class="hl opt">; </span><span class="hl slc"># untaint</span></li>
<li id="n_541" class="hl">    </li>
<li id="n_542" class="hl">    check_config<span class="hl opt">();</span></li>
<li id="n_543" class="hl"></li>
<li id="n_544" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$child </span><span class="hl opt">= </span><span class="hl kwc">open</span><span class="hl opt">(</span>MTNDIFF<span class="hl opt">, </span><span class="hl sng">&quot;-|&quot;</span><span class="hl opt">);</span></li>
<li id="n_545" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(! </span><span class="hl kwb">$child</span><span class="hl opt">) {</span></li>
<li id="n_546" class="hl">        <span class="hl kwc">exec</span><span class="hl opt">(</span><span class="hl sng">&quot;mtn&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;diff&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--root=</span><span class="hl ipl">$config</span><span class="hl sng">{mtnrootdir}&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;-r&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;p:&quot;</span><span class="hl opt">.</span><span class="hl kwb">$sha1</span><span class="hl opt">, </span><span class="hl sng">&quot;-r&quot;</span><span class="hl opt">, </span><span class="hl kwb">$sha1</span><span class="hl opt">) || </span>error<span class="hl opt">(</span><span class="hl sng">&quot;mtn diff </span><span class="hl ipl">$sha1 </span><span class="hl sng">failed to run&quot;</span><span class="hl opt">);</span></li>
<li id="n_547" class="hl">    <span class="hl opt">}</span></li>
<li id="n_548" class="hl"></li>
<li id="n_549" class="hl">    <span class="hl kwc">my </span><span class="hl opt">(</span><span class="hl kwb">&#64;lines</span><span class="hl opt">) = &lt;</span>MTNDIFF<span class="hl opt">&gt;;</span></li>
<li id="n_550" class="hl"></li>
<li id="n_551" class="hl">    <span class="hl kwc">close </span>MTNDIFF <span class="hl opt">|| </span>debug<span class="hl opt">(</span><span class="hl sng">&quot;mtn diff </span><span class="hl ipl">$sha1 </span><span class="hl sng">exited </span><span class="hl ipl">$?</span><span class="hl sng">&quot;</span><span class="hl opt">);</span></li>
<li id="n_552" class="hl"></li>
<li id="n_553" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">wantarray</span><span class="hl opt">) {</span></li>
<li id="n_554" class="hl">        <span class="hl kwa">return </span><span class="hl kwb">&#64;lines</span><span class="hl opt">;</span></li>
<li id="n_555" class="hl">    <span class="hl opt">}</span></li>
<li id="n_556" class="hl">    <span class="hl kwa">else </span><span class="hl opt">{</span></li>
<li id="n_557" class="hl">        <span class="hl kwa">return </span><span class="hl kwc">join</span><span class="hl opt">(</span><span class="hl sng">&quot;&quot;</span><span class="hl opt">, </span><span class="hl kwb">&#64;lines</span><span class="hl opt">);</span></li>
<li id="n_558" class="hl">    <span class="hl opt">}</span></li>
<li id="n_559" class="hl"><span class="hl opt">} </span><span class="hl slc">#}}}</span></li>
<li id="n_560" class="hl"></li>
<li id="n_561" class="hl"><span class="hl kwa">sub </span>rcs_getctime <span class="hl opt">($) { </span><span class="hl slc">#{{{</span></li>
<li id="n_562" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$file</span><span class="hl opt">=</span><span class="hl kwc">shift</span><span class="hl opt">;</span></li>
<li id="n_563" class="hl"></li>
<li id="n_564" class="hl">    check_config<span class="hl opt">();</span></li>
<li id="n_565" class="hl"></li>
<li id="n_566" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$child </span><span class="hl opt">= </span><span class="hl kwc">open</span><span class="hl opt">(</span>MTNLOG<span class="hl opt">, </span><span class="hl sng">&quot;-|&quot;</span><span class="hl opt">);</span></li>
<li id="n_567" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(! </span><span class="hl kwb">$child</span><span class="hl opt">) {</span></li>
<li id="n_568" class="hl">        <span class="hl kwc">exec</span><span class="hl opt">(</span><span class="hl sng">&quot;mtn&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;log&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--root=</span><span class="hl ipl">$config</span><span class="hl sng">{mtnrootdir}&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;--no-graph&quot;</span><span class="hl opt">,</span></li>
<li id="n_569" class="hl">             <span class="hl sng">&quot;--brief&quot;</span><span class="hl opt">, </span><span class="hl kwb">$file</span><span class="hl opt">) || </span>error<span class="hl opt">(</span><span class="hl sng">&quot;mtn log </span><span class="hl ipl">$file </span><span class="hl sng">failed to run&quot;</span><span class="hl opt">);</span></li>
<li id="n_570" class="hl">    <span class="hl opt">}</span></li>
<li id="n_571" class="hl"></li>
<li id="n_572" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$firstRev</span><span class="hl opt">;</span></li>
<li id="n_573" class="hl">    <span class="hl kwa">while </span><span class="hl opt">(&lt;</span>MTNLOG<span class="hl opt">&gt;) {</span></li>
<li id="n_574" class="hl">        <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwd">/^($sha1_pattern)/</span><span class="hl opt">) {</span></li>
<li id="n_575" class="hl">            <span class="hl kwb">$firstRev</span><span class="hl opt">=</span><span class="hl kwb">$1</span><span class="hl opt">;</span></li>
<li id="n_576" class="hl">        <span class="hl opt">}</span></li>
<li id="n_577" class="hl">    <span class="hl opt">}</span></li>
<li id="n_578" class="hl">    <span class="hl kwc">close </span>MTNLOG <span class="hl opt">|| </span>debug<span class="hl opt">(</span><span class="hl sng">&quot;mtn log </span><span class="hl ipl">$file </span><span class="hl sng">exited </span><span class="hl ipl">$?</span><span class="hl sng">&quot;</span><span class="hl opt">);</span></li>
<li id="n_579" class="hl"></li>
<li id="n_580" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(! </span><span class="hl kwc">defined </span><span class="hl kwb">$firstRev</span><span class="hl opt">) {</span></li>
<li id="n_581" class="hl">        debug <span class="hl sng">&quot;failed to parse mtn log for </span><span class="hl ipl">$file</span><span class="hl sng">&quot;</span><span class="hl opt">;</span></li>
<li id="n_582" class="hl">        <span class="hl kwa">return </span><span class="hl num">0</span><span class="hl opt">;</span></li>
<li id="n_583" class="hl">    <span class="hl opt">}</span></li>
<li id="n_584" class="hl"></li>
<li id="n_585" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$automator </span><span class="hl opt">= </span>Monotone-<span class="hl opt">&gt;</span><span class="hl kwd">new</span><span class="hl opt">();</span></li>
<li id="n_586" class="hl">    <span class="hl kwb">$automator</span><span class="hl opt">-&gt;</span><span class="hl kwc">open</span><span class="hl opt">(</span><span class="hl kwc">undef</span><span class="hl opt">, </span><span class="hl kwb">$config</span><span class="hl opt">{</span>mtnrootdir<span class="hl opt">});</span></li>
<li id="n_587" class="hl"></li>
<li id="n_588" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$certs </span><span class="hl opt">= [</span>read_certs<span class="hl opt">(</span><span class="hl kwb">$automator</span><span class="hl opt">, </span><span class="hl kwb">$firstRev</span><span class="hl opt">)];</span></li>
<li id="n_589" class="hl"></li>
<li id="n_590" class="hl">    <span class="hl kwb">$automator</span><span class="hl opt">-&gt;</span><span class="hl kwc">close</span><span class="hl opt">();</span></li>
<li id="n_591" class="hl"></li>
<li id="n_592" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$date</span><span class="hl opt">;</span></li>
<li id="n_593" class="hl"></li>
<li id="n_594" class="hl">    <span class="hl kwa">foreach </span><span class="hl kwc">my </span><span class="hl kwb">$cert </span><span class="hl opt">(</span><span class="hl kwb">&#64;$certs</span><span class="hl opt">) {</span></li>
<li id="n_595" class="hl">        <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$cert</span><span class="hl opt">-&gt;{</span>signature<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&quot;ok&quot;</span> <span class="hl opt">&amp;&amp; </span><span class="hl kwb">$cert</span><span class="hl opt">-&gt;{</span>trust<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&quot;trusted&quot;</span><span class="hl opt">) {</span></li>
<li id="n_596" class="hl">            <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$cert</span><span class="hl opt">-&gt;{</span>name<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&quot;date&quot;</span><span class="hl opt">) {</span></li>
<li id="n_597" class="hl">                <span class="hl kwb">$date </span><span class="hl opt">= </span><span class="hl kwb">$cert</span><span class="hl opt">-&gt;{</span>value<span class="hl opt">};</span></li>
<li id="n_598" class="hl">            <span class="hl opt">}</span></li>
<li id="n_599" class="hl">        <span class="hl opt">}</span></li>
<li id="n_600" class="hl">    <span class="hl opt">}</span></li>
<li id="n_601" class="hl"></li>
<li id="n_602" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(! </span><span class="hl kwc">defined </span><span class="hl kwb">$date</span><span class="hl opt">) {</span></li>
<li id="n_603" class="hl">        debug <span class="hl sng">&quot;failed to find date cert for revision </span><span class="hl ipl">$firstRev </span><span class="hl sng">when looking for creation time of </span><span class="hl ipl">$file</span><span class="hl sng">&quot;</span><span class="hl opt">;</span></li>
<li id="n_604" class="hl">        <span class="hl kwa">return </span><span class="hl num">0</span><span class="hl opt">;</span></li>
<li id="n_605" class="hl">    <span class="hl opt">}</span></li>
<li id="n_606" class="hl"></li>
<li id="n_607" class="hl">    <span class="hl kwb">$date</span><span class="hl opt">=</span>str2time<span class="hl opt">(</span><span class="hl kwb">$date</span><span class="hl opt">, </span><span class="hl sng">&#39;UTC&#39;</span><span class="hl opt">);</span></li>
<li id="n_608" class="hl">    debug<span class="hl opt">(</span><span class="hl sng">&quot;found ctime &quot;</span><span class="hl opt">.</span><span class="hl kwc">localtime</span><span class="hl opt">(</span><span class="hl kwb">$date</span><span class="hl opt">).</span><span class="hl sng">&quot; for </span><span class="hl ipl">$file</span><span class="hl sng">&quot;</span><span class="hl opt">);</span></li>
<li id="n_609" class="hl">    <span class="hl kwa">return </span><span class="hl kwb">$date</span><span class="hl opt">;</span></li>
<li id="n_610" class="hl"><span class="hl opt">} </span><span class="hl slc">#}}}</span></li>
<li id="n_611" class="hl"></li>
<li id="n_612" class="hl"><span class="hl num">1</span></li>
</ol></code></pre></td></tr></table>
</div> <!-- class=content -->
<div class='footer'>generated by <a href='https://git.zx2c4.com/cgit/about/'>cgit v1.2.3</a> (<a href='https://git-scm.com/'>git 2.46.0</a>) at 2025-06-02 02:14:52 +0000</div>
</div> <!-- id=cgit -->
</body>
</html>
 class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;8110&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Erträge aus Beteiligungen&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;800-804&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;I&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_123" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;9000&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;KAPITAL&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;H&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;9&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Q&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_124" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;9010&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Aktien, Geschäftsanteile&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;900-918&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Q&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_125" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;9020&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;nicht einbezahltes Kapital&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;919&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Q&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_126" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;9200&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;KAPITALRÜCKLAGEN&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;H&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;9&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Q&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_127" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;9210&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;freie Rücklage&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;920-929&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Q&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_128" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;9300&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;GEWINN&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;H&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;939&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Q&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_129" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;9310&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Gewinnvortrag Vorjahr&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;980&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Q&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_130" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;9320&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Jahresgewinn&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;985&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Q&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_131" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;9400&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;RÜCKSTELLUNGEN&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;H&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;3&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;L&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_132" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;9420&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Abfertigungsrückstellung&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;300&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;L&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_133" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;9430&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Urlaubsrückstellung&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;304-309&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;L&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_134" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;9700&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;EINLAGEN STILLER GESELLSCHAFTER&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;H&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;9&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Q&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_135" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;9800&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;EB,SB,G+V KONTEN&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;H&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;9&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Q&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_136" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;4640&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Devisengewinne&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;80-83&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;I&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_137" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">chart </span><span class="hl opt">(</span>accno<span class="hl opt">,</span>description<span class="hl opt">,</span>charttype<span class="hl opt">,</span>gifi_accno<span class="hl opt">,</span>category<span class="hl opt">,</span><span class="hl kwa">link</span><span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">(</span><span class="hl sng">&#39;8050&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;Devisenverluste&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;A&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;80-83&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;E&#39;</span><span class="hl opt">,</span><span class="hl sng">&#39;&#39;</span><span class="hl opt">);</span></li>
<li id="n_138" class="hl"><span class="hl slc">--</span></li>
<li id="n_139" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">tax </span><span class="hl opt">(</span>chart_id<span class="hl opt">,</span>rate<span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">((</span><span class="hl kwa">select id from </span>chart <span class="hl kwa">where </span>accno <span class="hl opt">= </span><span class="hl sng">&#39;3530&#39;</span><span class="hl opt">),</span><span class="hl num">0.00</span><span class="hl opt">);</span></li>
<li id="n_140" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">tax </span><span class="hl opt">(</span>chart_id<span class="hl opt">,</span>rate<span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">((</span><span class="hl kwa">select id from </span>chart <span class="hl kwa">where </span>accno <span class="hl opt">= </span><span class="hl sng">&#39;3531&#39;</span><span class="hl opt">),</span><span class="hl num">0.10</span><span class="hl opt">);</span></li>
<li id="n_141" class="hl"><span class="hl kwa">insert into </span><span class="hl kwd">tax </span><span class="hl opt">(</span>chart_id<span class="hl opt">,</span>rate<span class="hl opt">) </span><span class="hl kwa">values </span><span class="hl opt">((</span><span class="hl kwa">select id from </span>chart <span class="hl kwa">where </span>accno <span class="hl opt">= </span><span class="hl sng">&#39;3532&#39;</span><span class="hl opt">),</span><span class="hl num">0.20</span><span class="hl opt">);</span></li>
<li id="n_142" class="hl"><span class="hl slc">--</span></li>
<li id="n_143" class="hl"><span class="hl kwa">INSERT INTO defaults </span><span class="hl opt">(</span>setting_key<span class="hl opt">, </span><span class="hl kwa">value</span><span class="hl opt">) </span><span class="hl kwa">VALUES </span><span class="hl opt">(</span><span class="hl sng">&#39;inventory_accno_id&#39;</span><span class="hl opt">, (</span><span class="hl kwa">select id from </span>chart <span class="hl kwa">where </span>accno <span class="hl opt">= </span><span class="hl sng">&#39;1520&#39;</span><span class="hl opt">)); </span></li>
<li id="n_144" class="hl"><span class="hl kwa">INSERT INTO defaults </span><span class="hl opt">(</span>setting_key<span class="hl opt">, </span><span class="hl kwa">value</span><span class="hl opt">) </span><span class="hl kwa">VALUES </span><span class="hl opt">(</span><span class="hl sng">&#39;income_accno_id&#39;</span><span class="hl opt">, (</span><span class="hl kwa">select id from </span>chart <span class="hl kwa">where </span>accno <span class="hl opt">= </span><span class="hl sng">&#39;4020&#39;</span><span class="hl opt">));</span></li>
<li id="n_145" class="hl"></li>
<li id="n_146" class="hl"> <span class="hl kwa">INSERT INTO defaults </span><span class="hl opt">(</span>setting_key<span class="hl opt">, </span><span class="hl kwa">value</span><span class="hl opt">) </span><span class="hl kwa">VALUES </span><span class="hl opt">(</span><span class="hl sng">&#39;expense_accno_id&#39;</span><span class="hl opt">, (</span><span class="hl kwa">select id from </span>chart <span class="hl kwa">where </span>accno <span class="hl opt">= </span><span class="hl sng">&#39;7610&#39;</span><span class="hl opt">));</span></li>
<li id="n_147" class="hl"></li>
<li id="n_148" class="hl"> <span class="hl kwa">INSERT INTO defaults </span><span class="hl opt">(</span>setting_key<span class="hl opt">, </span><span class="hl kwa">value</span><span class="hl opt">) </span><span class="hl kwa">VALUES </span><span class="hl opt">(</span><span class="hl sng">&#39;fxgain_accno_id&#39;</span><span class="hl opt">, (</span><span class="hl kwa">select id from </span>chart <span class="hl kwa">where </span>accno <span class="hl opt">= </span><span class="hl sng">&#39;4640&#39;</span><span class="hl opt">));</span></li>
<li id="n_149" class="hl"></li>
<li id="n_150" class="hl"> <span class="hl kwa">INSERT INTO defaults </span><span class="hl opt">(</span>setting_key<span class="hl opt">, </span><span class="hl kwa">value</span><span class="hl opt">) </span><span class="hl kwa">VALUES </span><span class="hl opt">(</span><span class="hl sng">&#39;fxloss_accno_id&#39;</span><span class="hl opt">, (</span><span class="hl kwa">select id from </span>chart <span class="hl kwa">where </span>accno <span class="hl opt">= </span><span class="hl sng">&#39;8050&#39;</span><span class="hl opt">));</span></li>
<li id="n_151" class="hl"></li>
<li id="n_152" class="hl"> <span class="hl kwa">INSERT INTO defaults </span><span class="hl opt">(</span>setting_key<span class="hl opt">, </span><span class="hl kwa">value</span><span class="hl opt">) </span><span class="hl kwa">VALUES </span><span class="hl opt">(</span><span class="hl sng">&#39;curr&#39;</span><span class="hl opt">, </span><span class="hl sng">&#39;EUR:USD&#39;</span><span class="hl opt">);</span></li>
<li id="n_153" class="hl"></li>
<li id="n_154" class="hl"> <span class="hl kwa">INSERT INTO defaults </span><span class="hl opt">(</span>setting_key<span class="hl opt">, </span><span class="hl kwa">value</span><span class="hl opt">) </span><span class="hl kwa">VALUES </span><span class="hl opt">(</span><span class="hl sng">&#39;weightunit&#39;</span><span class="hl opt">, </span><span class="hl sng">&#39;kg&#39;</span><span class="hl opt">);</span></li>
<li id="n_155" class="hl"><span class="hl slc">--</span></li>
<li id="n_156" class="hl"><span class="hl kwa">commit</span><span class="hl opt">;</span></li>
</ol></code></pre></td></tr></table>
</div> <!-- class=content -->
<div class='footer'>generated by <a href='https://git.zx2c4.com/cgit/about/'>cgit v1.2.3</a> (<a href='https://git-scm.com/'>git 2.46.0</a>) at 2025-06-02 02:14:51 +0000</div>
</div> <!-- id=cgit -->
</body>
</html>
