Computing the differences between tags

March 16, 2007 Mark Phippard

A very common question asked on the Subversion mailing list is “How can I see the differences between two tags?” Of course there are a lot of variants of this question such as what are the differences between trunk and a branch or two branches etc. The person asking this question is almost always aware that they can run the svn diff command to get the differences, but usually they just want to know the list of differences at the file name level, not the complete line-level diff. Prior to Subversion 1.4, the answer to this question was usually that you had to parse the diff output and extract the file names.

With Subversion 1.4, however, a new option, –summarize, has been added to the diff command.  When this option is provided, the diff command just outputs the differences at the file level.  For example, to see the differences between the Subversion 1.3.1 and 1.3.2 tags I can run this command:

svn diff --summarize http://svn.collab.net/repos/svn/tags/1.3.1 http://svn.collab.net/repos/svn/tags/1.3.2
M      http://svn.collab.net/repos/svn/tags/1.3.1/STATUS
M      http://svn.collab.net/repos/svn/tags/1.3.1/build.conf
M      http://svn.collab.net/repos/svn/tags/1.3.1/configure.in
M      http://svn.collab.net/repos/svn/tags/1.3.1/build/ac-macros/aprutil.m4
M      http://svn.collab.net/repos/svn/tags/1.3.1/build/ac-macros/apr.m4
M      http://svn.collab.net/repos/svn/tags/1.3.1/build/ac-macros/swig.m4
M      http://svn.collab.net/repos/svn/tags/1.3.1/build/get-py-info.py
M      http://svn.collab.net/repos/svn/tags/1.3.1/build/generator/swig/external_runtime.py
M      http://svn.collab.net/repos/svn/tags/1.3.1/subversion/include/svn_version.h
M      http://svn.collab.net/repos/svn/tags/1.3.1/subversion/libsvn_wc/status.c
M      http://svn.collab.net/repos/svn/tags/1.3.1/subversion/libsvn_wc/lock.c
M      http://svn.collab.net/repos/svn/tags/1.3.1/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c
M      http://svn.collab.net/repos/svn/tags/1.3.1/subversion/bindings/swig/INSTALL
M      http://svn.collab.net/repos/svn/tags/1.3.1/subversion/bindings/swig/NOTES
M      http://svn.collab.net/repos/svn/tags/1.3.1/subversion/mod_dav_svn/version.c
M      http://svn.collab.net/repos/svn/tags/1.3.1/subversion/mod_dav_svn/repos.c
M      http://svn.collab.net/repos/svn/tags/1.3.1/subversion/tests/clients/cmdline/stat_tests.py
A      http://svn.collab.net/repos/svn/tags/1.3.1/subversion/tests/clients/cmdline/authz_tests.py
M      http://svn.collab.net/repos/svn/tags/1.3.1/subversion/tests/clients/cmdline/svntest/actions.py
M      http://svn.collab.net/repos/svn/tags/1.3.1/subversion/tests/clients/cmdline/svntest/main.py
M      http://svn.collab.net/repos/svn/tags/1.3.1/subversion/tests/libsvn_repos/repos-test.c
M      http://svn.collab.net/repos/svn/tags/1.3.1/subversion/libsvn_repos/commit.c
M      http://svn.collab.net/repos/svn/tags/1.3.1/subversion/svnserve/serve.c
M      http://svn.collab.net/repos/svn/tags/1.3.1/subversion/po/ja.po
M      http://svn.collab.net/repos/svn/tags/1.3.1/subversion/po/zh_TW.po
M      http://svn.collab.net/repos/svn/tags/1.3.1/contrib/client-side/svn_load_dirs.pl.in
M      http://svn.collab.net/repos/svn/tags/1.3.1/tools/hook-scripts/mailer/mailer.py
A      http://svn.collab.net/repos/svn/tags/1.3.1/tools/server-side/svnauthz-validate.c
A      http://svn.collab.net/repos/svn/tags/1.3.1/tools/server-side
M      http://svn.collab.net/repos/svn/tags/1.3.1/CHANGES
M      http://svn.collab.net/repos/svn/tags/1.3.1/packages/rpm/rhel-3/apr.patch
M      http://svn.collab.net/repos/svn/tags/1.3.1/packages/rpm/rhel-4/apr.patch
 M     http://svn.collab.net/repos/svn/tags/1.3.1

With the –summarize option provided to the diff command, the output shows the changes at the file level. The output is similar to what you would see with many of the other Subversion commands. The first column has a value to indicate if the file was Added, Modified, Deleted, the second column does the same for properties.  This makes it easy to parse the output in scripts. The –summarize option was a great enhancement to the diff command and solves this use case really well.

Previous Article
Authz and Anon Authn Agony

A recent first-time attempt at using Subversion’s path-based authorization module turned out to be less tri...

Next Article
Run svnserve as a Windows Service

If you are going to run a Subversion server on Windows, you want it to run as a service. Doing so allows yo...