a sneak peek of bzrdir cleanup effects:
Robert Collins
robertc at robertcollins.net
Sun Feb 5 22:50:15 GMT 2006
The key thing is that we now always get a bzrdir and then just try for
the wt/branch rather than sometimes getting a branch and sometimes a
tree.
Rob
builtins.py | 36 +++++++++++++++++-------------------
1 file changed, 17 insertions(+), 19 deletions(-)
--- bzrlib/builtins.py
+++ bzrlib/builtins.py
@@ -912,28 +912,26 @@
"invalid message argument %r" % message
direction = (forward and 'forward') or 'reverse'
+ # log everything
+ file_id = None
if filename:
- # might be a tree:
- tree = None
- try:
- tree, fp = WorkingTree.open_containing(filename)
- b = tree.branch
- if fp != '':
- inv = tree.read_working_inventory()
- except NotBranchError:
- pass
- if tree is None:
- b, fp = Branch.open_containing(filename)
- if fp != '':
- inv = b.repository.get_inventory(b.last_revision())
+ # find the file id to log:
+
+ dir, fp = BzrDir.open_containing(filename)
+ b = dir.open_branch()
if fp != '':
+ try:
+ # might be a tree:
+ inv = dir.open_workingtree().inventory
+ except (errors.NotBranchError, errors.NotLocalUrl):
+ # either no tree, or is remote.
+ inv = b.basis_tree().inventory
file_id = inv.path2id(fp)
- else:
- file_id = None # points to branch root
- else:
- tree, relpath = WorkingTree.open_containing(u'.')
- b = tree.branch
- file_id = None
+ else:
+ # local dir only
+ # FIXME ? log the current subdir only RBC 20060203
+ dir, relpath = BzrDir.open_containing('.')
+ b = dir.open_branch()
if revision is None:
rev1 = None
--
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/20060206/c50a09c7/attachment.pgp
More information about the bazaar
mailing list