Merge lp:~jelmer/testtools/setup.py-nobzr into lp:~testtools-committers/testtools/trunk

Proposed by Jelmer Vernooij
Status: Merged
Merged at revision: 177
Proposed branch: lp:~jelmer/testtools/setup.py-nobzr
Merge into: lp:~testtools-committers/testtools/trunk
Diff against target: 31 lines (+10/-2)
1 file modified
setup.py (+10/-2)
To merge this branch: bzr merge lp:~jelmer/testtools/setup.py-nobzr
Reviewer Review Type Date Requested Status
Jonathan Lange Approve
Review via email: mp+51518@code.launchpad.net

Description of the change

Support installing a snapshot from a directory that is not a Bazaar working tree.

This is required for the daily builds.

To post a comment you must log in.
lp:~jelmer/testtools/setup.py-nobzr updated
177. By Jelmer Vernooij

Catch NoWorkingTree rather than NotBranchError.

178. By Jelmer Vernooij

Catch both NotBranchError /and/ NoworkingTree as different versions of bzr seem to raise a different error.

Revision history for this message
Jonathan Lange (jml) wrote :

Looks good. Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'setup.py'
2--- setup.py 2011-02-13 16:20:45 +0000
3+++ setup.py 2011-02-28 12:16:32 +0000
4@@ -7,10 +7,16 @@
5
6 import testtools
7
8+
9 def get_revno():
10+ import bzrlib.errors
11 import bzrlib.workingtree
12- t = bzrlib.workingtree.WorkingTree.open_containing(__file__)[0]
13- return t.branch.revno()
14+ try:
15+ t = bzrlib.workingtree.WorkingTree.open_containing(__file__)[0]
16+ except (bzrlib.errors.NotBranchError, bzrlib.errors.NoWorkingTree):
17+ return None
18+ else:
19+ return t.branch.revno()
20
21
22 def get_version_from_pkg_info():
23@@ -38,6 +44,8 @@
24 if pkg_info_version:
25 return pkg_info_version
26 revno = get_revno()
27+ if revno is None:
28+ return "snapshot"
29 if phase == 'alpha':
30 # No idea what the next version will be
31 return 'next-r%s' % revno

Subscribers

People subscribed via source and target branches