Better Move Tracking in Subversion 1.8

Refactoring adherents in the Subversion community will be pleased with the better move tracking in Subversion 1.8.  Refactoring is a regular housekeeping operation for many Agile developers, and one that often involves renaming files or moving them to new locations. If you refactor on a regular basis you’ll appreciate a small improvement in local move tracking in Subversion 1.8.

Prior to Subversion 1.8, a move was simply a copy followed by a delete – and that’s still how a move is permanently recorded in the repository. In Subversion 1.8, moves have special significance in your working copy.

svn status and svn info now show a move as a coherent operation

Let’s do a quick rename and see what svn status reports.

$ svn move BUILDING.txt build.txt
   A         build.txt
   D         BUILDING.txt
$ svn status
   D       BUILDING.txt
           > moved to build.txt
   A  +    build.txt
           > moved from BUILDING.txt

So far so good – a handy little notification in the status report.

A move must be committed atomically

You can’t commit just one part of the operation.

$ svn commit -m "just the new one" build.txt
   svn: E200009: Commit failed (details follow):
   svn: E200009: Cannot commit 'build.txt' because it was moved from 'BUILDING.txt' which is not 
part of the commit; both sides of the move must be committed together

Some tree conflicts can be resolved automatically

Now let’s assume that someone else has edited BUILDING.txt, the file under the original name, before I can commit the move. When I run the update, I’m notified and can choose to have the other edit applied to the renamed file in my working copy.

$ svn update
   Updating '.':
      C BUILDING.txt
   At revision 35.
   Tree conflict on 'BUILDING.txt'
      > local file moved away, incoming file edit upon update
   Select: (p) postpone, (mc) my side of conflict, (r) resolved,
           (q) quit resolution, (h) help: mc
   U    build.txt
   Updated to revision 35.
   Resolved conflicted state of 'BUILDING.txt'
   Summary of conflicts:
     Tree conflicts: 0 remaining (and 1 already resolved)

Using the mc conflict resolution choice, the edits submitted by the other user are merged into my copy under the new name.

Try it out!

Other notable changes in Subversion 1.8 can be found in the release notes including svn move no longer operating on a mixed revision working copy. Download fully tested, certified Subversion 1.8 and try it out today, you don’t need to be working against a 1.8 server to use this new capability.

Subversion is a registered trademark of the Apache Software Foundation.

0 Responses to “Better Move Tracking in Subversion 1.8”


  • No Comments

Leave a Reply