D5113: revisions: when using prefixhexnode, ensure we prefix "0"

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Oct 17 19:43:19 EDT 2018


martinvonz accepted this revision.
martinvonz added a comment.
This revision is now accepted and ready to land.


  I'll also note that this bug was there all along, but it got way more visible with with the disambiguatewithin stuff. It used to fail only when calculating the shortest prefix for nullid in a repo without any other revisions starting with hex digit 0. The following patch shows that (it failed back on 4.6 too). I'm folding it in in flight. I'm also fixing test-revisions.t (which already showed the bug, but I had not realized it was a bug :P).
  
  diff --git a/tests/test-template-functions.t b/tests/test-template-functions.t
  
  - a/tests/test-template-functions.t
  
  +++ b/tests/test-template-functions.t
  @@ -804,6 +804,8 @@ Test shortest(node) function:
  
    e777603221
    bcc7ff960b
    f7769ec2ab
  
  +  $ hg log --template '{shortest(node, 1)}\n' -r null
  +  00
  
    $ hg log --template '{node|shortest}\n' -l1
    e777

REPOSITORY
  rHG Mercurial

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

To: spectral, #hg-reviewers, martinvonz
Cc: martinvonz, mercurial-devel


More information about the Mercurial-devel mailing list