[PATCH] bzr --version prints branch nickname
John A Meinel
john at arbash-meinel.com
Wed Nov 30 23:07:10 GMT 2005
Since I tend to have a bunch of bzr branches lying around, it is nice to
know which one I'm running. I can use which, and then ls -l to figure
out where my symlinks point, but I thought it might be nice if "bzr
--version" prints the branch-nick, since we have them.
This is a patch which implements it. I haven't settled on it, so I
haven't put it in my integration branch.
John
=:->
=== modified file 'bzrlib/__init__.py'
--- bzrlib/__init__.py
+++ bzrlib/__init__.py
@@ -105,7 +105,7 @@
branch = Branch.open(os.path.dirname(__path__[0]))
rh = branch.revision_history()
if rh:
- return len(rh), rh[-1]
+ return len(rh), branch.get_revision(rh[-1])
else:
return None
except bzrlib.errors.BzrError:
=== modified file 'bzrlib/builtins.py'
--- bzrlib/builtins.py
+++ bzrlib/builtins.py
@@ -1418,7 +1418,17 @@
# is bzrlib itself in a branch?
bzrrev = bzrlib.get_bzr_revision()
if bzrrev:
- print " (bzr checkout, revision %d {%s})" % bzrrev
+ revno = bzrrev[0]
+ rev = bzrrev[1]
+ nick = None
+ if rev.properties.has_key('branch-nick'):
+ nick = rev.properties['branch-nick']
+ if nick:
+ print " (bzr checkout, revision %d, nick: %s {%s})" % (revno,
+ nick, rev.revision_id)
+ else:
+ print " (bzr checkout, revision %d {%s})" % (revno,
+ rev.revision_id)
print bzrlib.__copyright__
print "http://bazaar-ng.org/"
print
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051130/d9d80d8f/attachment.pgp
More information about the bazaar
mailing list