diff hggit/overlay.py @ 690:c99941ff2d28

overlayrevlog: handle root commits correctly Previously, we'd try to access commit.parents[0] and fail. Now, check for commit.parents being empty and return what Mercurial thinks is a repository root in that case.
author Siddharth Agarwal <sid0@fb.com>
date Tue, 25 Feb 2014 00:23:12 -0800
parents aa8519daf037
children 64fa5ea18b89
line wrap: on
line diff
--- a/hggit/overlay.py	Tue Feb 25 00:20:22 2014 -0800
+++ b/hggit/overlay.py	Tue Feb 25 00:23:12 2014 -0800
@@ -192,6 +192,9 @@
             return self.base.parents(n)
         commit = self.repo.handler.git.get_object(_maybehex(n))
 
+        if not commit.parents:
+            return [nullid, nullid]
+
         def gitorhg(n):
             hn = self.repo.handler.map_hg_get(hex(n))
             if hn is not None: