On Monday, January 28, 2002, at 01:17 PM, Karl Fogel wrote:
> Philip Martin <philip@codematters.co.uk> writes:
>> What about dates? I don't use dates on the command line very often,
>> but I do use them occasionally. I can't imagine using a date for a
>> merge command, but I can imagine wanting to use it for a diff
>> command. Will
>>
>> $ svn diff -RDATE1:path1 -RDATE2:path2
>>
>> be expected to work?
>
> You know, that's a good point... I think there's a nice simplification
> we can make here, though.
>
> Q: Do we even need separate -r/-R versus -D options, considering that
> a date always translates to a revision, as far as Subversion is
> concerned?
>
> A: I don't think so. We can just use -r or -R for revisions and
> dates, and use the syntax of the argument to tell us which it is.
>
> This would imply:
>
> 1. Dates must contain some non-numeric character. A date of
> 20020128 is both a valid date and a valid revision number, so
> we'll interpret it as a revision, and insist on 2002-01-28 or
> something similar for dates. Good error reporting should make
> this easy for users to figure out.
>
> 2. Both -r and -R shouldn't use colons to separate range delimiters
> anymore, because dates can contain colons. Instead, we just
> pass the flag twice. I believe apr_getopt() preserves the order
> of options, and allows duplicate options, precisely for
> situations like this.
I think this is a step backwards. The current notation (-r N:M) is much
better than the CVS way (-r N -r M). It makes it clear that the two
revisions are bound together semantically. You're asking for the changes
made in a range of revisions from N to M, and this is reflected in the
syntax: you can only pass 1 -r option, which can have only two
revisions. Using multiple options suggests that I could do a command
like this:
svn diff -r 13 -r 17 -r 23 foo.c
This would get me the changes between rev 12 and 13, 16 and 17, 22 and
23 all combined into a single diff. This isn't the case though.
> So these three commands would all have the same effect:
>
> $ svn diff -r 13 -r 14 foo.c bar.c baz.c
> $ svn diff -r 13 foo.c -r 14 bar.c baz.c
> $ svn diff -r 13 foo.c bar.c -r 14 baz.c
> $ svn diff foo.c bar.c baz.c -r 13 -r 14 baz.c
>
> ...show the difference between revisions 13 and 14. Of course, a sane
> user will only invoke it the first way!
>
> Whereas these commands would have another (also consistent) effect:
>
> $ svn diff -R 13 foo.c -R 14 bar.c
> $ svn diff -R 13 -R 14 foo.c bar.c
> $ svn diff foo.c bar.c -R 13 -R 14
>
> that of showing the difference between foo.c-at-rev-13 and
> bar.c-at-rev-14. Of course, again, sane users will choose the first
> invocation syntax.
In the first instance, the ordering relationships between targets and
options don't matter. In the second instance they do. Conversely, the
order of the options matters in the second instance but not the first.
This is a recipe for confusion.
> You can substitute a date for 13 or 14 in these examples, and a URL
> for any of the filenames, and it all still means the same thing.
>
> Abstract summary: -r means apply the given revision/date range to all
> the targets. -R means apply revisions/dates to corresponding
> targets. When only one -r or -R is used, Subversion chooses some
> "reasonable" default for the missing value, possibly based on working
> copy context.
>
> Hmmm. It's not all that intuitive -- I think a lot of users will
> still be confused. But I'm guessing that's because the semantic
> choices here are inherently complex, not because we're choosing an
> overly complex way to express a simple idea. Even if we went with the
> separate command idea, the problems would be the same. Is there a
> better way to express this stuff in invocation syntax?
The choices are complex, but I think the syntax can be simplified a bit.
How about this:
Let's indicate revisions more or less as we do currently, with -r or -R.
We'll use -d and -D for dates. (It might be better to use -t and -T for
"time" to avoid overloading -d, but that's another discussion)
So we could have commands like this:
# diff the targets in the working copy against r13
$svn diff -r 13 foo.c bar.c baz.c
# diff targets between r13 and r14
$svn diff -r 13:14 foo.c bar.c baz.c
# diff bar.c at r17 against foo.c at r13
$svn diff -R foo.c:13 -R bar.c:17
# diff bar.c in the working copy against foo.c at r13
$svn diff -R foo.c:13 bar.c
# diff the targets in the working copy against the current rev as of 1pm
on Jan 10.
$svn diff -d '2002-01-10 13:00:00' foo.c bar.c baz.c
# diff bar.c against foo.c as of 1pm on Jan 10.
$svn diff -D foo.c:'2002-01-10 13:00:00' bar.c
I suspect that quotes around date/times are going to be inevitable. I
can't think if any standard date format that doesn't use a space. We
could require something like 2002-01-10-01-00-00, I suppose, but it's
hard to read.
Abstract summary: R specifies revision, D specifies date. Lower case
options apply to all targets, uppercase options are used to specify a
path/revision combination. Paths can be replaced with URLs, of course.
Colin Putney
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:37:00 2006