-r 1-100 vs -r 1:100 vs ...

Rusty Russell rusty at rustcorp.com.au
Sun May 29 05:21:20 BST 2005


On Sun, 2005-05-29 at 13:34 +1000, Michael Ellerman wrote:
> Another reason is that requiring three top level args for the diff syntax 
> allows you to use space in tags easily. eg.
> 
> bzr diff -r "bzr version 1.0" to "bzr version 1.1"

Subtracting the syntactic sugar from your examples, it boils down to
saying -r takes one or two args.  I think this is actually very
sensible, and we can implement short cuts (such as "to" or - or :) in
addition to that "canonical form".

I think canonical form should be <type>:<string>, eg: "-r
uuid:0000...01", with an implied type of "revno:" for cases where all
characters are numeric, eg. "-r 27" equals "-r revno:27".   This means a
revision in canonical form never starts with a "-", so we can always
tell a one-arg -r from a two-arg -r.

Now, we can make best-effort parsing on non-canonical forms, of course,
but they will not be guaranteed, eg. -r "one to to two" could be tag
"one to" to "two", or "one" to "to two", or a single revision called
"one to to two".  This will be a very unusual case, however.  If we
don't have a known prefix on a revision, we can call each prefix's
parser in turn to see if any of them can swallow it.  If exactly one
does, we're fine.  We can also have multiple separator parsers (I'd
suggest that <num>:<num> be parsed fine for cvs converts).

This is more powerful if the tag parser can figure out if a version is
valid, but it will work OK of that parser is simply consulted last.

Thoughts?
Rusty.
-- 
A bad analogy is like a leaky screwdriver -- Richard Braakman





More information about the bazaar mailing list