Jeff Bauer jbauer at
Tue Sep 23 19:35:18 BST 2008

I've just started using bzr to do revision control in my home
directory.  One of the annoyances is constantly having to manually
add files from specific directories that I always want checked in,
e.g. tomboy notes.  So I wrote a quick program to read in
directories from ~/.bzradd and add them to the revision set
if they're listed as unknown status.

Is there a better way to accomplish the same task?  If not, would
this technique be worth expanding into a bzr plugin?

#!/usr/bin/env python
# autoadd - add unknown status files/directories listed in ~/.bzradd
from bzrlib import workingtree
import os
home = os.environ['HOME']
bzradd = os.path.join(home, ".bzradd")
addset = set()
if os.path.exists(bzradd):
    addpath = [n.strip() for n in open(bzradd).readlines()]
    wt =
    for uk in wt.unknowns():
        for ap in addpath:
            if uk.startswith(ap):
                addset.add(os.path.join(home, ap))

Jeff Bauer
Rubicon, Inc.

More information about the bazaar mailing list