Patchwork D10526: git: pass the correct type to the sqlite3 query for baselog.hasnode()

login
register
mail settings
Submitter phabricator
Date April 28, 2021, 3:08 p.m.
Message ID <differential-rev-PHID-DREV-6xhqg7wus6lbnnnuy745-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48846/
State Superseded
Headers show

Comments

phabricator - April 28, 2021, 3:08 p.m.
mharbison72 created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
pulkit accepted this revision.
This revision is now accepted and ready to land.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D10526

AFFECTED FILES
  hgext/git/gitlog.py

CHANGE DETAILS




To: mharbison72, durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/hgext/git/gitlog.py b/hgext/git/gitlog.py
--- a/hgext/git/gitlog.py
+++ b/hgext/git/gitlog.py
@@ -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