Patchwork D8369: manifest: teach treemanifest about long hashes

login
register
mail settings
Submitter phabricator
Date April 2, 2020, 8:32 p.m.
Message ID <differential-rev-PHID-DREV-cbpvpg3xghwqxfftwtls-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46002/
State Superseded
Headers show

Comments

phabricator - April 2, 2020, 8:32 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/manifest.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - April 14, 2020, 8:50 a.m.
Alphare added a comment.
Alphare accepted this revision.


  I feel like that warrants a small comment about hash compatibility just to ease-in new contributors or people who haven't followed that discussion.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8369/new/

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

To: durin42, #hg-reviewers, Alphare
Cc: Alphare, mercurial-devel
phabricator - April 14, 2020, 3:25 p.m.
durin42 added a comment.


  In D8369#125460 <https://phab.mercurial-scm.org/D8369#125460>, @Alphare wrote:
  
  > I feel like that warrants a small comment about hash compatibility just to ease-in new contributors or people who haven't followed that discussion.
  
  Added a comment, hopefully this is what you have in mind?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8369/new/

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

To: durin42, #hg-reviewers, Alphare
Cc: Alphare, mercurial-devel
phabricator - April 14, 2020, 3:31 p.m.
Alphare added a comment.


  In D8369#125485 <https://phab.mercurial-scm.org/D8369#125485>, @durin42 wrote:
  
  > Added a comment, hopefully this is what you have in mind?
  
  Yes, perfect. I have also looked at the added comments on the other changesets and they seem fine as well, thanks.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8369/new/

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

To: durin42, #hg-reviewers, Alphare
Cc: Alphare, mercurial-devel

Patch

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -1026,7 +1026,8 @@ 
                 self._dirs[dir] = treemanifest(self._subpath(dir))
             self._dirs[dir].__setitem__(subpath, n)
         else:
-            self._files[f] = n[:21]  # to match manifestdict's behavior
+            trim = 21 if len(n) < 25 else 33
+            self._files[f] = n[:trim]  # to match manifestdict's behavior
         self._dirty = True
 
     def _load(self):