SCM stands for Source Code Management. Pretty much the same thing can be called VCS, Version Control Software. Perhaps even more TLA’s are there out in the wild. It all boils down to a program which allows programmers to manage their source code.

Pretty much everybody who started using SCM, started with CVS and then moved to something else. Probably Subversion, which is meant to be a CVS replacement. For more adventurous or demanding developers, there are many other SCM’s: Git, Bazaar, Monotone, Mercurial, Darcs… and more.

Mark Shuttleworth has written an interesting thing: that file and directory renaming is one of the most important operations to be handled with an SCM. I got curious and wrote a test case for three SCM’s I know: Bazaar, Git and Subversion. The scenario is:

1. A project is created, with one directory and one file in it.

`-- project `-- dir-a `-- foo.txt

2. Developer A creates a branch and renames the directory

`-- project `-- dir-b `-- foo.txt

3. At the same time, developer B creates a branch, modifies the file

and adds another file to the directory.

`-- project `-- dir-a |-- bar.txt `-- foo.txt

4. Developer C creates a branch, merges A’s changes first and then B’s

changes. What I would expect as the result after two merges, is one

directory with two files in it.

`-- project `-- dir-b |-- bar.txt `-- foo.txt

From the three tested SCM’s only Bazaar and Darcs got it right. Git would leave two directories (dir-a and dir-b), and Subversion would discard the bar.txt file altogether.

I wrote test case for the three SCM’s I’m familiar with. If you feel like writing a test case for your SCM, I will be glad to see it! Meanwhile, you can download the test cases and run them:

http://code.blizinski.pl/scm-rename-test.tar.gz

They are written as Bash scripts and are tested under Linux. README file is included.

UPDATE: Dennis Lambe added Darcs test case. I am pleased to tell you that Darcs handles the directory rename in the correct way: after merge, there is one directory with two files. Dennis’ file is currently included in the tarball.

UPDATE: I’ve noticed a short conversation about this issue on #git IRC channel. No conclusions were drawn.

UPDATE, 2007-09-10: Paul wrote Mercurial test case, now included in the tar.gz archive.

Share this: Share

Facebook

Twitter



Like this: Like Loading... Related