If you're new to Subversion (or even if you aren't) and you're looking for a way to generate a changelog between two tags, look no further. The information is buried elsewhere, but as always, when I learn something that I don't think is as easy to learn as it should be, I try to do my part. This is no exception.
Generating a changelog between two tags in Subversion is a three-step process, but all three steps are relatively straightforward and simple.
First off, because log ranges are typically based on revision numbers, you need to get the first revision number of the first tag. Assuming your Subversion repository is located on the local machine at file:///dev/svn, you can obtain the revision number with:
svn log -v --stop-on-copy file:///dev/svn/tags/MY_FIRST_TAG
Similarly, you can obtain the first revision of the second tag with:
svn log -v --stop-on-copy file:///dev/svn/tags/MY_SECOND_TAG
Both of these commands will return something like the following, with the revision number you're interested in highlighted in red:
r42 | berniez | 2006-01-18 23:26:17 -0800 (Thu, 18 Jan 2006) ...
Now that you've obtained the two revision numbers you're after, you can use these to get a changelog between the two tags:
svn log -v -r42:79 file:///dev/svn/trunk
And there you have it. A changelog between two tags in Subversion. Oh, and in case you want to compare tags on a branch, just substitute branches/MY_BRANCH_NAME for trunk in the above command and you'll be all set.
Comments
Hi,
Thx for this useful information, but isn't there a tool which can generate this automatically ?
When we commit, we always set for which version the commit is for Example:
[3.0,3.1] bugfix: blablbla
[3.1] feature: blablabla
etc ...
Extracting the log message is not enough, I also need to be able to parse it.
So if a tool exist, this would prevent me from writing it myself :)
thx
checkout statsvn...you might get what u've been looking for..
Use output flag to be xml and no extra parsing needed!
svn log --revision 40:41 svn://some-path --xml
Post Comments
If you feel like commenting on the above item, use the form below. Your email address will be used for personal contact reasons only, and will not be shown on this website.
I am not sure the above is strictly correct. For example, if I create a tag many weeks after the original revision was created on 'trunk', then the revision numbers will not be sequential. Instead, I think you should be looking at the tail of the last log entry supplied by 'svn log -v --stop-on-copy'
For example:
r42 | berniez | 2006-01-18 23:26:17 -0800 (Thu, 18 Jan 2006) ...
Changed paths:
A file:///dev/svn/tags/MY_FIRST_TAG (from /trunk:41)
Compared to me creating the same tag with the '--revision' switch (svn copy --revision 41 .../trunk .../MY_FIRST_TAG) many weeks/months later when the number of revisions in my repository has grown significantly:
r9999 | berniez | 2006-01-18 23:26:17 -0800 (Thu, 01 Feb 2010) ...
Changed paths:
A file:///dev/svn/tags/MY_FIRST_TAG (from /trunk:41)
However, subversion is never straightforward and I believe the log command doesn't report correctly. For example doing an svn log between two consecutive revisions returns the same result as doing the same log between the next two consecutive revisions.... thereby making the differences reported by 'svn log' inaccurate.
For example:
svn log --revision 40:41 svn://some-path
svn log --revision 41:42 svn://some-path
Will report exactly the same changes for a path that only has a single log change at 41..!! I suppose the safest way is to increment the first number (the lower revision) by one - hardly an elegant solution, though..!!
Enjoy.
Mark.
Permalink