Jason Rust <jrust@rustyparts.com> writes:
> Is there any way from the command line to determine what the previous
> revision number is, given an a specific revision number. The problem is
> that I have a list of files changed in a specific commit from svn log -v
> (I'm writing a program to display the patchset of a commit).
> However, I need to know what the previous revision of each of those
> files is so that I can link to that revision. I would think using some
> combination of svn log -r "PREV":X would work, but no luck yet.
> Obviously I could get the complete log for the file and iterate over
> that until I find it, but it seems there should be an easier way.
Given the output from 'svn log -r REV -v', you should have all you need.
For modified paths, the previous version of any changed file is REV -
1. Well, that might not be the *actual* revision in which the file
was last changed, but the contents should be the same (suitable for
diffing purposes). For deleted paths, same game. Added and replaced
paths have no previous version.
We this gets tricky is in light of copies, but it's still doable. Say
you have:
A /trunk/copied-thing (from /trunk/thing, rev 4)
M /trunk/copied-thing/file
The data above is sufficient for noting that the previous incarnation
for /trunk/copied-thing/file lives at /trunk/thing, revision 4.
Of course, if your program is running on the same machine as the
repository, I'd consider looking into the Python bindings,
specifically the RevisionChangeCollector class in repos.py. See
Subversion's mailer.py or ViewCVS for example usages of this class.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Nov 4 23:29:37 2003