[PATCH 2 of 2] phases: add killswitch for native implementation

Laurent Charignon lcharignon at fb.com
Mon Mar 30 15:04:24 CDT 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1427745475 25200
#      Mon Mar 30 12:57:55 2015 -0700
# Node ID 4550c9cc72073e164987d8eb057fe8f46cd85dbb
# Parent  84c46e062e718bc988af0aba11651c2c974c5d30
phases: add killswitch for native implementation

diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -195,7 +195,11 @@
     def getphaserevs(self, repo):
         if self._phaserevs is None:
             try:
-                self._phaserevs = self.getphaserevsnative(repo)
+                if repo.ui.configbool('experimental',
+                                      'nativephaseskillswitch'):
+                    self.computephaserevspure(repo)
+                else:
+                    self._phaserevs = self.getphaserevsnative(repo)
             except AttributeError:
                 self.computephaserevspure(repo)
         return self._phaserevs
diff --git a/tests/test-phases.t b/tests/test-phases.t
--- a/tests/test-phases.t
+++ b/tests/test-phases.t
@@ -456,8 +456,12 @@
   o  0 public A
   
 
-move changeset forward and backward
+move changeset forward and backward and test kill switch
 
+  $ cat <<EOF >> $HGRCPATH
+  > [experimental]
+  > nativephaseskillswitch = true
+  > EOF
   $ hg phase --draft --force 1::4
   $ hg log -G --template "{rev} {phase} {desc}\n"
   @    7 secret merge B' and E
@@ -478,6 +482,10 @@
   
 test partial failure
 
+  $ cat <<EOF >> $HGRCPATH
+  > [experimental]
+  > nativephaseskillswitch = false
+  > EOF
   $ hg phase --public 7
   $ hg phase --draft '5 or 7'
   cannot move 1 changesets to a higher phase, use --force


More information about the Mercurial-devel mailing list