thread names in urls (Re: Creating a branch other than master using bzr-git)
Martin Pool
mbp at canonical.com
Wed Dec 24 04:35:43 GMT 2008
On 1 Dec 2008, Robert Collins <robertc at robertcollins.net> wrote:
> Going back to basics, we have two broad cases for talking about branches
> in user input.
>
> 'resolve something to a branch[or tree]'
> 'resolve something to a branch[or tree] and a relative path'
>
> For the former, we could just treat everything in a url after the .bzr
> directory is found as a branch qualifier. In fact, we could do that in
> the second case as well.
>
> http://example.com/somebzr/branchname/somepath
>
> would resolve in code as:
> probe .../somepath/.bzr
> probe .../branchname/.bzr
> probe .../somebzr/.bzr
> try for a embedded branch of branchname/somepath, which would return
> (EmbeddedBranch(branchname), somepath)
>
> This clearly is a problem when somepath is both an embedded branch name
> *and* a path.
>
> Now, for the branch-only case, there is no ambiguity, because we are not
> looking for paths in the input. Using '/;branch=foo/' avoids the
> ambiguity always by being explicit.
>
> Some options we could do:
> - infer, but allow url parameters to be used when there is a name
> collision
> 'bzr cat doc'
> => 'cannot cat '' in branch $(pwd)/doc' or alternative it cats doc.
> 'bzr cat ;branch='.'/doc'
>
> 'bzr switch doc'
> => 'switched to branch doc'
>
> - infer with preference to the desired object time in the case
> of collisions -
> 'bzr switch doc' - works
> 'bzr cat doc' - works (current branch)
> 'bzr cat doc/doc' - works (grabs from doc branch)
>
> I'd like something easy to use, but I'd also like there to be a standard
> way to be completely explicit. So that in the event of bugs or confusion
> we can control it from the command line, and also so that things that
> output branches can do so reliably.
I'd like that too.
I think the second of those is reasonable, as long as the inference
rules are easily understandable, e.g. "obviously switch doesn't take a
filename, so it interprets it as a thread or branch." So in general the
rule would be "if the command wants a path, and the name exists as a
path in the relevant tree, treat it as such." This'll take a bit of
care when it can refer to e.g. a deleted-in-wt filename, but we already
have that kind of logic.
The explicit form is where we started. I think /;branch=foo/ is pretty
reasonable to be explicit in urls. On the command line I think we could
normally be explicit by giving the thread or branch to a -r or -d
parameter, which avoids needing to type ;.
Incidentally the + in urls I mentioned before is the standard escaping
of space characters in get query parameters, but as far as I can tell
only there.
--
Martin <http://launchpad.net/~mbp>
More information about the bazaar
mailing list