db308eba5251 — Siddharth Agarwal 8 years ago
overlaychangectx: use overlayrevlog logic to determine parents

The old logic was broken -- it didn't work at the boundary between hg and git
commits. The logic in overlayrevlog.parents handles that correctly.

This is the last fix required for Mercurial 3.4.
1 files changed, 5 insertions(+), 2 deletions(-)

M hggit/overlay.py
M hggit/overlay.py +5 -2
@@ 202,10 202,13 @@ class overlaychangectx(context.changectx
         return self.commit.message
 
     def parents(self):
-        parents = self.commit.parents
+        cl = self.repo.changelog
+        parents = cl.parents(cl.node(self._rev))
         if not parents:
             return [self.repo['null']]
-        return [overlaychangectx(self.repo, sha) for sha in parents]
+        if parents[1] == nullid:
+            parents = parents[:-1]
+        return [self.repo[sha] for sha in parents]
 
     def manifestnode(self):
         return bin(self.commit.tree)