Mercurial > hg
changeset 44703:0e99b876966a
manifest: teach treemanifest about long hashes
Differential Revision: https://phab.mercurial-scm.org/D8369
author | Augie Fackler <augie@google.com> |
---|---|
date | Thu, 02 Apr 2020 15:52:10 -0400 |
parents | 0b0e72b5d551 |
children | 0415a566742a |
files | mercurial/manifest.py |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/manifest.py Tue Jan 07 13:47:29 2020 -0500 +++ b/mercurial/manifest.py Thu Apr 02 15:52:10 2020 -0400 @@ -1027,7 +1027,12 @@ self._dirs[dir] = treemanifest(self._subpath(dir)) self._dirs[dir].__setitem__(subpath, n) else: - self._files[f] = n[:21] # to match manifestdict's behavior + # manifest nodes are either 20 bytes or 32 bytes, + # depending on the hash in use. An extra byte is + # occasionally used by hg, but won't ever be + # persisted. Trim to 21 or 33 bytes as appropriate. + trim = 21 if len(n) < 25 else 33 + self._files[f] = n[:trim] # to match manifestdict's behavior self._dirty = True def _load(self):