This link has been bookmarked by 21 people . It was first bookmarked on 03 Apr 2008, by Chris Lasher.
-
01 Dec 11
-
31 Aug 11
-
12 Apr 11
-
If renaming is done without a previous discussion, people are lost, bug report are difficult to track and google will help less.
-
-
28 Jan 11
-
06 Jan 10
-
07 May 09
aminggs"The number one thing I want from a distributed version control system is robust renaming. Why is that? Because without a rigorous approach to renaming that guarantees perfect results, I’m nervous to merge from someone I don’t know. And merging from “peop
document article blog mark-shuttleworth dvcs scm bazaar bzr inlink:eric-sink import:delicious
-
02 Apr 09
-
22 Feb 09
W.W. WebsterBazar, Mercurial, Git, Subversion, CVS, DARCS, Monotone
Be sure to read the responses. -
01 Oct 08
-
You don’t want to have to dump a whole lot of rules to new contributors like “never rename directories a, b and c because you will break other people and we will be upset”. You want those new contributors to have complete freedom, and then you want to be able to merge, review changes, and commit if you like them. If merging from someone might drop you into a nightmare of renaming fixups, you will be resistant to it, and your community will not be as widely empowered.
-
Keep playing with this. Sooner or later, if you are not using a system like Bzr which treats renames as a first class operation… Oops.
-
If I look at the biggest free software projects, the thing they all have in common is crufty tree structures (directory layouts) and build systems. This is partly a result of never having had tools which really supported renaming, in a way which Would Not Break.
-
The exact details of what it takes to break the renaming support of many DVCS’s vary from implementation to implementation. But by far the most robust of them is Bzr at the moment, which is why we make such heavy use of it at Ubuntu.
-
’ll gladly accept the extra 0.3 seconds it takes Bzr to give me a tree status in my 5,100 file project, for the security of knowing I never ever have to spend long periods of time sorting out a merge by hand when stuff got renamed.
-
GIT is an excellent system that does a very specific job. It does not track renames as a first class operation, but does a reasonable job of guessing in simple cases. However, if you want to do real reshaping of your tree, that guessing can hit limits quickly. Git is very good in projects like the kernel which don’t rename stuff and need the speed, and also are UNIX-specific (Git is quite difficult to get to work on Windows, as I understand it).
-
Instead of taking real projects, I’ve written a simple test case in a form of a bash script. It simulates two developers, one renaming a directory and second adding a file to it. I’ve tested it with Bazaar, Git and Subversion. You were right, only Bazaar handled it in the way we would expect an SCM to behave. Git didn’t move the new file to a new directory, merge ended up with two separate directories. Subversion was worse, discarding the added file altogether.
-
The Hg team, like the Git team, have just decided that renaming is not important enough that it needs to be tracked explicitly. So when you rename a file using Hg, it is internally represented as a delete and an add. Later, when you merge across branches where this happens, Hg does a (very good) job of guessing what to do. But that guessing process, while it handles obvious cases well, is likely to break down as directories, and subdirectories, get moved around. It’s easy to show it break, but it’s not my aim here to actually demonstrate a failing in any other project. And any individual use case can be fixed with better guessing - the problem is that on big projects, over time, you will see the use cases get increasingly baroque.
-
So, to be clear, I don’t think there’s anything wrong with Hg, it’s a great tool that is best for certain use cases, but I also don’t think it handles renames in a way that is healthy for projects which want to do real surgery on the shape of their tree. And on this import of the Linux kernel tree, on my laptop, trunk-Bzr does “status” in 1.4 seconds, while Hg 0.9.3 (not the latest trunk which is probably faster) does it in 1.3 seconds. Granted, commit is much faster with Hg currently, but the Bzr team have not done any optimisation on commit, they are focused on status because that’s what everyone does all the time. And 0.1 seconds is not worth the lossiness of guesstimated renames. This is 23,000 files.
-
Mercurial does a remove and a add, but it stores the pointer to the last version of the previous file during the add. So there is no information lost.
-
GIT even tells you where parts of a file came from, which nobody else can do.
-
This is a very strong point for renaming, but it is not necessarily an universal one.
Here is one example of the issue: one developer renaming a directory in his branch, and another adding a file to the original directory in his branch. What happens at the merge ?
- Bazaar renames the directory and puts the new file in the _renamed_ directory.
- Git renames the directory with its files, but keeps the old directory too and adds the new file there.Bazaar’s behavior certainly is better for C. However it is not universally better.
For example in Java you cannot rename a file without changing its contents. So, moving a file to a directory different from where its author put it will almost certainly break the build.
The bottom line is, both behaviors can seem valid or broken, depending on the case. Neither is perfect. At the very abstract level file renames are _not_ a first-class operation. This is especially apparent in a language like Java.
Content movement is the first class operation. Things like moving functions, etc. The question is how one can handle that and whether the current strategy has a path for improvement. It could be argued that once you commit yourself to explicitly tracking file renames, you are giving up a slew of opportunities for handling the more general cases.
One thing is for certain, a 100% ideal solution is impossible. It would have to be aware of the target programming language _and_ the build environment.
-
Now now, Mark, no misleading assertions if you please. Mercurial tracks renaming information perfectly. It implements it in a different way than Bazaar, but in fact the technique that it uses is more general than Bazaar’s approach.
As you know, Bazaar requires a file to have a unique identity. If I rename A to B, and you rename A to C, the only possible outcome when we merge is a conflict that results in either B or C, because Bazaar requires there to be a single file afterwards. However, Mercurial reports the possible conflict to you *and* is perfectly okay if you decide that the appropriate response is to keep either one, *or* to preserve *both* B and C.
In the book, I mention a bug (455) with this handling which has subsequently been fixed. I’ve not had a chance to update the book with the current behaviour, but I want to note the fact that it’s fixed here.
Mark Shuttleworth says:
Now now Bos, don’t cry FUD when all you’re getting is constructive criticism! I like Hg, but I think it’s important to version directories like files, because I think this gives the result most people actually expect. I wouldn’t call renaming support “perfect” unless it clearly included support for renaming directories. The principle of least surprise is important, and I think Bazaar best reflects that. Giving everyone an A, B, and C option when most people really expect A is cute but ultimately makes the tool harder to use. As for your example, in neither case did either developer ADD a file, in both cases they renamed the same file, so it seems odd to think that ending up with TWO files is an expected result. I don’t think a limitation of a tool should be sold as a feature

-
-
10 Apr 08
-
12 Dec 07
-
14 Oct 07
Chris LasherFirst post in a series by Shuttleworth on DSCMs. See the exchange of comments with Bryan O'Sullivan, a main developer of Mercurial.
bazaar blog cvs dscm for:abml for:farcepest for:gamezace for:guardian72 for:gvwilson for:jewdan for:ramblurr for:third git mercurial scm shuttleworth softwarecarpentry subversion
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.