diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2011-02-28 12:32:02 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2011-02-28 12:32:02 +0100 |
commit | 60c6049e12e9b86b6b1bc4ba65e101c80f2d237b (patch) | |
tree | 5234a26bf6ef97bfce27daa4a8747edb34194c26 /setup.py | |
parent | a8200b24700b372eab579ca9144ea2ff6fa4b814 (diff) | |
download | testtools-60c6049e12e9b86b6b1bc4ba65e101c80f2d237b.tar.gz |
Support building a snapshot from something that is not a bzr working tree.
Diffstat (limited to 'setup.py')
-rwxr-xr-x | setup.py | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -7,10 +7,16 @@ import os import testtools + def get_revno(): + import bzrlib.errors import bzrlib.workingtree - t = bzrlib.workingtree.WorkingTree.open_containing(__file__)[0] - return t.branch.revno() + try: + t = bzrlib.workingtree.WorkingTree.open_containing(__file__)[0] + except bzrlib.errors.NotBranchError: + return None + else: + return t.branch.revno() def get_version_from_pkg_info(): @@ -38,6 +44,8 @@ def get_version(): if pkg_info_version: return pkg_info_version revno = get_revno() + if revno is None: + return "snapshot" if phase == 'alpha': # No idea what the next version will be return 'next-r%s' % revno |