mq: explicitly tests for None
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Wed, 15 Mar 2017 15:05:54 -0700
changeset 31432 6e1c79578e5c
parent 31431 406705701c2d
child 31433 7aac35ada1cb
mq: explicitly tests for None Changeset fd3d8eb7f545 removed the mutable default value, but did not explicitly tested for None. Such implicit testing can introduce semantic and performance issue. We move to an explicit testing for None as recommended by PEP8: https://www.python.org/dev/peps/pep-0008/#programming-recommendations
hgext/mq.py
--- a/hgext/mq.py	Wed Mar 15 15:03:43 2017 -0700
+++ b/hgext/mq.py	Wed Mar 15 15:05:54 2017 -0700
@@ -722,7 +722,8 @@
 
     def printdiff(self, repo, diffopts, node1, node2=None, files=None,
                   fp=None, changes=None, opts=None):
-        opts = opts or {}
+        if opts is None:
+            opts = {}
         stat = opts.get('stat')
         m = scmutil.match(repo[node1], files, opts)
         cmdutil.diffordiffstat(self.ui, repo, diffopts, node1, node2,  m,