RFC: Pluggable merge support

Adrian Wilkins adrian.wilkins at gmail.com
Wed Sep 10 13:34:01 BST 2008

What I'd basically like is for there to be sufficient hooks to support
the following.

My personal use case (always scratch your own itches!):

 - The working tree contains around 3400 UML model files in a
proprietary format (Borland Together for Eclipse).
 - In this format
   - Most useful data is in properties, e.g.
	<property name='one' value='two'/>
   - The order of properties is LELO (last edited, last out - edit one
and it moves to the end of the list).
   - The documentation is HTML, linebreaks removed, and pushed into a
property, so regardless of how many lines it presents as, it's one line
in the model.

The majority of changes to the working tree are to documentation in
model elements. Multiple branches are maintained concurrently. Branches
must first merge revisions FROM trunk before merging TO trunk.

Because the documentation is all on one line, if two people edit docs on
the same model item, it's ALWAYS a conflict.

The current way of resolving this ; human edits of the documentation
property are too painful, what with all the escaped chars and kilobytes
of text on one line. So the tool which converted all this from the old
format (annotated Java sourcecode), has been updated to provide an
unpack/repack feature. This takes the documentation, runs it through
Tidy, and rewrites the property as an element containing a CDATA
section. Not WYSIWYG, but much better.

My favourite GUI merge tool has support for conversion steps on load and
save, so it now spots this variety of file and seamlessy does the
unpack/repack cycle. A lot of the conflicts are not really conflicts -
they are edits to distant parts of the HTML which have been forced
together on one line by the modelling too. You can resolve these
semi-automatically by clicking "save" in the merge tool. There is an
automatic mode also available.

My users are resolving these conflicts with a patched gconflicts window,
starting this tool.

It would save them some time if I could hook the merge process. At the
minimum, a hook to pass failed merges to a secondary merge processor
(replacement for Merge3?) would suit me. I'm sure other hooks here might
be useful.

I've thought about it in the past but never really managed to dig far
enough into the code to understand how best to do it, so I'm throwing it
out here for people with more comprehension to chew on.

More information about the bazaar mailing list