How to retrieve files changed in range of revisions in Subversion?

廉价感情. 提交于 2019-12-18 12:50:53

问题


How would I retrieve all files from the repository, along with the folder structure, changed in a range of revisions, say from 1000-1920?


回答1:


If you just want the list of changed paths, have a look at the --summarize option on diff.

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



回答2:


That depends a little on what you intend to do with the data. If you're only interested in inspecting the data manually, you can do

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

to see all modified files, for example.

If you want to do something more programmatically, you can pass the --xml flag to svn log and get all the log data as XML output:

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



回答3:


Not sure if this helps, but if you're using Windows, and you have TortoiseSVN installed. It has this functionality. Check Using TortoiseSVN to Export Only New/Modified Files for the details. Again, this is assuming you're using Windows.




回答4:


Here's a solution that will give you a tree containing only those files that exist in r1920 and were changed or added between r1000 and r1920. It's a bash script, so you'll need Linux and the GNU tools or something comparable.

 #!/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.


来源:https://stackoverflow.com/questions/427781/how-to-retrieve-files-changed-in-range-of-revisions-in-subversion

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