[PATCH] memctx: explicitly set substate to None

Sean Farley sean.michael.farley at gmail.com
Wed Jul 2 15:30:02 CDT 2014


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1404332683 18000
#      Wed Jul 02 15:24:43 2014 -0500
# Node ID 13b258b21a9a2f2b37afc3f86f6d7d27b5128632
# Parent  61b333b982ea7baab198a188306fc05fb2850179
memctx: explicitly set substate to None

In d2743be1bb06, memctx was changed to inherit from committablectx, this in
turn added the 'substate' property to memctx. It turns out that the
newcommitphase method tested for this property:

  def newcommitphase(ui, ctx):
      commitphase = phases.newcommitphase(ui)
      substate = getattr(ctx, "substate", None)
      if not substate:
          return commitphase

Currently, memctx isn't ready to handle substates, nor removed files, so we
explicitly must set substate=None to get the old behavior back. In the future,
we can decide how memctx should play with substate. For now, this fixes
third-party extensions and some internal code dealing with subrepos.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1569,10 +1569,11 @@ class memctx(committablectx):
         p1, p2 = parents
         self._parents = [changectx(self._repo, p) for p in (p1, p2)]
         files = sorted(set(files))
         self._status = [files, [], [], [], []]
         self._filectxfn = filectxfn
+        self.substate = None
 
         self._extra = extra and extra.copy() or {}
         if self._extra.get('branch', '') == '':
             self._extra['branch'] = 'default'
 


More information about the Mercurial-devel mailing list