[rfc] bound info for branch in shared repository (was: Re: [MERGE] win32 fixes for TestInfo)

Alexander Belchenko bialix at ukr.net
Thu Jun 15 05:29:01 BST 2006


Aaron Bentley пишет:
> Alexander Belchenko wrote:
>> Today I try to figure out why bzr don't show info about master branch
>> after I bind branch inside shared repo with trees to another branch.
>> It's really not obvious question. Because now bzr assume that if branch
>> bound to another branch then this branch is checkout.
> 
> Any branch that is bound to another branch is a checkout.  "Bound
> branch" and "checkout" are two terms for the same thing.

Well, in this case there is a bug either in terminology or in the 
bzrlib. Because when I create shared repository with branch inside it it 
called 'repository checkout':

E:\work\MyCode\bzr\devel\bzr.dev>bzr info
Location:
     shared repository: file:///E:/work/MyCode/bzr/devel/
   repository checkout: bzr.dev

Related branches:
   parent branch: http://bazaar-vcs.org/bzr/bzr.dev/
...

But if I bound this branch to another one I can't see any difference in 
info output:

E:\work\MyCode\bzr\devel\bzr.dev>bzr bind E:\work\Python\bzr\devel\bzr.dev\

E:\work\MyCode\bzr\devel\bzr.dev>bzr info
Location:
     shared repository: file:///E:/work/MyCode/bzr/devel/
   repository checkout: bzr.dev

Related branches:
   parent branch: http://bazaar-vcs.org/bzr/bzr.dev/
...


So, how I can detect that this branch is actually bound to another 
branch? Because of this code in info.py:

         elif repository.is_shared():
             # branch with tree inside shared repository
             print '    shared repository: %s' % repository_path
             print '  repository checkout: %s' % (
                 _repo_relpath(repository_path, branch_path))
         elif branch.get_bound_location():
             # normal checkout
             print '       checkout root: %s' % working_path
             print '  checkout of branch: %s' % branch.get_bound_location()

So, looking on this code I see that if branch in shared repository it is 
not checkout in bound sense. I propose to extend this code as:

              print '    shared repository: %s' % repository_path
              print '  repository checkout: %s' % (
                  _repo_relpath(repository_path, branch_path))
+            if branch.get_bound_location():
+                print '      bound to branch: %s' % 
branch.get_bound_location()
          elif branch.get_bound_location():
              # normal checkout
              print '       checkout root: %s' % working_path

And in this case bzr info will show bound location for shared repository:

E:\work\MyCode\bzr\devel\bzr.dev>bzr info
Location:
     shared repository: file:///E:/work/MyCode/bzr/devel/
   repository checkout: bzr.dev
       bound to branch: file:///E:/work/Python/bzr/devel/bzr.dev/

Related branches:
   parent branch: http://bazaar-vcs.org/bzr/bzr.dev/
...

If bzr called all branch that bound to another branch as checkout then 
for shared repo and branch in it we should report about checkout twice:

E:\work\MyCode\bzr\devel\bzr.dev>bzr info
Location:
     shared repository: file:///E:/work/MyCode/bzr/devel/
   repository checkout: bzr.dev
    checkout of branch: file:///E:/work/Python/bzr/devel/bzr.dev/

Related branches:
   parent branch: http://bazaar-vcs.org/bzr/bzr.dev/
...

IMO last variant is somewhat ugly. In russian we have a proverb about 
'oily oil' -- this is the same case. Checkout twice it's a 'oily oil'. 
And I think it will be slightly confusing.

--
Alexander





More information about the bazaar mailing list