changeset 874:517cf1b5e626

overlaychangectx: return nullrev if commit has no parents In Mercurial, every commit has at least one parent -- root commits have the null revision as their parent. In Git, root commits don't have any parents. This difference needs to be papered over in hg-git for 'hg incoming' to work in Mercurial 3.4+. Note that this doesn't fix all the broken tests in default -- I haven't had time to investigate the others.
author Siddharth Agarwal <sid0@fb.com>
date Fri, 03 Apr 2015 11:18:30 -0700
parents da01212cd53a
children 9fdd6a1b3339
files hggit/overlay.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/overlay.py
+++ b/hggit/overlay.py
@@ -190,7 +190,10 @@
         return self.commit.message
 
     def parents(self):
-        return [overlaychangectx(self.repo, sha) for sha in self.commit.parents]
+        parents = self.commit.parents
+        if not parents:
+            return [self.repo['null']]
+        return [overlaychangectx(self.repo, sha) for sha in parents]
 
     def manifestnode(self):
         return bin(self.commit.tree)