Web lists-archives.com

[PATCH 2/3] contrib: hg-to-git: has_key is removed in Python 3




From: Jelle van der Waa <jelle@xxxxxxxx>

has_key was deprecated in Python 2 and finally removed in Python 3 in
favor of 'foo' in bar.

Signed-off-by: Jelle van der Waa <jelle@xxxxxxxx>
---
 contrib/hg-to-git/hg-to-git.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/hg-to-git/hg-to-git.py b/contrib/hg-to-git/hg-to-git.py
index f898d6f23e..d504624c63 100755
--- a/contrib/hg-to-git/hg-to-git.py
+++ b/contrib/hg-to-git/hg-to-git.py
@@ -155,7 +155,7 @@ def getgitenv(user, date):
         else:
             hgbranch[str(cset)] = "branch-" + str(cset)
 
-if not hgvers.has_key("0"):
+if "0" not in hgvers:
     print('creating repository')
     os.system('git init')
 
@@ -163,7 +163,7 @@ def getgitenv(user, date):
 for cset in range(int(tip) + 1):
 
     # incremental, already seen
-    if hgvers.has_key(str(cset)):
+    if str(cset) in hgvers:
         continue
     hgnewcsets += 1
 
-- 
2.21.0