Reputation: 16805
I need to automate some task.
And I need to find svn revision previous to specified revision for specified URL.
How to do it using svn
tool and how to do it in svnkit
?
For example I have following history:
D:\wc\trunk>svn log svn://localhost/pg/trunk -q
------------------------------------------------------------------------
r99 | user | 2016-01-27 16:29:11 +0200 (Wed, 27 Jan 2016)
------------------------------------------------------------------------
r98 | user | 2016-01-27 16:28:59 +0200 (Wed, 27 Jan 2016)
------------------------------------------------------------------------
r90 | user | 2016-01-27 16:28:48 +0200 (Wed, 27 Jan 2016)
------------------------------------------------------------------------
r86 | user | 2016-01-27 16:28:35 +0200 (Wed, 27 Jan 2016)
------------------------------------------------------------------------
r85 | user | 2016-01-27 16:28:24 +0200 (Wed, 27 Jan 2016)
------------------------------------------------------------------------
r62 | user | 2016-01-26 18:04:47 +0200 (Tue, 26 Jan 2016)
Verbose output:
D:\wc\trunk>svn log svn://localhost/pg/trunk -v
------------------------------------------------------------------------
r99 | user | 2016-01-27 16:29:11 +0200 (Wed, 27 Jan 2016) | 1 line
Changed paths:
M /trunk/f1.txt
Change 4
------------------------------------------------------------------------
r98 | user | 2016-01-27 16:28:59 +0200 (Wed, 27 Jan 2016) | 1 line
Changed paths:
M /trunk/f1.txt
Change 3
------------------------------------------------------------------------
r90 | user | 2016-01-27 16:28:48 +0200 (Wed, 27 Jan 2016) | 1 line
Changed paths:
M /trunk/f1.txt
Change 2
------------------------------------------------------------------------
r86 | user | 2016-01-27 16:28:35 +0200 (Wed, 27 Jan 2016) | 1 line
Changed paths:
M /trunk/f1.txt
Change 1
------------------------------------------------------------------------
r85 | user | 2016-01-27 16:28:24 +0200 (Wed, 27 Jan 2016) | 1 line
Changed paths:
A /trunk/f1.txt
Init revision
------------------------------------------------------------------------
r62 | user | 2016-01-26 18:04:47 +0200 (Tue, 26 Jan 2016) | 1 line
Changed paths:
A /trunk
1
------------------------------------------------------------------------
I need to know what revision is before revision 90.
How to get that previous revision?
Upvotes: 1
Views: 83
Reputation: 23757
Swapping the order of the revisions given to the -r
switch will reverse the search order. From the SVN repository, this will show the two earliest revisions in the given range (1700000 to HEAD):
> svn log --limit=2 -r1700000:HEAD -q http://svn.apache.org/repos/asf/subversion/trunk/
------------------------------------------------------------------------
r1700035 | kotkov | 2015-08-29 10:16:13 -0400 (Sat, 29 Aug 2015)
------------------------------------------------------------------------
r1700130 | rhuijben | 2015-08-30 12:02:56 -0400 (Sun, 30 Aug 2015)
------------------------------------------------------------------------
And this will show the two latest:
> svn log --limit=2 -rHEAD:1700000 -q http://svn.apache.org/repos/asf/subversion/trunk/
------------------------------------------------------------------------
r1727040 | philip | 2016-01-27 08:23:08 -0500 (Wed, 27 Jan 2016)
------------------------------------------------------------------------
r1727028 | stefan2 | 2016-01-27 08:02:24 -0500 (Wed, 27 Jan 2016)
------------------------------------------------------------------------
I'm not an SVNKit user myself, but I'd imagine it supports this as well.
Upvotes: 2