[RFC] Trying to get something better that revno:N:branch to deal with remote revs

John Arbash Meinel john at arbash-meinel.com
Mon Aug 14 16:37:28 BST 2006


Matthieu Moy wrote:
> John Arbash Meinel <john at arbash-meinel.com> writes:
> 
>> Actually, a URL cannot contain ';' as it is part of the URL spec that
>> ';' indicates parameters are following. Which is how we are using it.
>> And it is easy enough to do '\;' to escape on the command line.
> 
> Well, I don't know what the standard says, but
> 
>   http://www-verimag.imag.fr/~moy/tmp/foo;bar.txt
> 
> works. Also, the location can be a plain path like ./path/to/file. And
> some people like to put ; in their filenames unfortunately. I agree
> that it's not common, but I don't like ambiguities anyway.

Well, there are two things at work here, Firefox and HTTP. This does work:
http://bzr.arbash-meinel.com/foo;bar
But if you go to here:
http://bzr.arbash-meinel.com/
And click on the link, you get:
http://bzr.arbash-meinel.com/foo%3bbar

So I think Firefox is just being nice, and presenting you with whatever
you typed in. It does the same thing for Unicode characters.

You get this if you follow the link:
http://bzr.arbash-meinel.com/%d8%ac%d9%88%d8%ac%d9%88.txt

But Firefox will accept:
http://bzr.arbash-meinel.com/جوجو.txt

(It does happen to translate the unicode characters in the location bar,
though, probably because of the old Phishing scams that used unicode
characters to pretend to be a site that they aren't)

It isn't ambiguous. If there is a ';' then it needs to be escaped. If
people use it, they just have to use URL escaping to get to that
filename. I think ';' is a lot less common than ','.

> 
>>> Well, the conclusion is that it's hard to get something easy to type
>>> (no shell metacharacters) and unambiguous. Indeed, with branch:, there
>>> are already ambiguities: I can have a branch whose name is
>>> "foo..revid:bar", it's a valid directory name!
>> Yes, that was our conclusion as well. However, I think the current
>> parser actually handles 'bzr foo -r branch:foo..revid:bar',
> 
> It handles it as branch:foo and revid:bar, but if you like to name
> your branch foo..revid:bar, and if you wanted only one revision, you
> have no way to say it. Not that this is a realistic situation, but for
> me, a parser should be unambiguous and not based on heuristics.
> 
>> I know it handles 'bzr foo -r branch:../../foobar' but that might
>> only be because of the slashes.
> 
> Yes, it also does it correctly. I don't know if it's by luck or by
> design ;-).

It is by parser design. Because my original implementation did not
handle it. :) Robert fixed it up.

> 
>> Especially with switching over to optparse, you will need to be careful
>> if you want to create an argument that takes 2 parameters.
> 
> Yes, that was clearly my concern.
> 
> But let's see it in another way: first, do people want it in the
> user-interface, and then, let's see if it's reasonably feasible in the
> code.

I would prefer the URL;spec form (as I said). I'll let other people
weigh in their feelings.

> 
>> If you really wanted, you could just use ' ' as the separator. So
>> you would have:
>>
>> bzr diff -??? "3 http://remote/branch"
>>
>> space can occur in paths, though :)
> 
> Yes, we're just comming back to the previous question : what's a good
> delimiter ... Well, today, I think revsion spec can not contain
> spaces, so we could use " " as a delimiter and search from the left.
> Indeed, this is exactly my "revno:N:path", with a space instead of the
> second ":".
> 
>> My personal favorite is still '<url>;<spec>'. It was discussed to use
>> ',' but I use commas in my paths, and don't want to escape them to %2c
>> all the time. I don't use ';' because it is a shell metacharacter.
> 
> You're saying that because you never use the {aaa,bbb} syntax of your
> shell I suppose ;-).
> 

Well, bash doesn't support that as well as zsh. :) But I also came from
some history of using ',' to mark things as temporary that can be
removed at a whim. And if you don't use {} then ',' rarely gets you into
trouble.

Even so, I think ',' is a lot more common in a filename or path than
';'. Just because of the general meaning of ',' versus ';'. Yes, they
both can happen, but I think the frequency is different. (A lot more
shells use ';' than use ',')

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/20060814/2abfb405/attachment.pgp 


More information about the bazaar mailing list