From patchwork Tue Apr 14 19:19:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D8369: manifest: teach treemanifest about long hashes From: phabricator X-Patchwork-Id: 46111 Message-Id: <5f026be59962d5fd659cced5d849a0c2@localhost.localdomain> To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Tue, 14 Apr 2020 19:19:11 +0000 Closed by commit rHG0e99b876966a: manifest: teach treemanifest about long hashes (authored by durin42). This revision was automatically updated to reflect the committed changes. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D8369?vs=21051&id=21082 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D8369/new/ REVISION DETAIL https://phab.mercurial-scm.org/D8369 AFFECTED FILES mercurial/manifest.py CHANGE DETAILS To: durin42, #hg-reviewers, Alphare, pulkit Cc: Alphare, mercurial-devel diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -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):