pushkey: use False/True for return values from push functions
authorMartin von Zweigbergk <martinvonz@google.com>
Mon, 12 Jun 2017 16:35:57 -0700
changeset 32841 e65ff29dbeb0
parent 32840 9b7d615108d7
child 32842 cb48dfd9672d
pushkey: use False/True for return values from push functions It was particularly unclear in phases.pushphase() whether the 0/1 returned were the 0/1 for public/draft phase or for False/True
mercurial/obsolete.py
mercurial/phases.py
--- a/mercurial/obsolete.py	Fri Apr 10 00:14:16 2015 +0900
+++ b/mercurial/obsolete.py	Mon Jun 12 16:35:57 2017 -0700
@@ -944,10 +944,10 @@
     """Push markers over pushkey"""
     if not key.startswith('dump'):
         repo.ui.warn(_('unknown key: %r') % key)
-        return 0
+        return False
     if old:
         repo.ui.warn(_('unexpected old value for %r') % key)
-        return 0
+        return False
     data = util.b85decode(new)
     lock = repo.lock()
     try:
@@ -956,7 +956,7 @@
             repo.obsstore.mergemarkers(tr, data)
             repo.invalidatevolatilesets()
             tr.close()
-            return 1
+            return True
         finally:
             tr.release()
     finally:
--- a/mercurial/phases.py	Fri Apr 10 00:14:16 2015 +0900
+++ b/mercurial/phases.py	Mon Jun 12 16:35:57 2017 -0700
@@ -423,12 +423,12 @@
         if currentphase == oldphase and newphase < oldphase:
             with repo.transaction('pushkey-phase') as tr:
                 advanceboundary(repo, tr, newphase, [bin(nhex)])
-            return 1
+            return True
         elif currentphase == newphase:
             # raced, but got correct result
-            return 1
+            return True
         else:
-            return 0
+            return False
 
 def analyzeremotephases(repo, subset, roots):
     """Compute phases heads and root in a subset of node from root dict