diff mercurial/copies.py @ 8527:f9a80054dd3c

use 'x is None' instead of 'x == None' The built-in None object is a singleton and it is therefore safe to compare memory addresses with is. It is also faster, how much depends on the object being compared. For a simple type like str I get: | s = "foo" | s = None ----------+-----------+---------- s == None | 0.25 usec | 0.21 usec s is None | 0.17 usec | 0.17 usec
author Martin Geisler <mg@lazybytes.net>
date Wed, 20 May 2009 00:52:46 +0200
parents b35d11d10646
children 3f56055ff1d7 431462bd8478
line wrap: on
line diff
--- a/mercurial/copies.py	Wed May 20 00:43:23 2009 +0200
+++ b/mercurial/copies.py	Wed May 20 00:52:46 2009 +0200
@@ -106,7 +106,7 @@
         return {}, {}
 
     # avoid silly behavior for parent -> working dir
-    if c2.node() == None and c1.node() == repo.dirstate.parents()[0]:
+    if c2.node() is None and c1.node() == repo.dirstate.parents()[0]:
         return repo.dirstate.copies(), {}
 
     limit = _findlimit(repo, c1.rev(), c2.rev())