Subversion: How to find the differences between two tags?

我的梦境 提交于 2019-11-29 03:41:30

问题


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 which caused those files to change (i.e differences between tag1 version of the file and tag2 version of the same file)?

Thx Vandana


回答1:


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



回答2:


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



回答3:


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



回答4:


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"



回答5:


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

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



回答6:


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


来源:https://stackoverflow.com/questions/3270322/subversion-how-to-find-the-differences-between-two-tags

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!