How can I see all svn logs that I made on a specific date?
I've searched the web for this, but hav开发者_JAVA技巧en't been able to find a solution.
To show entries for username on the 10th:
svn log -r '{2010-12-10}:{2010-12-11}'|sed -n '1p; 2,/^-/d; /username/,/^-/p'
The SVN command gets commits in that date range
Breakdown of the sed command:
-n
- Don't automatically print.1p
- Print the first line (the --- header).2,/^-/d;
- Remove everything from the second through the closing --- header. This removes the first entry, which IIRC is the most recent commit as of midnight at the beginning of the day (i.e. it's not actually in the range, and may be long in the past)./username/,/^-/p
- Print everything starting from that username (a regex matching the user you're interested in) to the closing --- header (this acts repeatedly)
Assuming you're on a Linux system, you could do something like this:
svn log -r {YYYY-MM-DD}:{YYYY-MM-DD} | grep username | cut -d " " -f 1 | tail -n +2 | while read revision; do svn log -r $revision; done
What this is doing is running svn log to get all logs for a given day, then cutting the output so that it is just a list of revision numbers. [Edit: Added tail -n +2
to cut off the first revision - as @Matthew mentions, that first line would be the most recent revision before {that_day}
] The while loop then iterates over each line of revision numbers, passing it to svn log
.
Also, remember that {YYYY-MM-DD} refer to midnight at the start of that day, so to run the whole day you should run it for {that_day}:{the_following_day}
.
Hope that helps!
(Also, sorry for the confusion earlier about --username
. I've never used it before, and because my local svn only has one user (me), it looked like it worked, when it really wasn't.)
svn log --verbose --search user_name --revision {YYYY-MM-DD}:{YYYY-MM-DD}
Works on any platform
If you are on linux the best solution for getting whole date logs is as follows:
svn log -r {start date}:{end date} -v | sed -n ‘/username/,/—–$/ p’
If you wants to retrieve SVN logs on the basis of username and between the given date range then you need use svn log -r {startDate}:{endDate}
which is piped with sed
command for username.
精彩评论