[ANNOUNCE] vc bundle v0.41 -- version control for TeX and friends

Neil Martinsen-Burrell nmb at wartburg.edu
Thu Apr 17 01:50:42 BST 2008


Stephan Hennig <mailing_list <at> arcor.de> writes:

> The vc bundle
> -----------------------------------
> This is a script based approach to version control for TeX
> documents.  It works more reliably than keyword substitution
> based approaches, since it tracks all files in a working
> copy, not only .tex files.
> 
> The vc bundle works with LaTeX and plain TeX.  Currently,
> Bazaar, Git and Subversion are supported.
> 
> What's special about the vc bundle?
> -----------------------------------
> * Common version control packages for LaTeX use keyword
>   substitution to access revision information.  That
>   approach doesn't work reliably in the presence of
>   non-.tex files, e.g., graphics or graphic sources that
>   are processed by an external tool.
> * The author is unaware of any alternative version control
>   packages for plain TeX.
> * The author is unaware of any alternative LaTeX version
>   control packages that support Bazaar or Git.
> 
> Getting the software
> -----------------------------------
> The latest version of the vc bundle can be found at CTAN:support/vc.
> 
> <URL:http://www.ctan.org/get/support/vc.zip>

A minor nit:  in Appendix C, question 10, you suggest creating .bzrignore with
the contents vc.tex to ignore the generated vc.tex file.  It is marginally
simpler to use the command ``bzr ignore vc.tex`` to add vc.tex automatically to
.bzrignore, create it if necessary and add it to version control if necessary.

I've been doing the same thing using a Bazaar plugin to generate a TeX file that
I then \input into my documents.  As a one-liner, that is:

bzr version-info --custom --template="\\\newcommand{\\BZRDate}{{date}}
\\\newcommand{\\BZRRevId}{{revision_id}}
\\\newcommand{\\BZRRevno}{{revno}}
\\\newcommand{\\BZRNick}{{branch_nick}}" > vc.tex

I don't know if that simplifies the Awk-work, but it's been working for me.  (I
prefer it as a plugin so I can do ``bzr version-info --latex > bzr.tex``)
The plugin is given below (save as __init__.py in
~/.bazaar/plugins/latex_version_info).

-Neil

-- 
__version__ = '0.0.2'
version_info = tuple(int(n) for n in __version__.split('.'))

from bzrlib import trace
from bzrlib.version_info_formats import (
    format_registry, 
    VersionInfoBuilder,
    create_date_str
)

format_registry.register_lazy('latex',
                              'bzrlib.plugins.latex_version_info',
                              'LatexBuilder')

class LatexBuilder(VersionInfoBuilder):

    def _get_revno(self):
        revision_id = self._get_revision_id()
        if revision_id is not None:
            revno = str(self._branch.revision_id_to_revno(revision_id))
        else:
            revno = '0'
        return revno

    def _get_branch_nick(self):
        if self._branch.nick is not None:
            return self._branch.nick
        else:
            return ''

    def generate(self, to_file):
        template = """ \\newcommand{\\BZRDate}{%(date)s}
\\newcommand{\\BZRRevId}{%(revision_id)s}
\\newcommand{\\BZRRevno}{%(revno)s}
\\newcommand{\\BZRNick}{%(branch_nick)s}
"""
        data = {'date':create_date_str(),
                'revision_id':self._get_revision_id(),
                'revno':self._get_revno(),
                'branch_nick':self._get_branch_nick(),
                }

        to_file.write(template % data)





More information about the bazaar mailing list