[PATCH] pushkey: use False/True for return values from push functions

Martin von Zweigbergk martinvonz at google.com
Tue Jun 13 15:53:12 UTC 2017


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1497310557 25200
#      Mon Jun 12 16:35:57 2017 -0700
# Node ID 984cdd0844fecb6c56d570236b03c999c4d485cf
# Parent  f40eec7af04416521543b284fc6fa5365dbef611
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

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -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:
diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -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


More information about the Mercurial-devel mailing list