How to display a specific user's commits in svn log?
You could use this:
svn log | sed -n '/USERNAME/,/-----$/ p'
It will show you every commit made by the specified user (USERNAME).
UPDATE
As suggested by @bahrep, subversion 1.8 comes with a --search
option.
With Subversion 1.8 or later:
svn log --search johnsmith77 -l 50
Besides author matches, this will also turn up SVN commits that contain that username in the commit message, which shouldn't happen if your username is not a common word.
The -l 50
will limit the search to the latest 50 entries.
--search ARG
Filters log messages to show only those that match the search pattern ARG.
Log messages are displayed only if the provided search pattern matches any of the author, date, log message text (unless
--quiet
is used), or, if the--verbose
option is also provided, a changed path.If multiple
--search
options are provided, a log message is shown if it matches any of the provided search patterns.If
--limit
is used, it restricts the number of log messages searched, rather than restricting the output to a particular number of matching log messages.
http://svnbook.red-bean.com/en/1.8/svn.ref.svn.html#svn.ref.svn.sw.search
svn doesn't come with built-in options for this. It does have an svn log --xml
option, to allow you to parse the output yourself, and get the interesting parts.
You can write a script to parse it, for example, in Python 2.6:
import sys
from xml.etree.ElementTree import iterparse, dump
author = sys.argv[1]
iparse = iterparse(sys.stdin, ['start', 'end'])
for event, elem in iparse:
if event == 'start' and elem.tag == 'log':
logNode = elem
break
logentries = (elem for event, elem in iparse
if event == 'end' and elem.tag == 'logentry')
for logentry in logentries:
if logentry.find('author').text == author:
dump(logentry)
logNode.remove(logentry)
If you save the above as svnLogStripByAuthor.py, you could call it as:
svn log --xml other-options | svnLogStripByAuthor.py user