开发者

Subversion: How to find the differences between two tags?

I know that a diff between two tags lists the 'files' which have been changed between those two tags by the following method.

svn diff tag1 tag2 |grep Index:

Is there any property in Subversion or some technique to find out revision numbers w开发者_开发百科hich caused those files to change (i.e differences between tag1 version of the file and tag2 version of the same file)?

Thx Vandana


You can first find the revisions of the tags:

svn info http://svn.twig-project.org/tags/RELEASE_0_9_7 | grep 'Last Changed Rev'
Last Changed Rev: 331

svn info http://svn.twig-project.org/tags/RELEASE_0_9_8 | grep 'Last Changed Rev'
Last Changed Rev: 343

You're not really looking for a diff, you are looking for a log. So do a verbose log between those revisions and you will get the commits including changed files.

svn log -v -q -r 331:343 http://svn.twig-project.org/trunk

------------------------------------------------------------------------
r332 | fabien | 2010-06-12 18:30:02 +0200 (Sat, 12 Jun 2010)
Changed paths:
   M /trunk/CHANGELOG
   M /trunk/lib/Twig/Environment.php
------------------------------------------------------------------------
r333 | fabien | 2010-06-12 18:45:04 +0200 (Sat, 12 Jun 2010)
Changed paths:
   M /trunk/CHANGELOG
   M /trunk/lib/Twig/Environment.php


If you want a list of revisions that could be merged from one tag to another, you can generate it with the following:

    svn mergeinfo --show-revs eligible URL_TAG_1 URL_TAG_2


Since SVN version 1.9 you have --log option for svn mergeinfo:

svn mergeinfo --log --show-revs eligible SOURCE TARGET


If you want to know which files have been changed between two tags use in a working copy:

svn merge --dry-run URL_TAG_1 URL_TAG_2


The following shell script takes a SOURCE and a DEST, and shows changesets in SOURCE that has not been merged into DEST.

So, to answer the original question:

svnincoming ^/tags/TAG1 ^/tags/TAG2

Or to see changes in trunk that hasn't been merged into the working copy branch:

cd /working/copy/
svnincoming ^/trunk

The svnincoming script:

#!/bin/sh -e

SOURCE="$1"
DEST="${2:-.}"

if [ "$SOURCE" = "" ]; then
    echo "Usage: `basename $0` SOURCE[@REV] [DEST[@REV]]"
    echo "List revisions eligible for merging from SOURCE to DEST (or '.', if omitted)."
    exit 1
fi

svn mergeinfo --show-revs eligible "$SOURCE" "$DEST" | sed 's/^/-/' | xargs -d '\n' svn log "$SOURCE"


with svn version 1.9.7, although my tags are not in the same branch, it works !

svn diff --old=URL_TAG_1 --new=URL_TAG_2
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜