[MERGE] Improving check in myriad ways

Aaron Bentley aaron at aaronbentley.com
Tue Feb 5 16:01:49 GMT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Arbash Meinel wrote:
> Daniel Mark Watkins wrote:
> Also, I think your ordering is a bit off. For example, I would do:
> 
> try:
>   tree = WorkingTree.open_containing(path)[0]
...
>       repo = Repository.open()

It also seems strange that some operations are open_containing, and
others are just open.

It would be a bit more efficient to do;

control = BzrDir.open_containing(path)
try:
    tree = control.open_workingtree()
    branch = tree.branch
    repo = branch.repository
except (NoWorkingTree, NotLocalUrl):
    tree = None

Note that Branch.open(path).repository has different results from
Repository.open(path), because a branch may be a branch reference, so
its repository may be elsewhere.

> Either way, we now have Repository.find_branches() which you can use
> rather than implementing it yourself.

And I expect you want to specify using=True for Repository.find_branches.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHqIht0F+nu1YWqI0RAioyAJ9Q7QH2RTBPTcCp7HkdIfbL5D2xQQCfdwd8
BSElCKxN83ZJAeZarShRTbA=
=e06W
-----END PGP SIGNATURE-----



More information about the bazaar mailing list