git: pass the correct type to the sqlite3 query for baselog.hasnode() stable
authorMatt Harbison <matt_harbison@yahoo.com>
Tue, 27 Apr 2021 17:54:08 -0400
branchstable
changeset 47050 ce24a00fe7f0
parent 47049 2a77c817d451
child 47051 de26b9a7ec29
git: pass the correct type to the sqlite3 query for baselog.hasnode() It looks like this function is mostly used in exchange (which isn't supported now) and histedit (which crashes). But I did verify in a REPL that passing bytes to `db.execute()` fails to find the row, whereas passing str works. Differential Revision: https://phab.mercurial-scm.org/D10526
hgext/git/gitlog.py
--- a/hgext/git/gitlog.py	Tue Apr 27 17:11:55 2021 -0400
+++ b/hgext/git/gitlog.py	Tue Apr 27 17:54:08 2021 -0400
@@ -68,7 +68,8 @@
 
     def hasnode(self, n):
         t = self._db.execute(
-            'SELECT node FROM changelog WHERE node = ?', (n,)
+            'SELECT node FROM changelog WHERE node = ?',
+            (pycompat.sysstr(n),),
         ).fetchone()
         return t is not None