changeset 23654:9d56be47b5d6

merge: create 'cm' action for 'get or merge' case We still have one case of a call to _checkunknownfile() in manifestmerge(): when force=True and branchmerge=True and the remote side has a file that the local side doesn't. This combination of arguments is used by 'hg merge --force', but also by rebase and unshelve. In this scenario, we try to create the file from the contents from the remote, but if there is already a local untracked file in place, we merge it instead.
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 15 Dec 2014 16:45:19 -0800
parents 0297d8469350
children 79235b46062c
files mercurial/merge.py
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Fri Dec 12 23:18:36 2014 -0800
+++ b/mercurial/merge.py	Mon Dec 15 16:45:19 2014 -0800
@@ -501,12 +501,8 @@
                 elif not branchmerge:
                     actions[f] = ('c', (fl2,), "remote created")
                 else:
-                    different = _checkunknownfile(repo, wctx, p2, f)
-                    if different:
-                        actions[f] = ('m', (f, f, None, False, pa.node()),
-                                      "remote differs from untracked local")
-                    else:
-                        actions[f] = ('g', (fl2,), "remote created")
+                    actions[f] = ('cm', (fl2, pa.node()),
+                                  "remote created, get or merge")
             elif n2 != ma[f]:
                 if acceptremote:
                     actions[f] = ('c', (fl2,), "remote recreating")
@@ -532,6 +528,14 @@
     for f, (m, args, msg) in actions.iteritems():
         if m == 'c':
             actions[f] = ('g', args, msg)
+        elif m == 'cm':
+            fl2, anc = args
+            different = _checkunknownfile(repo, wctx, p2, f)
+            if different:
+                actions[f] = ('m', (f, f, None, False, anc),
+                              "remote differs from untracked local")
+            else:
+                actions[f] = ('g', (fl2,), "remote created")
 
     return actions, diverge, renamedelete