[PATCH 1 of 3 STABLE] py3: compare response of crecord's confirmationwindow with str

Denis Laxalde denis at laxalde.org
Wed Nov 6 16:23:27 UTC 2019


# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1573056733 -3600
#      Wed Nov 06 17:12:13 2019 +0100
# Branch stable
# Node ID ae3e67359e0bf045ae1bb797d8f4e043fa55042b
# Parent  be384a2052aa864733b3f75c357bb2bc7cd42ae4
py3: compare response of crecord's confirmationwindow with str

confirmationwindow() returns a native string, as a result of calling
chr() on getch(). On Python 3, response.lower().startswith(b"y") leads
to a TypeError.

This fixes a crash when typing "r" in the curses interface of
interactive commit.

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -1741,8 +1741,8 @@ are you sure you want to review/edit and
         with self.ui.timeblockedsection(b'crecord'):
             response = self.confirmationwindow(confirmtext)
         if response is None:
-            response = b"n"
-        if response.lower().startswith(b"y"):
+            response = "n"
+        if response.lower().startswith("y"):
             return True
         else:
             return False


More information about the Mercurial-devel mailing list