Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get svn log for a user's activity on a specific date

Tags:

svn

How can I see all svn logs that I made on a specific date?

I've searched the web for this, but haven't been able to find a solution.

like image 864
ajitam Avatar asked Dec 10 '10 08:12

ajitam


3 Answers

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)
like image 168
Matthew Flaschen Avatar answered Oct 10 '22 19:10

Matthew Flaschen


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.)

like image 28
AgentConundrum Avatar answered Oct 10 '22 18:10

AgentConundrum


svn log --verbose --search user_name --revision {YYYY-MM-DD}:{YYYY-MM-DD}

Works on any platform

like image 1
Dmytro Ovdiienko Avatar answered Oct 10 '22 19:10

Dmytro Ovdiienko