https://wiki.contextgarden.net/api.php?action=feedcontributions&user=212.45.52.69&feedformat=atomWiki - User contributions [en]2024-03-29T14:15:22ZUser contributionsMediaWiki 1.34.1https://wiki.contextgarden.net/index.php?title=Version_Control&diff=9221Version Control2009-01-27T10:34:56Z<p>212.45.52.69: Using version control in ConTeXt</p>
<hr />
<div>== Version control ==<br />
<br />
Version or revision control software like Bazaar, Git and Subversion, is used for managing different versions or revisions of files [http://en.wikipedia.org/wiki/Revision_control].<br />
This can be used for different reasons.<br />
For instance for collaborate editing of files and keeping track of who edits what.<br />
Programmers use this kind of software, but it is also useful as a backup mechanism for TeX files.<br />
<br />
Stephan Hennig created a version control bundle for TeX and friends<br />
[http://www.ctan.org/tex-archive/help/Catalogue/entries/vc.html].<br />
This bundle, meant not only for LaTeX but for TeX and friends, is useful for getting among other things revision number of your project <br />
to use it in your TeX-document.<br />
Of course you should have Bazaar, Git or Subversion installed and (some of) the files in your directory should be under version control.<br />
GNU awk is also required.<br />
<br />
The bundle basically consists of some scripts which produce a vc.tex file with some macros which can be used in a ConTeXt file:<br />
<br />
<texcode><br />
input vc<br />
</texcode><br />
<br />
The manual of the bundle is very clear.<br />
For your convenience here an example of how to use the macros with Git [http://git-scm.com/].<br />
Derived from Mark Eli Kalderon [http://markelikalderon.com/blog/2008/03/23/running-vc/] and the vc manual.<br />
<br />
<texcode><br />
\enableregime[utf]<br />
<br />
%\immediate\write18{sh ./vc} <br />
\input vc<br />
<br />
\starttext <br />
<br />
\startitemize<br />
\item VCRevision = \VCRevision\ current (maximum) working copy revision number<br />
\item VCRevisionMod = \VCRevisionMod\ as VCRevision = \VCRevision, but with an additional note if the working copy contains modified files<br />
\item VCAuthor = \VCAuthor\ author of the last check-in operation<br />
\item VCDateRaw = \VCDateRAW\ date of last check-in in native format of the VCS software<br />
\item VCDateISO = \VCDateISO\ date of last check-in in ISO format YYYY-MM-DD<br />
\item VCDateTEX = \VCDateTEX\ date of last check-in in TeX format YYYY/MM/DD<br />
\item VCTime = \VCTime\ time of last check-in<br />
\item VCModifiedText = \VCModifiedText\ contains the note shown in macro VCRevisionMod = \VCRevisionMod\ if there were modified files.<br />
This macro can be redefined by the user.<br />
\item VCModified = \VCModified\ 0 if there are no modified files in the working copy directory; 1 or 2 if there are modified files.<br />
In general you don't need this macro.<br />
\stopitemize<br />
<br />
These macros can be called wherever appropriate. <br />
<br />
Revision: \VCRevision ; Author: \VCAuthor ; Date: \VCDateISO<br />
<br />
\startitemize<br />
\item GITHash = \GITHash\ 40-hexdigit SHA1 commit hash<br />
\item GITAbrHash = \GITAbrHash\ abbreviated commit hash <br />
\item GITParentHashes = \GITParentHashes\ parent hashes<br />
\item GITAbrParentHashes = \GITAbrParentHashes\ abbreviated parent hashes<br />
\item GITAuthorName = \GITAuthorName\ author name<br />
\item GITAuthorEmail = \GITAuthorEmail\ author email<br />
\item GITAuthorDate = \GITAuthorDate\ author date<br />
\item GITCommitterName = \GITCommitterName\ committer name<br />
\item GITCommitterEmail = \GITCommitterEmail\ committer e-mail<br />
\item GITCommitterDate = \GITCommitterDate\ committer date<br />
\stopitemize<br />
<br />
\stoptext<br />
</texcode></div>212.45.52.69