I put a subversion keyword string inside my LaTeX document. It looks like:
$LastChangedDate: 2011-01-16 18:09:33 +0100 (nie) $
and it gets replaced (simple textual substitution) every time I make a commit to the repository. Also when I get an older version of the document, the date is also reverted to the time when that version was commited.
I wanted to make it look nicer in the output, so decided to make following definition:
\def\LastChangedDate: #1-#2-#3 #4:#5:#6 #7 (#8) {\year=#1\month=#2\day=#3\date{\today{} #4:#5}}
\newenvironment{subversionparse}{\catcode`$=0}{\catcode`$=3}
\begin{subversionparse}
$LastChangedDate: 2011-01-16 18:09:33 +0100 (nie) $
\end{subversionparse}
Firstly it defines LastChangedDate macro which parses the following text and sets the date as TeX "today" date, and then defines \date as "today" followed by time. This makes the output nicely localized, in my case: "16 stycznia 2011 18:09".
Then a new environment is made to temporarily change $ character to escape character, so that $LastChangedDate gets parsed as real macro.
Now, I am happy that I managed to get this working. What potential problems do you see with this approach? Maybe there are other, simpler ways of doing the same thing?