[MERGE] Add an optional location parameter to the 'revision-history' command.

John Arbash Meinel john at arbash-meinel.com
Wed May 31 00:03:25 BST 2006


Michael Ellerman wrote:
> On 5/31/06, John Arbash Meinel <john at arbash-meinel.com> wrote:
>> Michael Ellerman wrote:
>> > I was going to do the same for 'ancestry', but there's a TODO in there
>> > about using tree.last_revision() instead of branch.last_revision()
>> which
>> > got me confused. How would the working tree ancestry differ from the
>> > branches?
>>
>> If you have a checkout (specifically lightweight checkout), it is
>> possible for the working tree to be out of date with respect to the
>> branch. (It is also possible if you push changes over sftp, since we
>> don't update the working tree).
>>
>> If you want, you could probably leave this as a TODO, though I would
>> probably say "use the working tree if you can, else fall back to the
>> plain branch."
> 
> Gotcha. I wonder if revision-history should do the same thing? Is
> there a clean way to do the fall back, other than trying to open the
> working tree and catching the exception?
> 
> cheers

Well, you can use 'BzrDir.open_containing()'. My personal preference is
to use:

try:
  wt = WorkingTree.open_containing(path)[0]
except NoWorkingTree:
  branch = Branch.open(path)
else:
  branch = wt.branch

I do that, because you don't really want an open_containing when you are
just specifying a path to a branch. But I frequently run stuff in a
sub-directory. And don't want to have to give the path to the root.

At least, that has been my philosophy.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060530/40f6c28b/attachment.pgp 


More information about the bazaar mailing list