[PATCH 1 of 8] rebase: explicitly tests for None

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Mar 16 11:28:05 UTC 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1489615423 25200
#      Wed Mar 15 15:03:43 2017 -0700
# Node ID 6c6d8c0cc67de1ecd744a30889419510aa2064d2
# Parent  361bccce566afe250c8d258f770a908713b2d13f
# EXP-Topic mutable-default
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 6c6d8c0cc67d
rebase: explicitly tests for None

Changeset 361bccce566a removed the mutable default value, but did not explicitly
tested for None. Such implicit checking can introduce semantic and performance
issue. We move to an explicit check for None as recommended by PEP8:

https://www.python.org/dev/peps/pep-0008/#programming-recommendations

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -725,7 +725,8 @@ def _definesets(ui, repo, destf=None, sr
                 destspace=None):
     """use revisions argument to define destination and rebase set
     """
-    revf = revf or []
+    if revf is None:
+        revf = []
 
     # destspace is here to work around issues with `hg pull --rebase` see
     # issue5214 for details


More information about the Mercurial-devel mailing list