dummy merge (two branches) for dummies

Kevin Bullock kbullock+mercurial at ringworld.org
Fri Aug 19 16:36:59 UTC 2016


> On Aug 19, 2016, at 10:44, Uwe Brauer <oub at mat.ucm.es> wrote:
> 
>> ...except it's not quite true. Example 1 would _also_ keep any
>> non-overlapping changes from 'uwe' in files that also existed in
>> 'foo'.
> 
> I am not sure I understand this. I don't see this is in example 1. Can
> you give me an example?

Actually I misspoke slightly: when you specify a merge tool, that tool is invoked for all files that were modified on both sides of the merge. But importantly, the merge tool _doesn't_ get invoked for files that existed in the ancestor, but only changed on one side:

$ hg init dummy-merge
$ cd dummy-merge/

# Create an ancestor change with 2 known files
$ echo a > a
$ echo b > b
$ hg ci -Am0
adding a
adding b

# Change one file and commit
$ echo a >> a
$ hg ci -m1

# Go back to the ancestor, change the other file and commit
$ hg up 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo b >> b
$ hg ci -m2
created new head

# Merge, keeping "only" local changes
$ hg merge -t internal:local 1
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)

# Whoops, we accidentally brought in the changes to a!
$ hg di
diff --git a/a b/a
--- a/a
+++ b/a
@@ -1,1 +1,2 @@
 a
+a

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock




More information about the Mercurial mailing list