Should be able to create colocated branches with "/" in the name to allow for hierarchical branch names

Bug #907980 reported by Neil Martinsen-Burrell
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Jelmer Vernooij

Bug Description

bzr-colo has had the ability to create branch names such as "origin/trunk" or "bugs/123456". This allows one to impose some order on the possibly many named branches. It would be nice if this worked in the core colocated workspace support. Something like

$ bzr init --development-colo file:test,branch=trunk
$ cd test
$ bzr branch file:,branch=origin/trunk

which currently fails with

nmb@garble[~/tmp]$ bzr init --development-colo file:test,branch=trunk
Created a lightweight checkout (format: development-colo)
nmb@garble[~/tmp]$ cd test
nmb@garble[~/tmp/test]$ bzr -Derror branch file:,branch=origin/trunk
bzr: ERROR: bzrlib.errors.NotBranchError: Not a branch: "/Users/nmb/tmp/test/,branch=origin/trunk/".

Traceback (most recent call last):
  File "/Users/nmb/src/bzr/bzr.dev/bzrlib/commands.py", line 919, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/Users/nmb/src/bzr/bzr.dev/bzrlib/commands.py", line 1124, in run_bzr
    ret = run(*run_argv)
  File "/Users/nmb/src/bzr/bzr.dev/bzrlib/commands.py", line 672, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/Users/nmb/src/bzr/bzr.dev/bzrlib/commands.py", line 694, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/Users/nmb/src/bzr/bzr.dev/bzrlib/cleanup.py", line 136, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/Users/nmb/src/bzr/bzr.dev/bzrlib/cleanup.py", line 166, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/Users/nmb/src/bzr/bzr.dev/bzrlib/builtins.py", line 1332, in run
    from_location)
  File "/Users/nmb/src/bzr/bzr.dev/bzrlib/controldir.py", line 764, in open_tree_or_branch
    controldir = klass.open(location)
  File "/Users/nmb/src/bzr/bzr.dev/bzrlib/controldir.py", line 673, in open
    return klass.open_from_transport(t, _unsupported=_unsupported)
  File "/Users/nmb/src/bzr/bzr.dev/bzrlib/controldir.py", line 702, in open_from_transport
    find_format, transport, redirected)
  File "/Users/nmb/src/bzr/bzr.dev/bzrlib/transport/__init__.py", line 1701, in do_catching_redirections
    return action(transport)
  File "/Users/nmb/src/bzr/bzr.dev/bzrlib/controldir.py", line 690, in find_format
    transport, _server_formats=_server_formats)
  File "/Users/nmb/src/bzr/bzr.dev/bzrlib/controldir.py", line 1135, in find_format
    raise errors.NotBranchError(path=transport.base)
NotBranchError: Not a branch: "/Users/nmb/tmp/test/,branch=origin/trunk/".

Tags: colocated

Related branches

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

For ambiguity rasons, this would have to be file:,branch=origin%2Ftrunk rather than file:,branch=origin/trunk.

Other than that it seems like a good idea to me.

Changed in bzr:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 907980] Re: Should be able to create colocated branches with "/" in the name to allow for hierarchical branch names

Jelmer Vernooij пишет:
> For ambiguity rasons, this would have to be file:,branch=origin%2Ftrunk
> rather than file:,branch=origin/trunk.

Why so? That %2F is OK for GUI users, in which case GUI tool will
substitute / to %2F under the hood, but that's bad for CLI users.
Non-intuitive at all.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Am 23/12/11 13:05, schrieb Alexander Belchenko:
> Jelmer Vernooij пишет:
>> For ambiguity rasons, this would have to be file:,branch=origin%2Ftrunk
>> rather than file:,branch=origin/trunk.
> Why so? That %2F is OK for GUI users, in which case GUI tool will
> substitute / to %2F under the hood, but that's bad for CLI users.
> Non-intuitive at all.

Compare with file://foo,branch=foo,a/file/in/the/branch

Cheers,

Jelmer

Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 907980] Re: Should be able to create colocated branches with "/" in the name to allow for hierarchical branch names

Jelmer Vernooij пишет:
> Am 23/12/11 13:05, schrieb Alexander Belchenko:
>> Jelmer Vernooij пишет:
>>> For ambiguity rasons, this would have to be file:,branch=origin%2Ftrunk
>>> rather than file:,branch=origin/trunk.
>> Why so? That %2F is OK for GUI users, in which case GUI tool will
>> substitute / to %2F under the hood, but that's bad for CLI users.
>> Non-intuitive at all.
>
> Compare with file://foo,branch=foo,a/file/in/the/branch

I've compared. You have a comma after foo.
What about:

file://foo,branch=foo/bar,a/file/in/the/branch

What's wrong here?

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Am 23/12/11 13:50, schrieb Alexander Belchenko:
> Jelmer Vernooij пишет:
>> Am 23/12/11 13:05, schrieb Alexander Belchenko:
>>> Jelmer Vernooij пишет:
>>>> For ambiguity rasons, this would have to be file:,branch=origin%2Ftrunk
>>>> rather than file:,branch=origin/trunk.
>>> Why so? That %2F is OK for GUI users, in which case GUI tool will
>>> substitute / to %2F under the hood, but that's bad for CLI users.
>>> Non-intuitive at all.
>> Compare with file://foo,branch=foo,a/file/in/the/branch
> I've compared. You have a comma after foo.
Sorry, that actually should have been
file://foo/bar/blie,branch=abranch/file/in/the/branch

> What about:
>
> file://foo,branch=foo/bar,a/file/in/the/branch
>
> What's wrong here?
That's a different path, it refers to the branch:

"branch" in directory "the" in directory "in" in directory "file" in
directory "bar,a" in the directory "foo" with branch parameters
"branch=foo".

Cheers,

Jelmer

Revision history for this message
Alexander Belchenko (bialix) wrote :

Jelmer Vernooij пишет:
> That's a different path, it refers to the branch:
>
> "branch" in directory "the" in directory "in" in directory "file" in
> directory "bar,a" in the directory "foo" with branch parameters
> "branch=foo".

I'm unable to parse it. Sorry.

Revision history for this message
Neil Martinsen-Burrell (nmb) wrote : Re: [Bug 907980] Re: Should be able to create colocated branches with "/" in the name to allow for hierarchical branch names

On Fri, Dec 23, 2011 at 10:04, Alexander Belchenko <email address hidden> wrote:
> Jelmer Vernooij пишет:
>> That's a different path, it refers to the branch:
>>
>> "branch" in directory "the" in directory "in" in directory "file" in
>> directory "bar,a" in the directory "foo" with branch parameters
>> "branch=foo".
>
> I'm unable to parse it. Sorry.

He means that the branch is named foo and the file path is
/bar,a/file/in/the/branch.

I can see that since we chose to use URL syntax for referring to
branch names, then we may be stuck with URL encoding for our branch
names which contain URL-reserved characters.

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: [Bug 907980] Re: Should be able to create colocated branches with "/" in the name to allow for hierarchical branch names

The url syntax is available but it is by no means the only way to address a collocated branch. You can eg specify branch names directly to some commands already - e.g switch.
--
Sent from my phone. Please excuse my brevity.

Neil Martinsen-Burrell <email address hidden> wrote:

On Fri, Dec 23, 2011 at 10:04, Alexander Belchenko <email address hidden> wrote:
> Jelmer Vernooij пишет:
>> That's a different path, it refers to the branch:
>>
>> "branch" in directory "the" in directory "in" in directory "file" in
>> directory "bar,a" in the directory "foo" with branch parameters
>> "branch=foo".
>
> I'm unable to parse it. Sorry.

He means that the branch is named foo and the file path is
/bar,a/file/in/the/branch.

I can see that since we chose to use URL syntax for referring to
branch names, then we may be stuck with URL encoding for our branch
names which contain URL-reserved characters.

--
You received this bug notification because you are a member of bzr-core,
which is subscribed to Bazaar.
https://bugs.launchpad.net/bugs/907980

Title:
Should be able to create colocated branches with "/" in the name to
allow for hierarchical branch names

To manage notifications about this bug go to:
https://bugs.launchpad.net/bzr/+bug/907980/+subscriptions

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: [Bug 907980] Re: Should be able to create colocated branches with "/" in the name to allow for hierarchical branch names

On 12/23/2011 06:25 PM, Neil Martinsen-Burrell wrote:
> On Fri, Dec 23, 2011 at 10:04, Alexander Belchenko <email address hidden> wrote:
>> Jelmer Vernooij пишет:
>>> That's a different path, it refers to the branch:
>>>
>>> "branch" in directory "the" in directory "in" in directory "file" in
>>> directory "bar,a" in the directory "foo" with branch parameters
>>> "branch=foo".
>>
>> I'm unable to parse it. Sorry.
>
> He means that the branch is named foo and the file path is
> /bar,a/file/in/the/branch.
>
> I can see that since we chose to use URL syntax for referring to
> branch names, then we may be stuck with URL encoding for our branch
> names which contain URL-reserved characters.
URLs aren't the only way you can reference colocated branches. For
example, "bzr switch" accepts 'plain' colocated branch names too. I
imagine more commands will support this sort of thing over time.

Cheers,

Jelmer

Revision history for this message
Gordon Tyler (doxxx) wrote :

In my opinion, while it would be nice and perhaps necessary for the internals to have branches addressable solely using a URL, it is not the most user friendly interface. I personally would much prefer to refer to a branch using a separate command-line option, or even have relative branch references try to resolve against colocated branches before going to look in the filesystem. e.g. `bzr merge my-feature` should look for a colocated branch called 'my-feature' before trying to find a sibling directory by that name.

So I guess what I'm saying is, don't worry too much about making the URL user-friendly because it never will be. Instead, effort should be put into making sure that all commands which can deal with branches have the ability to do so in a user-friendly manner either by relative reference or a command-line option.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Am 24/12/11 16:05, schrieb Gordon Tyler:
> In my opinion, while it would be nice and perhaps necessary for the
> internals to have branches addressable solely using a URL, it is not the
> most user friendly interface. I personally would much prefer to refer to
> a branch using a separate command-line option, or even have relative
> branch references try to resolve against colocated branches before going
> to look in the filesystem. e.g. `bzr merge my-feature` should look for a
> colocated branch called 'my-feature' before trying to find a sibling
> directory by that name.
Right, that's exactly what the plan is. :-)

Cheers,

Jelmer

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Am 24/12/11 16:05, schrieb Gordon Tyler:
> In my opinion, while it would be nice and perhaps necessary for the
> internals to have branches addressable solely using a URL, it is not the
> most user friendly interface. I personally would much prefer to refer to
> a branch using a separate command-line option, or even have relative
> branch references try to resolve against colocated branches before going
> to look in the filesystem. e.g. `bzr merge my-feature` should look for a
> colocated branch called 'my-feature' before trying to find a sibling
> directory by that name.
Right, that's exactly what the plan is. :-)

Cheers,

Jelmer

Jelmer Vernooij (jelmer)
Changed in bzr:
status: Confirmed → In Progress
assignee: nobody → Jelmer Vernooij (jelmer)
Vincent Ladeuil (vila)
Changed in bzr:
milestone: none → 2.5b6
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.