如何检索Subversion中修订版本范围内更改的文件?

时间:2009-01-09 11:38:59

标签: svn

如何从存储库中检索所有文件以及文件夹结构,在一系列修订版本中更改,例如1000-1920?

4 个答案:

答案 0 :(得分:22)

如果您只想要更改路径的列表,请查看差异上的--summarize选项。

svn diff --summarize -r1000:1920 https://my.org/myrepo/

答案 1 :(得分:11)

这取决于您打算如何处理数据。如果您只对手动检查数据感兴趣,可以执行

svn log -r1000:1920 -q -v | grep "   M" | sort -u
例如,

查看所有已修改的文件。

如果您想以编程方式执行更多操作,可以将--xml标志传递给svn log并将所有日志数据作为XML输出获取:

svn log -r1000:1920 --xml > log1000-1920.xml

答案 2 :(得分:6)

不确定这是否有帮助,但如果您使用的是Windows,并且安装了TortoiseSVN。它具有此功能。查看 Using TortoiseSVN to Export Only New/Modified Files 了解详细信息。再次,假设您正在使用Windows。

答案 3 :(得分:0)

这是一个解决方案,它将为您提供一个树,其中仅包含r1920中存在的文件,并在r1000和r1920之间进行了更改或添加。这是一个bash脚本,所以你需要Linux和GNU工具或类似的东西。

 #!/bin/bash

repo=https://zsvn.brz.gv.at/svn/ju-vj/trunk/vj
lo=1000
hi=1920
wc=changed_files$hi

# all files as of revision $hi
svn export $repo@$hi $wc

(# files that have changed
 svn diff --summarize -r$lo:$hi $repo \
    | egrep -e "^[AM]" \
    | cut -c7- \
    | sed -e "s,$repo,," \
    | sed -e "s, /,," \
     | while read p
 do # omit directories, emit only files
     if [[ -f $wc/$p ]]
     then
         echo "$p"
     fi
 done
 # all files (omit directories)
 svn ls -R $repo@$hi | egrep -v -e "/$"
) \
| sort | uniq -u \
| (cd $wc ; xargs rm)

# The last lines select only those files which are unique when the two
# lists are combined, that is all those files that are in revision $hi
# and have not changed.  These are then fed to rm by xargs to remove
# them.

# what's left is an export containing only those files that changed or
# were added between revisions $lo and $hi.