It's been a little while since this task is in my todo list. The code
I sent a few months ago to the list got some brush up and I updated to
the taste of the day (rev-ranges and so on).
(Previous post: http://svn.haxx.se/dev/archive-2007-08/0142.shtml)
Intended for 'svn diff' at the beginning, it turns out to work for
'svn merge' and 'svn log' too since both of these commands use the 'c'
option. So we can use 'svn diff -cHEAD' as much as 'svn merge -r1:3
-cHEAD', for example.
Since we don't have any revision keyword for 'HEAD - 1', I introduced
a new entry to svn_opt_revision_kind enum to take care of that (Say
hello to svn_opt_revision_prior). However, this is *not* a new
revision keyword, it is only used here internally and the server never
knows we're querying for 'HEAD - 1'.
I don't think it's worth adding a new PRIOR (or something) keyword to
the client and server exposure.
PASSed all tests.
[[[
Add support for -cHEAD (affects svn {diff,log,merge}).
* subversion/include/svn_opt.h
(svn_opt_revision_kind): Add svn_opt_revision_prior to represent
"HEAD - 1".
* subversion/libsvn_subr/opt.c
(parse_one_rev): Add a case for negative numbers as 'diff -c N' is now
using this function.
* subversion/libsvn_client/revisions.c
(svn_client__get_revision_number): Do the same as
svn_opt_revision_head for svn_opt_revision_prior, minus one.
* subversion/svn/main.c
(main): Use svn_opt_parse_revision() instead of strtol() to read
'-c''s revision argument (numeric or HEAD) and adapt to support HEAD
argument.
* subversion/tests/cmdline/diff_tests.py
(diff_change_head_keyword): New test.
(test_list): Add the test.
]]]
Hope it gets some more appeal. Suggestions welcome!
Charles
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-02-16 23:53:50 CET