How do I a q开发者_如何学编程uery to list out all commits by a user to a Subversion repository?
I would like to find all commits I have ever done to the Subversion repository, not just commits in the current snapshot. More importantly, I would like to organize the file lists by the SVN comment used while committing.
I am thinking maybe a Python or shell script that would parse the output of
svn log | grep username
to extract revisions and then pipes the output to:
svn log -r [revision numbers go here]
Maybe some scripting gurus can help me out..
I guess that the following would be a good starting point.
svn log -v --xml --with-all-revprops URL_OF_REPO
It will output entries in an XML log like the following (generated on a test repository).
D:\temp\co-test-repo>svn log -v --xml --with-all-revprops --username AWXGX file:///d:/svn/repos/test-repo
<?xml version="1.0"?>
<log>
<logentry
revision="2">
<author>AWXGX</author>
<date>2010-05-05T19:20:34.062500Z</date>
<paths>
<path
kind="file"
action="A">/src/main/java/org/pers/OtherClass.java</path>
</paths>
<msg>add another class</msg>
</logentry>
<logentry
revision="1">
<author>AWXGX</author>
<date>2010-05-05T19:20:00.578125Z</date>
<paths>
<path
kind="dir"
action="A">/src/main/java/org</path>
<path
kind="file"
action="A">/src/main/java/org/pers/SomeClass.java</path>
<path
kind="dir"
action="A">/src</path>
<path
kind="file"
action="A">/pom.xml</path>
<path
kind="dir"
action="A">/src/main</path>
<path
kind="dir"
action="A">/src/main/java</path>
<path
kind="dir"
action="A">/src/main/java/org/pers</path>
</paths>
<msg>creation of project files</msg>
</logentry>
</log>
Then do an XSLT transformation to output like you want. I hope this helps.
EDIT: I removed the --username
that is only used for authentification puposes, nevertheless the command can still be used (I tried it on a real repository). The filtering on a user has then to be done using XSLT.
You can use SVN log and grep for your name.
There's a script contrib/search-svnlog.pl
that will do what you want.
Here's a link to the source on Subversion's trunk, but it looks like it hasn't changed in a while:
http://svn.apache.org/repos/asf/subversion/trunk/contrib/client-side/search-svnlog.pl
Here's a patch for a script I wrote, svnlogfilter.pl, that you may need to tease out to use it. I'll put it online somewhere RSN.
http://svn.haxx.se/dev/archive-2005-05/0094.shtml
精彩评论