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

login
register
mail settings
Submitter Denis Laxalde
Date Nov. 6, 2019, 4:23 p.m.
Message ID <ae3e67359e0bf045ae1b.1573057407@steppe.local>
Download mbox | patch
Permalink /patch/42805/
State New
Headers show

Comments

Denis Laxalde - Nov. 6, 2019, 4:23 p.m.
# HG changeset patch
# User Denis Laxalde <denis.laxalde@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.

Patch

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