Merge Integration with Mercurial
Merge can be configured as a merge tool for Mercurial (Hg), replacing Mercurial's built-in merge for XML files.
Configuration
Step 1: Add the merge tool to .hgrc
Edit your global Mercurial configuration (~/.hgrc on Unix or mercurial.ini on Windows):
[merge-tools]
deltanova-merge.executable = java
deltanova-merge.args = -jar /path/to/deltanova-x.y.z.jar merge concurrent \
ancestor $base local $local remote $other result.xml && \
cp result.xml $local
deltanova-merge.checkchanged = True
deltanova-merge.binary = False
Step 2: Associate file patterns with the merge tool
[merge-patterns]
**.xml = deltanova-merge
**.dita = deltanova-merge
**.ditamap = deltanova-merge
Mercurial Merge Variables
|
Variable |
Description |
|---|---|
|
|
Path to the common ancestor version |
|
|
Path to the local (current branch) version |
|
|
Path to the other (merging) version |
How It Works
When Mercurial merges an XML file:
-
Mercurial calls the configured merge tool with the ancestor, local, and other versions.
-
Merge performs a concurrent merge.
-
The result is written back to
$local. -
Mercurial checks the exit code; a non-zero exit indicates a conflict.
Notes
-
Ensure the path to the Merge JAR is absolute in the configuration.
-
The
checkchanged = Truesetting tells Mercurial to check whether the merge tool modified the file, which is required for correct conflict detection.