Mercurial > public > mercurial-scm > hg-stable
diff mercurial/merge.py @ 23397:c7c95838be9a
merge: break out "both renamed a -> b" case
We can further limit the scope of the 2-way merge case by breaking out
the case where the file was not created from scratch on both sides but
rather renamed in the same way (and is therefore a 3-way merge). This
involves copying some code, but it makes it clearer which case the
"Note:" in the code refers to.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 24 Nov 2014 16:42:36 -0800 |
parents | 6a254a2dd37c |
children | 9da5a7413eb8 |
line wrap: on
line diff
--- a/mercurial/merge.py Mon Nov 24 16:16:34 2014 -0800 +++ b/mercurial/merge.py Mon Nov 24 16:42:36 2014 -0800 @@ -416,11 +416,15 @@ continue if n1 and n2: if f not in ma: - # Note: f as ancestor is wrong - we can't really make a 3-way - # merge without an ancestor file. - fa = copy.get(f, f) - actions['m'].append((f, (f, f, fa, False, pa.node()), - "both created")) + fa = copy.get(f, None) + if fa is not None: + actions['m'].append((f, (f, f, fa, False, pa.node()), + "both renamed from " + fa)) + else: + # Note: f as ancestor is wrong - we can't really make a + # 3-way merge without an ancestor file. + actions['m'].append((f, (f, f, f, False, pa.node()), + "both created")) else: a = ma[f] fla = ma.flags(f)