[Bug 4649] New: Mercurial commands should display unambiguous hashes
mercurial-bugs at selenic.com
mercurial-bugs at selenic.com
Wed May 6 07:44:45 UTC 2015
http://bz.selenic.com/show_bug.cgi?id=4649
Priority: normal
Bug ID: 4649
CC: gregory.szorc at gmail.com, mercurial-devel at selenic.com,
mh+hg at glandium.org
Assignee: bugzilla at selenic.com
Summary: Mercurial commands should display unambiguous hashes
Severity: bug
Classification: Unclassified
OS: All
Reporter: jandemooij at gmail.com
Hardware: All
Status: UNCONFIRMED
Version: unspecified
Component: Mercurial
Product: Mercurial
Yesterday I wrote a tool to create Mercurial short-hash collisions:
http://www.jandemooij.nl/blog/2015/05/05/using-rust-to-generate-mercurial-short-hash-collisions/
We noticed that Mercurial, by default, displays short hashes (12 hex chars),
even if these are ambiguous:
$ hg id
b991f0726738 patch/qbase/qtip/tip
$ hg log -r b991f0726738
abort: 00changelog.i at b991f0726738: ambiguous identifier!
So if there's a collision, the output of |hg id| and |hg log| is no longer
useful to identify the current revision. It'd be nice if these commands always
printed an unambiguous hash.
To quote Gregory Szorc, one of our Mercurial gurus:
Mercurial does have a âshortest(node, minlength)â template that is used to
render the shortest hex SHA-1 that isnât ambiguous. The default templates for
Mercurial should arguably be using âshortest(node, 12)â instead of
âshort(node)â so collisions in the first 48 bits donât result in ambiguous
output.
And also:
This could be a âfunâ bug since there are performance considerations with
enabling it globally. But certain commands like `hg id` can probably be changed
without much thought.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Mercurial-devel
mailing list