Skip to content

Instantly share code, notes, and snippets.

@gkhays
Last active October 8, 2015 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gkhays/d41d048c7510542f4564 to your computer and use it in GitHub Desktop.
Save gkhays/d41d048c7510542f4564 to your computer and use it in GitHub Desktop.
SVN Activity Metrics: See and count the number of revisions given a date range.

Subversion Log

The first place I looked for svn log syntax was the manual; see Examining History. E.g.

$ svn log
------------------------------------------------------------------------
r3 | sally | 2008-05-15 23:09:28 -0500 (Thu, 15 May 2008) | 1 line

Added include lines and corrected # of cheese slices.
------------------------------------------------------------------------
r2 | harry | 2008-05-14 18:43:15 -0500 (Wed, 14 May 2008) | 1 line

Added main() methods.
------------------------------------------------------------------------
r1 | sally | 2008-05-10 19:50:31 -0500 (Sat, 10 May 2008) | 1 line

Initial import
------------------------------------------------------------------------

Table 2.1. common log requests

Command Description
svn log -r 5:19 Display logs for revisions 5 through 19 in chronological order
svn log -r 10:5 Display logs for revisions 5 through 19 in reverse chronological order
svn log -r 8 Display logs for revsion 8 only

You may specify a URL to look at revisions outside your workspace. E.g.

svn log --quiet -r {2015-10-01}:{2015-10-08} http://svn.apache.org/repos/asf/commons/
------------------------------------------------------------------------
r1706261 | ecki | 2015-10-01 09:27:25 -0500 (Thu, 01 Oct 2015)
------------------------------------------------------------------------
r1706355 | britter | 2015-10-02 03:10:55 -0500 (Fri, 02 Oct 2015)
------------------------------------------------------------------------
r1706429 | ecki | 2015-10-02 10:13:15 -0500 (Fri, 02 Oct 2015)
------------------------------------------------------------------------
r1706430 | ecki | 2015-10-02 10:16:36 -0500 (Fri, 02 Oct 2015)
------------------------------------------------------------------------
r1706542 | britter | 2015-10-03 05:46:49 -0500 (Sat, 03 Oct 2015)
------------------------------------------------------------------------
r1706543 | britter | 2015-10-03 05:56:55 -0500 (Sat, 03 Oct 2015)
------------------------------------------------------------------------
r1706560 | britter | 2015-10-03 07:17:53 -0500 (Sat, 03 Oct 2015)
------------------------------------------------------------------------
r1706911 | oheger | 2015-10-05 15:01:32 -0500 (Mon, 05 Oct 2015)
------------------------------------------------------------------------
r1706912 | oheger | 2015-10-05 15:01:58 -0500 (Mon, 05 Oct 2015)
------------------------------------------------------------------------
r1707339 | britter | 2015-10-07 12:18:40 -0500 (Wed, 07 Oct 2015)
------------------------------------------------------------------------

Subversion Update

svn status --show-updates
svn status -u
How do you get a list of changes from a Subversion repository by date range?

http://stackoverflow.com/questions/141599/how-do-you-get-a-list-of-changes-from-a-subversion-repository-by-date-range
http://svn.haxx.se/users/archive-2006-08/0737.shtml

C:\Users\haysg\src\iac\trunk>svn merge --dry-run -r BASE:HEAD .
--- Merging r9763 through r9765 into '.':
U    utilities-internal\policy-generator\src\main\java\com\netiq\iac\gensod\Generate.java
U    utilities-internal\policy-generator\pom.xml
How to see what will be updated from repository before issuing “svn update” command?

http://stackoverflow.com/questions/182945/how-to-see-what-will-be-updated-from-repository-before-issuing-svn-update-comm

How-to: “svn update --dry-run”

http://translocator.ws/2005/10/12/svn-update-dry-run

Alternative Using SVN Diff

svn diff --summarize -c 7400

#!/bin/bash
# Get the number of check-ins within a date range and get rid of the lines between them.
svn log --quiet -r {2015-09-15}:{2015-10-08} | grep ^r
# Roll that up into a total count
svn log --quiet -r {2015-09-15}:{2015-10-08} | grep ^r | wc -l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment