phases: add killswitch for native implementation
authorLaurent Charignon <lcharignon@fb.com>
Mon, 30 Mar 2015 12:57:55 -0700
changeset 24520 34e8bfc21f94
parent 24519 de3acfabaddc
child 24521 489026bffbf6
phases: add killswitch for native implementation
mercurial/phases.py
tests/test-phases.t
--- a/mercurial/phases.py	Mon Mar 30 12:48:15 2015 -0700
+++ b/mercurial/phases.py	Mon Mar 30 12:57:55 2015 -0700
@@ -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
--- a/tests/test-phases.t	Mon Mar 30 12:48:15 2015 -0700
+++ b/tests/test-phases.t	Mon Mar 30 12:57:55 2015 -0700
@@ -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