Patchwork D10521: git: fix partial node matching

login
register
mail settings
Submitter phabricator
Date April 28, 2021, 3:08 p.m.
Message ID <differential-rev-PHID-DREV-qrkezhegkgfd7z3xwdsf-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48840/
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
  Looks like everything is meant to be a str here.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  hgext/git/gitlog.py
  tests/test-git-interop.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-git-interop.t b/tests/test-git-interop.t
--- a/tests/test-git-interop.t
+++ b/tests/test-git-interop.t
@@ -271,6 +271,20 @@ 
   $ hg log -r ae1ab744f95bfd5b07cf573baef98a778058537b --template "{shortest(node,1)}\n"
   ae
 
+This covers gitlog._partialmatch()
+  $ hg log -r a
+  abort: ambiguous revision identifier: a
+  [10]
+  $ hg log -r a1
+  changeset:   2:a1983dd7fb19
+  user:        test <test>
+  date:        Fri Mar 06 14:26:27 2020 -0500
+  summary:     more alpha
+  
+  $ hg log -r dead
+  abort: unknown revision 'dead'
+  [255]
+
 This coveres changelog.findmissing()
   $ hg merge --preview 3d9be8deba43
 
diff --git a/hgext/git/gitlog.py b/hgext/git/gitlog.py
--- a/hgext/git/gitlog.py
+++ b/hgext/git/gitlog.py
@@ -168,7 +168,8 @@ 
         candidates = [
             bin(x[0])
             for x in self._db.execute(
-                'SELECT node FROM changelog WHERE node LIKE ?', (id + b'%',)
+                'SELECT node FROM changelog WHERE node LIKE ?',
+                (pycompat.sysstr(id + b'%'),),
             )
         ]
         if nullhex.startswith(id):