Small changes in jam-pending

Robert Collins robertc at robertcollins.net
Tue Jan 3 00:03:55 GMT 2006


On Fri, 2005-12-30 at 15:10 -0600, John A Meinel wrote:
> I have a couple of small changes in my jam-pending branch:
>  1491 John Arbash Meinel        2005-12-28
>       bzr --version prints branch nickname.
> 
>  1492 John Arbash Meinel        2005-12-28
>       test_revision_info.py is actually a blackbox test.
> 
>  1493 John Arbash Meinel        2005-12-30
>       Sorted the blackbox tests into alphabetical order.
> 
>  1494 John Arbash Meinel        2005-12-30
>       Forgot a comma
> 
>  1495 John Arbash Meinel        2005-12-30
>       Updated -r revid:foo so that it can match revisions which aren't
> in the revision history
> 
> 
> I already posted about 'bzr --version', though I haven't heard any
> comments yet.

=== modified file 'bzrlib/__init__.py'
--- bzrlib/__init__.py  
+++ bzrlib/__init__.py  
@@ -103,7 +103,7 @@
         branch = Branch.open(os.path.dirname(__path__[0]))
         rh = branch.revision_history()
         if rh:
-            return len(rh), rh[-1]
+            return len(rh), rh[-1], branch
         else:
             return None
     except bzrlib.errors.BzrError:

This changes the api without changing the docstring. Also, to get into
the habit of api versioning, this should probably be something like:

+# deprecated in 0.7
+def get_bzr_revision():
+    """If bzr is run from a branch, return (revno,revid) or None"""
+    return get_bzr_revision_and_branch()[0:1]
 
 def get_bzr_revision_and_branch():
-    """If bzr is run from a branch, return (revno,revid) or None"""
+    """If bzr is run from a branch, return (revno, revid, branch.
+
+    If it is not run from a branch, return None.
+    """
     import bzrlib.errors
     from bzrlib.branch import Branch
...


With the tests updated to use the new api.

Incidentally, I'm not sure why that is in __init__ - its only used by
builtins.py ? (Perhaps we should have a module for 'info about bzrlib' -
like version.py  or somesuch). If this isn't meant to be public, perhaps
move it to builtins.py as a helper for version, and make it private.	


Other than that your pending branch looks fine. +1 with that addressed
one way or the other.

(these are the revisions merged when I checked):
John Arbash Meinel 2005-12-30 Whitespace cleanup.
    John Arbash Meinel 2005-12-30 Updated
test_set_user_setting_sets_and_sav...
    John Arbash Meinel 2005-12-30 Updated -r revid:foo so that it can
match ...
    John Arbash Meinel 2005-12-30 Forgot a comma
    John Arbash Meinel 2005-12-30 Sorted the blackbox tests into
alphabetica...
    John Arbash Meinel 2005-12-28 test_revision_info.py is actually a
blackb...
    John Arbash Meinel 2005-12-28 bzr --version prints branch nickname.


Rob
-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060103/6189c903/attachment.pgp 


More information about the bazaar mailing list