Patchwork memctx: explicitly set substate to None

login
register
mail settings
Submitter Sean Farley
Date July 2, 2014, 8:30 p.m.
Message ID <13b258b21a9a2f2b37af.1404333002@laptop.local>
Download mbox | patch
Permalink /patch/5092/
State Accepted
Commit 7cfd94ec5d30a4da29700466024c62c51565c372
Headers show

Comments

Sean Farley - July 2, 2014, 8:30 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@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.

Patch

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'