Search code examples
svnlatexpost-commit

SVN post commit hook: record number of pages in LaTeX document?


I would like to record how the number of pages of my LaTeX document grows over time.

I store the foo.tex file in my SVN repository, so I'm thinking I can use a post-commit script for that, which runs LaTeX automatically (whenever changes to foo.tex are committed), extracts the number of pages and writes it into the log file.

Is that the right approach? Any tips / suggestions on how to best implement it? For example, how do I set it up so that the script is only called when changes to foo.tex are committed?


Solution

  • For windows

    @echo off
    SET SVNLOOK=C:\Program Files\CollabNet Subversion Server\svnlook.exe
    SET GREP=D:\SVN\Repo\hooks\grep.exe
    
    ("%svnlook%" changed -t %2 %1 | "%grep%" "^U.*/foo.tex") && (shell out to make the modification)
    

    I'm not sure what command you would use to actually set the revprop... I'm still researching...

    I think that during the transaction, the message is read-only. You may have to delay-execute

    svn propset --revprop -r ## svn:log "MESSAGE"
    

    if the prop needs updating.