changeset 2:ecf3fd948051

Handle nullid better for ancestor
author mpm@selenic.com
date Tue, 03 May 2005 18:35:03 -0800
parents 273ce12ad8f1
children 3a6392190075
files mercurial/revlog.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Tue May 03 13:27:13 2005 -0800
+++ b/mercurial/revlog.py	Tue May 03 18:35:03 2005 -0800
@@ -8,7 +8,7 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
-import zlib, struct, sha, binascii, os, tempfile
+import zlib, struct, sha, os, tempfile
 from mercurial import mdiff
 
 def compress(text):
@@ -51,7 +51,9 @@
     def node(self, rev): return rev < 0 and nullid or self.index[rev][6]
     def rev(self, node): return self.nodemap[node]
     def linkrev(self, node): return self.index[self.nodemap[node]][3]
-    def parents(self, node): return self.index[self.nodemap[node]][4:6]
+    def parents(self, node):
+        if node == nullid: return (nullid, nullid)
+        return self.index[self.nodemap[node]][4:6]
 
     def start(self, rev): return self.index[rev][0]
     def length(self, rev): return self.index[rev][1]