Background: writing an automated开发者_运维知识库 release script to export changed files between versions from SVN and upload to remote server.
The svn log command shows modified files and properties, but seems to not distinguish its verbose output between a content modification over property modifications.
Am I reading this output wrong, or is there an easy way to get a list of changed files between revisions whilst ignoring prop changes
Here's my sample cmd:
#: svn log "someurl" -r 2210:HEAD -v -q
Output:
------------------------------------------------------------------------
r2211 | author | 2010-02-08 12:36:56 +1300 (Mon, 08 Feb 2010)
Changed paths:
M /branches/project/release-v1-r-maintenance
M /branches/project/release-v1-r-maintenance/offroot/
M /branches/project/release-v1-r-maintenance/offroot/test.config
------------------------------------------------------------------------
The top two are only prop changes (mergeinfo, ignores, etc), whereas the 3rd item is an actual content edit and this is the real item that I want to grab to avoid exporting whole root all over.
Is there anyway to get/filter out just the content changes from the svn log or other command.
Here is a script i just wrote to get a verbose log of all revisions in which property changes inside the current svn dir where done. Just place the right start and end version where you guess the propertychange happened. It's not very fast, but it works.
#!/bin/bash
# Show the verbose log of the revisions, where svn properties
# inside the current folder where added/removed
startrev=4600
endrev=4620
for i in $(eval echo {$startrev..$endrev})
do
svn diff -c $i 2>/dev/null | grep "Property changes on" 1>/dev/null
if [ $? == 0 ]; then
echo "Property change in revision $i:"
svn log -r $i --verbose
fi
done
FYI, I posted a bash script over at How to make ‘svn log’ ignore property changes? that implements what jeroenh was alluding to... processing the output of svn log to drive svn diff and filtering on the output of the latter.
I think the only way is to actually parse the diff output for each revistion, though that seems rather brittle, and probably very slow...
This is how a diff entry looks for a file with only changed properties:
c:\test\wc>svn diff -c 3
Property changes on: test.txt
___________________________________________________________________
Added: test
+ test
This is how a diff entry looks for a file with changed contents AND changed properties:
c:\test\wc>svn diff -c 4
Index: test.txt
===================================================================
--- test.txt (revision 3)
+++ test.txt (revision 4)
@@ -1 +1,2 @@
+asdfads
Property changes on: test.txt
___________________________________________________________________
Added: someproperty
+ somepropertyvalue
I know this question has been answered, but in case anyone would like a little guide I've made this post about how to get get queryable data from svn log/diff (including bash scripts, xslt and oracle database scripts). Doing this enables you to run all sorts of useful queries against the view v_svnlog
"hot" files in this patch:
select path, count(*) num from v_svnlog
group by path
order by num desc, path asc
most tests by author
select author, count(*) num from v_svnlog
where path like '%Test%'
group by author
order by num desc
and so on...
Does this work?
svn log --xml --with-no-revprops
精彩评论