svn diff -c does not accept HEAD
Hello, all According to the documentation for svn diff, The -c M option is equivalent to -r N:M where N = M-1 The documation of the -c option agrees: this option is syntactic sugar for -r ARG-1:ARG. I tried it: svn diff -r HEAD:6876 [works] svn diff -c HEAD [fails] The -c option does not support the `HEAD' short-cut in my svn 1.12.0: E205000: Non-numeric change argument (HEAD) given to -c Did I misunderstand the documentaiton, or is it a bug?
Re: svn diff -c does not accept HEAD
Hi, In article <20201207201138.4ef0e7d22934ff7511c7c...@gmail.com> anton@gmail.com writes: > Hello, all > > According to the documentation for svn diff, > >The -c M option is equivalent to -r N:M where N = M-1 > > The documation of the -c option agrees: > >this option is syntactic sugar for -r ARG-1:ARG. > > I tried it: > >svn diff -r HEAD:6876 [works] >svn diff -c HEAD [fails] > > The -c option does not support the `HEAD' short-cut in my > svn 1.12.0: > >E205000: Non-numeric change argument (HEAD) given to -c > > Did I misunderstand the documentaiton, or is it a bug? 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. Cheers, -- Yasuhito FUTATSUKI
Re: svn diff -c does not accept HEAD
On Mon, Dec 7, 2020 at 1:47 PM Yasuhito FUTATSUKI 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. 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.) Hope that helps, Nathan
Re: svn diff -c does not accept HEAD
Nathan Hartman wrote on Mon, 07 Dec 2020 20:50 +00:00: > On Mon, Dec 7, 2020 at 1:47 PM Yasuhito FUTATSUKI > 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