changeset 9391:2705e6816d33

use 'x in dict' instead of 'dict.has_key(x)' "in" is faster, and has_key will be removed in py3k
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Mon, 24 Aug 2009 21:00:34 +0200
parents 637f2726ec7f
children 039bce1b505f
files hgext/convert/gnuarch.py hgext/win32mbcs.py mercurial/commands.py
diffstat 3 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/gnuarch.py	Wed Aug 26 13:07:27 2009 +0200
+++ b/hgext/convert/gnuarch.py	Mon Aug 24 21:00:34 2009 +0200
@@ -284,7 +284,7 @@
             self.changes[rev].summary = self.recode(self.changes[rev].summary)
 
             # Commit revision origin when dealing with a branch or tag
-            if catlog.has_key('Continuation-of'):
+            if 'Continuation-of' in catlog:
                 self.changes[rev].continuationof = self.recode(catlog['Continuation-of'])
         except Exception:
             raise util.Abort(_('could not parse cat-log of %s') % rev)
--- a/hgext/win32mbcs.py	Wed Aug 26 13:07:27 2009 +0200
+++ b/hgext/win32mbcs.py	Mon Aug 24 21:00:34 2009 +0200
@@ -101,7 +101,7 @@
     if args:
         args = list(args)
         args[0] = appendsep(args[0])
-    if kwds.has_key('path'):
+    if 'path' in kwds:
         kwds['path'] = appendsep(kwds['path'])
     return func(*args, **kwds)
 
--- a/mercurial/commands.py	Wed Aug 26 13:07:27 2009 +0200
+++ b/mercurial/commands.py	Mon Aug 24 21:00:34 2009 +0200
@@ -1323,11 +1323,11 @@
                     continue
                 files.append(fn)
 
-                if not matches[rev].has_key(fn):
+                if fn not in matches[rev]:
                     grepbody(fn, rev, flog.read(fnode))
 
                 pfn = copy or fn
-                if not matches[parent].has_key(pfn):
+                if pfn not in matches[parent]:
                     try:
                         fnode = pctx.filenode(pfn)
                         grepbody(pfn, parent, flog.read(fnode))