[PATCH 2 of 3] merge: support calculating merge actions against non-working contexts

David Schleimer dschleimer at fb.com
Mon Nov 19 14:01:46 CST 2012


# HG changeset patch
# User David Schleimer <dschleimer at fb.com>
# Date 1353354269 28800
# Node ID a77f8405c800c27ba5cb97b7482410c6438c81c8
# Parent  00935315e74e18a54a7f8ba0bbfde6265982046e
merge: support calculating merge actions against non-working contexts

This is not currently used.  It is instead a pre-requisite to
performing non-conflicting grafts in memory, which a subsequent patch
will do.

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -7,7 +7,7 @@
 
 from node import nullid, nullrev, hex, bin
 from i18n import _
-import error, scmutil, util, filemerge, copies, subrepo
+import error, scmutil, util, filemerge, copies, subrepo, context
 import errno, os, shutil
 
 class mergestate(object):
@@ -455,13 +455,15 @@
     if folding:
         # collision check is not needed for clean update
         if (not branchmerge and
-            (force or not tctx.dirty(missing=True, branch=False))):
+            (force or (isinstance(tctx, context.workingctx) and
+                       not tctx.dirty(missing=True, branch=False)))):
             _checkcollision(mctx, None)
         else:
             _checkcollision(mctx, tctx)
     if not force:
         _checkunknown(repo, tctx, mctx)
-    action += _forgetremoved(tctx, mctx, branchmerge)
+    if isinstance(tctx, context.workingctx):
+        action += _forgetremoved(tctx, mctx, branchmerge)
     action += manifestmerge(repo, tctx, mctx,
                             ancestor,
                             force and not branchmerge,


More information about the Mercurial-devel mailing list