Skip to main content
Enterprise Agile Planning Image

This post is from the CollabNet VersionOne blog and has not been updated since the original publish date.

Last Updated Jul 05, 2007 — Enterprise Agile Planning expert

Upcoming Subversion 1.5 Feature: Changelists

Enterprise Agile Planning

One quality of a typical engineer is a heightened sensitivity to potential problem areas. For software engineers, that often means spotting possible bugs in our peripheral vision while working on some nearby chunk of source code. This is both a blessing and curse. You want your bugs fixed, but unfortunately we sometimes get derailed from our primary task by these little excursions into Perfection.

Another fact of a developer’s life is that there are always more things to work on than time to do so. And everything is of the utmost priority to someone. And so here again, we find ourselves working on multiple things at the same time, making slow-yet-incremental progress on each of them so at least we can say about them all with a clear conscience and a forced smile, "As it turns out, I’m working on that right now."

To my managerial readers, I regretfully admit that I have absolutely no solution for those problems. After all, this is a technical blog. But I can (and will) tell you about an upcoming Subversion feature that might reduce the context-switching costs for those developers: changelists.

Whatever the reason, it is commonplace to find that a developer is working at any given time on multiple different, distinct changes to a particular bit of source code. And often each change isn’t nicely contained in some module, safely separate from the other changes. The groups of changes might overlap, modifying different files in the same module, or even modifying different lines in the same file. Now, there are various work methodologies that developers can employ to keep these tasks organized. Some use separate working copies of the same repository to hold each individual change-in-progress. Others might choose to create feature branches in the repository, and use a single working copy that is constantly switched to point to one such branch or another. Still others use diff and patch to backup and restore uncommitted changes to and from patchfiles associated with each change. Each of these methods has its pros and cons, and to large degree, the details of changes being made dictate the methodology used to distinguish them.

But Subversion 1.5 brings a new feature called "changelists" which adds yet another method to the mix. Changelists are basically arbitrary labels applied to working copy files for the purpose of associating multiple files together. Gmail users are familiar with this concept already. Gmail doesn’t provide the traditional folders-based email organization mechanism. In Gmail, you apply arbitrary labels to emails, and multiple emails can be said to be part of the same group if they happen to share a particular label. Viewing only a group of similarly labeled emails then becomes a simple user interface trick. Many other Web 2.0 sites have similar mechanisms — consider the "tags" used by sites like YouTube and Flickr, "categories" applied to blog entries, and so on. Folks understand today that organization of data is critical, but that how that data is organized needs to be a flexible concept. The old files-and-folders paradigm is too strict for many applications.

So Subversion’s changelist support allows you to:

  • create changelists by applying labels to files you want to be associated with that changelist,
  • remove those labels, and
  • limit the scope of the files on which its subcommands operate to only those bearing a particular label.

For example, say that as part of my vast array of things to accomplish today, I need to fix some minor issues in ViewVC related to diff-viewing operations. My work leads me to change a couple of files.

$ cd projects/viewvc
$ svn status
M      lib/vclib/ccvs/
M      lib/vclib/

But while testing this change, I notice something else that’s not working right in the nearby annotation support code. There are, as previously mentioned, many things I can do at this point in order to switch contexts and fix this secondary issue. We’ll use changelists for the purposes of illustration.

First, I want to create a changelist and associate with it the two files I’ve already changed. These helps me to distinguish those changes from the ones I’m about to make for this secondary issue.

$ svn changelist diff-fixes lib/vclib/ccvs/
Path 'lib/vclib/ccvs/' is now a member of changelist 'diff-fixes'.
$ svn changelist diff-fixes lib/vclib/
Path 'lib/vclib/' is now a member of changelist 'diff-fixes'.
$ svn status

--- Changelist 'diff-fixes':
M      lib/vclib/ccvs/
M      lib/vclib/

As you can see, the output of ‘svn status’ reflects this new grouping.

Now, I start fixing the secondary issue, which requires that I change a third file. I’m not yet ready to commit either change, though, so I’ll make a changelist for my second change, too.

$ svn changelist blame-fix lib/vclib/ccvs/
Path 'lib/vclib/ccvs/' is now a member of changelist 'blame-fix'.
$ svn status

--- Changelist 'blame-fix':
M      lib/vclib/ccvs/

--- Changelist 'diff-fixes':
M      lib/vclib/ccvs/
M      lib/vclib/

Now, that visual grouping alone is nice, but not entirely useful. If I wanted to see just the diff-related code changes I’d made, I would still need to explicitly name the files I modified for that change on the ‘svn diff’ command line.

$ svn diff lib/vclib/ lib/vclib/ccvs/

That’s not so bad for two files, but what about for twenty?

Fortunately, Subversion 1.5’s changelist support is more thorough than that. I can use the new --changelist option to limit the scope of many subcommands to just those files associated with a given changelist. The result is a much simpler command line, and a much smaller chance of overlooking one or more of the files I intended to examine.

$ svn diff --changelist diff-fixes
Index: lib/vclib/ccvs/
--- lib/vclib/ccvs/ (revision 1157)
+++ lib/vclib/ccvs/ (working copy)
@@ -112,8 +112,8 @@
     temp2 = tempfile.mktemp()
     open(temp2, 'wb').write(self.openfile(path_parts2, rev2)[0].getvalue())

-    r1 = self.itemlog(path_parts1, rev1, {})[0]
-    r2 = self.itemlog(path_parts2, rev2, {})[0]
+    r1 = self.itemlog(path_parts1, rev1, {})[-1]
+    r2 = self.itemlog(path_parts2, rev2, {})[-1]

     info1 = (self.rcsfile(path_parts1, root=1, v=0),, r1.string)
     info2 = (self.rcsfile(path_parts2, root=1, v=0),, r2.string)
Index: lib/vclib/
--- lib/vclib/ (revision 1157)
+++ lib/vclib/ (working copy)
@@ -240,7 +241,7 @@
   def readline(self):
     return self.fp.readline()

-  def close():
+  def close(self):
       if self.fp:

As you might expect, I can then provide the same --changelist option to the ‘svn commit’ operation.

$ svn ci -m "Fix some diff-related oopses." --changelist diff-fixes
Sending        lib/vclib/ccvs/
Sending        lib/vclib/
Transmitting file data ..
Committed revision 1158.

Meanwhile, my other changelist remains undisturbed.

$ svn st

--- Changelist 'blame-fixes':
M      lib/vclib/ccvs/

The new --changelist option is present on many of the Subversion command-line client’s subcommands (commit, diff, info, lock, log, proplist, propget, propset, status, update, …). And, of course, there is also the new ‘svn changelist’ subcommand for adding and removing (via a --remove option) files to and from changelists. You can assign files to changelists before you even modify them. And Subversion doesn’t force you to use changelists universally, or even at all. As in most things, Subversion just gives you the tools, and lets you decide whether and how to use them. All in all, though, this new feature should provide Subversion users — especially those with Perforce experience — an easier way to manage those multiple simultaneous works-in-progress.

There are some limitations of the changelist support, though. First, the feature has path-level granularity. If you find yourself with overlapping changes which touch the same file, you’re going to have to work out a different way to deal with that overlap. Also, a changelist is private to a particular working copy — there’s no way to automatically share your changelist definition with other users of the repository. But given the problem the feature exists to solve, that shouldn’t be any big deal — if you need to share works-in-progress with others, use versioned branches.

More from the Blog

View more
Jul 27, 2021 Becomes First to Achieve FedRAMP Moderate “In Process” Status for Enterprise Agile Planning Solution

Enterprise Agile Planning, the leading AI-driven DevOps value stream delivery, and ma ...
Read More
Jun 21, 2021

How Agile can be implemented effectively across the organization

Enterprise Agile Planning
Just a few decades ago, a “disruption” was seen as an undesirable thin ...
Read More
May 31, 2021

Agile change management processes are key to delivering software faster

Enterprise Agile Planning
With its emphasis on delivery value faster, agile product management s ...
Read More
May 03, 2021

Bringing the agile planning approach to your whole business

Enterprise Agile Planning
The events of the last 12 months have demonstrated that the only sure ...
Read More
Contact Us