Search code examples
gitversion-controldvcsbazaar

How do DVCSs (DRCSs) work?


I have been hearing a lot of good things about DVCS systems, in particular about bazaar. Apart from the concept of distributed repository, I see two main advantages being touted: the merge is better automated, and the rename is handled right.

Could someone please point me at some text explaining how exactly the improvements work? How does bazaar know that I renamed a file? What if I rename two files as part of the same commit? What happens when I refactor by putting half of the file's contents into a new file, re-indenting everything and losing some whitespace in nearly every line?

In other words, I'd like to hear from people using bazaar (or another DVCS) in real life, or from people who know how it (they) works. Is the merge really that much better? And how is it achieved?


Related question, with a useful answer:

Why is branching and merging easier in Mercurial than in Subversion?


Solution

  • Merge is not intrinsically better in DVCS, it is just that they would be practically very difficult to use if the branch/merge did not work correctly (svn arguably does not implement branching/merging correctly), because instead of making a checkout, you are making a new branch everytime you start working on a project from an existing code. I think some proprietary, centralized SCS do handle merge/branch correctly.

    The way it works for all of them is to record every commit in a Directly Acyclic Graph (DAG), and from this, you have different merge strategies available. Here you can find more information:

    http://revctrl.org/CategoryMergeAlgorithm

    At least hg, bzr and git can use external merge utilities.