17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
+
|
<ul>
<li><a href="#tinymce">TinyMCE</a></li>
<li><a href="#markitup">markitup!</a></li>
</ul>
</li>
<li><a href="#ticket-checkin-links">Link tickets to checkins</a></li>
<li><a href="#th1-usage">Fossil and Th1</a></li>
<li><a href="#versionCompressed">Versioning compressed files</a></li>
</ul>
<h2><a name="CGI">Using <cite>Fossil</cite>'s Built-In CGI</a></h2>
<h3>Motivation</h3>
* You want to share a repository through your existing web infrastructure.
* You want to share more than one repository at the same time.
|
889
890
891
892
893
894
895
896
|
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
<h3>Caveats</h3>
<ul compact='compact'>
<li>puts "[hello hello]" doesn't work because [ triggers the
interpeter, use puts "&#91hello hello]'</li>
</ul>
</nowiki>
</div>
<div>
<h2><a name="versionCompressed">Versioning compressed files</a></h2>
<h3>Goal</h3>
<p>Some file formats are actually zip archives containing text files. For
example Microsoft Office 2007 and newer use docx, xlsx and pptx extensions to
store what is merely xml files zipped into a file.</p>
<p>When edits are made to such files a versioning system is not efficient
because diffing is no more appropriate</p>
<p>The idea is to version the decompressed folder. A script will toggle
Compressed/Uncompressed state</p>
<h3>Sample batch script for use with docx, xlsx and pptx documents</h3>
<p>This script is useful under Windows. It requires zip.exe and unzip.exe
that you can find for example in gnuwin32 ([http://getgnuwin32.sf.net]).</p>
<p>You have three variables to set. Running this script will</p>
<ul compact='compact'>
<li>Autodetect whether the document is in compressed or uncompressed
state</li>
<li>Convert file My_document.docx to a folder named My_document.docx too</li>
<li>Rename file <nowiki>[Content_Types]</nowiki>.xml to a name without
brackets (brackets in file names are not supported by Fossil)</li>
<li>Convert back My_document.docx to file My_document.docx
</ul>
<p>In this way you can work on a docx document, run the script, insert the
uncompressed folder into fossil and run the script again to get your document
back in editable state.</p>
<pre>
<font color="#808080"> 1 </font><font color="#3a5fcd"><i>:: toggle docx state (compressed / uncompressed)</i></font><br />
<font color="#808080"> 2 </font><font color="#3a5fcd"><i>:: @echo off</i></font><br />
<font color="#808080"> 3 </font><br />
<font color="#808080"> 4 </font><font color="#8b4726">SET</font><font
color="#8b4726"> DOCX</font><font
color="#8b4726"><b>=</b></font>My_document.docx<br />
<font color="#808080"> 5 </font><font color="#8b4726">SET</font><font
color="#8b4726"> TMPFILE</font><font
color="#8b4726"><b>=</b></font>tmp_version_compressed_archive.zip<br />
<font color="#808080"> 6 </font><font color="#8b4726">SET</font><font color="#8b4726"> CMDZIP</font><font color="#8b4726"><b>=</b></font><font color="#228b22">"P:\bin\zip.exe"</font><br />
<font color="#808080"> 7 </font><font color="#8b4726">SET</font><font color="#8b4726"> CMDUNZIP</font><font color="#8b4726"><b>=</b></font><font color="#228b22">"P:\bin\unzip.exe"</font><br />
<font color="#808080"> 8 </font><br />
<font color="#808080"> 9 </font><font color="#3a5fcd"><i>:: check whether it is in a directory or file state</i></font><br />
<font color="#808080">10 </font><font color="#8b4726"><b>if</b></font><font color="#8b4726"><b> exist</b></font> <font color="#8b4726">%TEMP%</font>\<font color="#8b4726">%TMPFILE%</font> <font color="#8b4726">del</font> <font color="#27408b">/q</font> <font color="#228b22">"</font><font color="#8b4726">%TEMP%</font><font color="#228b22">\</font><font color="#8b4726">%TMPFILE%</font><font color="#228b22">"</font><br />
<font color="#808080">11 </font><font color="#8b4726"><b>if</b></font><font color="#8b4726"><b> exist</b></font> <font color="#8b4726">%DOCX%</font>\NUL (<br />
<font color="#808080">12 </font> <font color="#8b4726"><b>call</b></font><font color="#8b4726"><b><u> :zip_directory</u></b></font><br />
<font color="#808080">13 </font> <font color="#8b4726"><b>goto</b></font><font color="#8b4726"><b><u> :end</u></b></font><br />
<font color="#808080">14 </font>)<br />
<font color="#808080">15 </font><font color="#8b4726"><b>if</b></font><font color="#8b4726"><b> exist</b></font> <font color="#8b4726">%DOCX%</font> (<br />
<font color="#808080">16 </font> <font color="#8b4726"><b>call</b></font><font color="#8b4726"><b><u> :unzip_file</u></b></font><br />
<font color="#808080">17 </font> <font color="#8b4726"><b>goto</b></font><font color="#8b4726"><b><u> :end</u></b></font><br />
<font color="#808080">18 </font>)<br />
<font color="#808080">19 </font><font color="#8b4726">echo</font><font color="#228b22"> </font><font color="#8b4726">%DOCX%</font><font color="#228b22"> not found</font><br />
<font color="#808080">20 </font><font color="#8b4726"><b>goto</b></font><font color="#8b4726"><b><u> :end</u></b></font><br />
<font color="#808080">21 </font><br />
<font color="#808080">22 </font><font color="#8b4726"><b><u>:zip_directory</u></b></font><br />
<font color="#808080">23 </font> <font color="#8b4726">echo</font><font color="#228b22"> Zipping </font><font color="#8b4726">%DOCX%</font><br />
<font color="#808080">24 </font> <font color="#8b4726">pushd</font> <font color="#8b4726">%DOCX%</font><br />
<font color="#808080">25 </font> <font color="#8b4726">ren</font> Content_Types.xml <nowiki>[Content_Types].xml</nowiki><br />
<font color="#808080">26 </font> <font color="#8b4726">%CMDZIP%</font> -9 -r <font color="#228b22">"</font><font color="#8b4726">%TEMP%</font><font color="#228b22">\</font><font color="#8b4726">%TMPFILE%</font><font color="#228b22">"</font> .\*<br />
<font color="#808080">27 </font> <font color="#8b4726"><b>if</b></font><font color="#8b4726"><b> not exist</b></font> <font color="#228b22">"</font><font color="#8b4726">%TEMP%</font><font color="#228b22">\</font><font color="#8b4726">%TMPFILE%</font><font color="#228b22">"</font> (<br />
<font color="#808080">28 </font><font color="#3a5fcd"><i> :: cancel</i></font><br />
<font color="#808080">29 </font> <font color="#8b4726">ren</font> <nowiki>[Content_Types]</nowiki>.xml Content_Types.xml<br />
<font color="#808080">30 </font> <font color="#8b4726">popd</font><br />
<font color="#808080">31 </font> <font color="#8b4726"><b>goto</b></font><font color="#8b4726"><b><u> :end</u></b></font><br />
<font color="#808080">32 </font> )<br />
<font color="#808080">33 </font> <font color="#8b4726">popd</font><br />
<font color="#808080">34 </font> <font color="#8b4726">rmdir</font> <font color="#228b22">"</font><font color="#8b4726">%DOCX%</font><font color="#228b22">"</font> <font color="#27408b">/s</font> <font color="#27408b">/q</font><br />
<font color="#808080">35 </font> <font color="#8b4726">move</font> <font color="#228b22">"</font><font color="#8b4726">%TEMP%</font><font color="#228b22">\</font><font color="#8b4726">%TMPFILE%</font><font color="#228b22">"</font> .<br />
<font color="#808080">36 </font> <font color="#8b4726">ren</font> <font color="#228b22">"</font><font color="#8b4726">%TMPFILE%</font><font color="#228b22">"</font> <font color="#228b22">"</font><font color="#8b4726">%DOCX%</font><font color="#228b22">"</font><br />
<font color="#808080">37 </font> <font color="#8b4726"><b>goto</b></font><font color="#8b4726"><b><u> :end</u></b></font><br />
<font color="#808080">38 </font><br />
<font color="#808080">39 </font><font color="#8b4726"><b><u>:unzip_file</u></b></font><br />
<font color="#808080">40 </font> <font color="#8b4726">ren</font> <font color="#228b22">"</font><font color="#8b4726">%DOCX%</font><font color="#228b22">"</font> <font color="#228b22">"</font><font color="#8b4726">%TMPFILE%</font><font color="#228b22">"</font><br />
<font color="#808080">41 </font> <font color="#8b4726">move</font> <font color="#228b22">"</font><font color="#8b4726">%TMPFILE%</font><font color="#228b22">"</font> <font color="#228b22">"</font><font color="#8b4726">%TEMP%</font><font color="#228b22">"</font>\<br />
<font color="#808080">42 </font> <font color="#8b4726">mkdir</font> <font color="#228b22">"</font><font color="#8b4726">%DOCX%</font><font color="#228b22">"</font><br />
<font color="#808080">43 </font> <font color="#8b4726">pushd</font> <font color="#228b22">"</font><font color="#8b4726">%DOCX%</font><font color="#228b22">"</font><br />
<font color="#808080">44 </font> <font color="#8b4726">%CMDUNZIP%</font> <font color="#228b22">"</font><font color="#8b4726">%TEMP%</font><font color="#228b22">\</font><font color="#8b4726">%TMPFILE%</font><font color="#228b22">"</font><br />
<font color="#808080">45 </font> <font color="#8b4726"><b>if</b></font><font color="#8b4726"><b> not exist</b></font> <nowiki>[Content_Types].xml</nowiki> (<br />
<font color="#808080">46 </font><font color="#3a5fcd"><i> :: cancel</i></font><br />
<font color="#808080">47 </font> <font color="#8b4726">popd</font><br />
<font color="#808080">48 </font> <font color="#8b4726">rmdir</font> <font color="#228b22">"</font><font color="#8b4726">%DOCX%</font><font color="#228b22">"</font> <font color="#27408b">/s</font> <font color="#27408b">/q</font><br />
<font color="#808080">49 </font> <font color="#8b4726">move</font> <font color="#228b22">"</font><font color="#8b4726">%TEMP%</font><font color="#228b22">\</font><font color="#8b4726">%TMPFILE%</font><font color="#228b22">"</font> .<br />
<font color="#808080">50 </font> <font color="#8b4726">ren</font> <font color="#228b22">"</font><font color="#8b4726">%TMPFILE%</font><font color="#228b22">"</font> <font color="#228b22">"</font><font color="#8b4726">%DOCX%</font><font color="#228b22">"</font><br />
<font color="#808080">51 </font> <font color="#8b4726"><b>goto</b></font><font color="#8b4726"><b><u> :end</u></b></font><br />
<font color="#808080">52 </font> )<br />
<font color="#808080">53 </font> <font color="#8b4726">ren</font> <nowiki>[Content_Types].xml</nowiki> Content_Types.xml<br />
<font color="#808080">54 </font> <font color="#8b4726">del</font> <font color="#228b22">"</font><font color="#8b4726">%TEMP%</font><font color="#228b22">\</font><font color="#8b4726">%TMPFILE%</font><font color="#228b22">"</font><br />
<font color="#808080">55 </font> <font color="#8b4726">popd</font><br />
<font color="#808080">56 </font> <font color="#8b4726"><b>goto</b></font><font color="#8b4726"><b><u> :end</u></b></font><br />
<font color="#808080">57 </font><br />
<font color="#808080">58 </font><font color="#8b4726"><b><u>:end</u></b></font><br />
<font color="#808080">59 </font><br />
<font color="#808080">60 </font><font color="#3a5fcd"><i>:: vim: fenc=cp437</i></font>
</pre>
</div>
|