[PATCH] Add revrange function, for parsing revision ranges [was Re: Specifying rev ranges]
Matt Mackall
mpm at selenic.com
Sat Jul 2 07:20:54 UTC 2005
On Fri, Jul 01, 2005 at 10:30:10PM -0700, Bryan O'Sullivan wrote:
> On Fri, 2005-07-01 at 21:34 -0700, Bryan O'Sullivan wrote:
>
> > I already had a rev range parser in the export patches I posted a few
> > days ago. I'll revive it.
>
> Patch attached. I've deliberately made it flexible, so that if Matt
> wants something other than ":" to separate ranges, it's a one-line edit.
>
> Some examples follow.
>
> 4 -> 4
> 2:5 -> 2,3,4
> 5:2 -> 5,4,3
> :5 -> 0,1,2,3,4
> 3: -> 3,4,5
> tip:-3 -> 5,4,3
> A:B -> A,A+1,...,B-1
[...]
> A rev specifier is either N (for one rev) or A:B (for a range of revs).
> A range represents a half-open interval [A, B).
I don't think half-open intervals are the natural thing for either
export or log. Sure they're great for coding, but not for user
interfaces.
Oh, and cvs also use the : syntax for inclusive ranges.
> @@ -680,6 +716,9 @@
>
> if name == "tip":
> ui.warn("abort: 'tip' is a reserved name!\n")
> + return -1
> + if name.find(revrangesep) >= 0:
> + ui.warn("abort: '%s' cannot be used in a tag name\n" % revrangesep)
> return -1
Tabs hiding in there.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial
mailing list