Patchwork D9068: git: pass `id` attribute of `pygit2.Tree` object

login
register
mail settings
Submitter phabricator
Date Sept. 22, 2020, 1:40 p.m.
Message ID <differential-rev-PHID-DREV-r4lo3nyp6dv6qkkb47yb-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47241/
State Superseded
Headers show

Comments

phabricator - Sept. 22, 2020, 1:40 p.m.
sheehan created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  `pygit2`'s Repository object expects an instance of `Oid`
  to return the corresponding object, instead of the object
  itself.
  
  After this change and D9062 <https://phab.mercurial-scm.org/D9062>, `hg commit -i` seems to work,
  unless it hits a case folding assertion (ie trying to add
  a file like `README.md`).

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/git/manifest.py

CHANGE DETAILS




To: sheehan, durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/hgext/git/manifest.py b/hgext/git/manifest.py
--- a/hgext/git/manifest.py
+++ b/hgext/git/manifest.py
@@ -322,7 +322,8 @@ 
             for part in comps:
                 parent = trees[full]
                 try:
-                    new = self._repo[parent[pycompat.fsdecode(part)]]
+                    parent_tree_id = parent[pycompat.fsdecode(part)].id
+                    new = self._repo[parent_tree_id]
                 except KeyError:
                     # new directory
                     new = None