changeset 23650:b85c548ab14d

merge: introduce 'c' action like 'g', but with additional safety _checkunknownfile() reads the filelog of the remote side's file. For narrow clones, the filelog will not exist for all files and we need a way to avoid reading them. While it would be easier for the narrow extension to just override _checkunknownfile() and make it ignore files outside the narrow clone, it seems cleaner to have manifestmerge() not care about filelogs (considering its name). In order to move the calls to _checkunknownfile() out, we need to be able to tell in which cases we should check for unknown files. Let's start by introducing a new action distinct from 'g' for this purpose. Specifically, the new action will be just like 'g' except that it will check that for conflicting unknown files first. For now, just add the new action type and convert it to 'g'.
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 19 Nov 2014 11:48:30 -0800
parents 18ab5e5955df
children 72da02d7f126
files mercurial/merge.py
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Wed Nov 19 11:44:00 2014 -0800
+++ b/mercurial/merge.py	Wed Nov 19 11:48:30 2014 -0800
@@ -488,10 +488,10 @@
                 # following table:
                 #
                 # force  branchmerge  different  |  action
-                #   n         *           n      |    get
+                #   n         *           n      |   create
                 #   n         *           y      |   abort
-                #   y         n           *      |    get
-                #   y         y           n      |    get
+                #   y         n           *      |   create
+                #   y         y           n      |   create
                 #   y         y           y      |   merge
                 #
                 # Checking whether the files are different is expensive, so we
@@ -501,9 +501,9 @@
                     if different:
                         aborts.append((f, "ud"))
                     else:
-                        actions[f] = ('g', (fl2,), "remote created")
+                        actions[f] = ('c', (fl2,), "remote created")
                 elif not branchmerge:
-                    actions[f] = ('g', (fl2,), "remote created")
+                    actions[f] = ('c', (fl2,), "remote created")
                 else:
                     different = _checkunknownfile(repo, wctx, p2, f)
                     if different:
@@ -517,7 +517,7 @@
                     aborts.append((f, 'ud'))
                 else:
                     if acceptremote:
-                        actions[f] = ('g', (fl2,), "remote recreating")
+                        actions[f] = ('c', (fl2,), "remote recreating")
                     else:
                         actions[f] = ('dc', (fl2,), "prompt deleted/changed")
 
@@ -529,6 +529,10 @@
         raise util.Abort(_("untracked files in working directory differ "
                            "from files in requested revision"))
 
+    for f, (m, args, msg) in actions.iteritems():
+        if m == 'c':
+            actions[f] = ('g', args, msg)
+
     return actions, diverge, renamedelete
 
 def _resolvetrivial(repo, wctx, mctx, ancestor, actions):