git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jelle van der Waa <jelle@vdwaa.nl>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	Todd Zullinger <tmz@pobox.com>,
	Jelle van der Waa <jelle@vdwaa.nl>
Subject: [PATCH 2/3] contrib: hg-to-git: has_key is removed in Python 3
Date: Mon,  1 Apr 2019 20:52:07 +0200	[thread overview]
Message-ID: <20190401185208.17031-3-jelle@vdwaa.nl> (raw)
In-Reply-To: <20190401185208.17031-1-jelle@vdwaa.nl>

From: Jelle van der Waa <jelle@vdwaa.nl>

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@vdwaa.nl>
---
 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


  parent reply	other threads:[~2019-04-01 18:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-01 18:52 [PATCH 0/3] Make hg-to-git contrib script Python 3 compatible Jelle van der Waa
2019-04-01 18:52 ` [PATCH 1/3] contrib: hg-to-git: make print python " Jelle van der Waa
2019-04-01 18:52 ` Jelle van der Waa [this message]
2019-04-01 18:52 ` [PATCH 3/3] contrib: hg-to-git: convert data to bytes for os.write Jelle van der Waa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190401185208.17031-3-jelle@vdwaa.nl \
    --to=jelle@vdwaa.nl \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=tmz@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).