[PATCH 1 of 3] dirstate: change placeholder hash length to 20 bytes

Durham Goode durham at fb.com
Thu Nov 10 14:29:19 EST 2016


On Nov 10, 2016 6:08 PM, Sean Farley <sean at farley.io<mailto:sean at farley.io>> wrote:
>
> Durham Goode <durham at fb.com<mailto:durham at fb.com>> writes:
>
> > # HG changeset patch
> > # User Durham Goode <durham at fb.com<mailto:durham at fb.com>>
> > # Date 1478773042 28800
> > #      Thu Nov 10 02:17:22 2016 -0800
> > # Node ID 84d7edbc0712c8c71b5e32c9cc1ee04032b9eb2d
> > # Parent  3fd53cc1aad882ac9191d7388885acdbbc2d7103
> > dirstate: change placeholder hash length to 20 bytes
> >
> > Previously the new-node placeholder hash for manifests generated from the
> > dirstate was a 21byte long string of "!" characters. Normal hashes are only 20
> > bytes long.  This makes it complicated to implement more efficient manifest
> > implementations which rely on the hashes being fixed length.
> >
> > Let's change this hash to just be 20 bytes long, and rely on the astronomical
> > improbability of an actual hash being 20 "!" bytes in a row (just like we rely
> > on no hash ever being the nullid).
>
> Will this cause a problem for a user that has a 21-length dirstate entry
> then upgrades Mercurial?
I don't think the dirstate file includes hashes, so I don't think there's any backwards compatibility concerns.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20161110/c393a9b7/attachment.html>


More information about the Mercurial-devel mailing list