Nathan Hartman wrote on Mon, 07 Dec 2020 20:50 +00:00:
> On Mon, Dec 7, 2020 at 1:47 PM Yasuhito FUTATSUKI 
> <futat...@yf.bsdclub.org> wrote:
> > 
> > As the error message says, '-c' option accepts only numeric revision.
> > It seems it is a kind of bug that the help text is not kind enough.  
> 
> A possible rationale is that the HEAD revision could change without 
> your knowledge (e.g., another user commits something in the meantime) 
> and you wouldn't get the revision you were expecting.

If this were the rationale, we wouldn't support «svn log -r HEAD» either.

Use of «HEAD» to refer to any specific revision is inherently racy.
Callsites that care about the race condition should handle it
explicitly; see tools/dist/release.py:bump_versions_on_branch() for
an example.

There isn't any conceptual problem with defining «-c HEAD» to mean
"Resolve HEAD to a revision number N and then behave as «-r N-1:N»
would".  That wouldn't be any more racy than any other use of HEAD.  We
just never did that.

(Why?  For one, because -c is a lot newer than -r: -c was added in 1.4.0 (sic),
in 2006, while -r dates back to CVS.  When we added -c, it was
implemented directly in the cmdline client's option parser, without any
API changes, so it was written to only support numeric arguments.)

Note that «svn diff -c HEAD» isn't generally a useful call unless the
repository root («^/») is given as the target.

> When I want to see the diff of the most recent revision I use 'svn log 
> -l 1 --diff'. (Note, though, that will be from the BASE revision, not 
> HEAD.)

There's also «svn log -r HEAD:0 -l 1 --diff».

Cheers,

Daniel

Reply via email to