changeset 3585:cac2c17bec5a

revlog: more nullrev fixes
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sun, 29 Oct 2006 16:14:55 +0100
parents 8dbbe4dadb48
children 66a17364c30e
files mercurial/revlog.py
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Sun Oct 29 16:14:02 2006 +0100
+++ b/mercurial/revlog.py	Sun Oct 29 16:14:55 2006 +0100
@@ -467,7 +467,7 @@
     def tip(self): return self.node(len(self.index) - 1)
     def count(self): return len(self.index)
     def node(self, rev):
-        return (rev < 0) and nullid or self.index[rev][-1]
+        return rev == nullrev and nullid or self.index[rev][-1]
     def rev(self, node):
         try:
             return self.nodemap[node]
@@ -490,7 +490,7 @@
             return (self.rev(d[0]), self.rev(d[1]))
         return d
     def start(self, rev):
-        if rev < 0:
+        if rev == nullrev:
             return 0
         if self.version != REVLOGV0:
             return self.ngoffset(self.index[rev][0])
@@ -532,11 +532,15 @@
         """
 
     def length(self, rev):
-        if rev < 0:
+        if rev == nullrev:
             return 0
         else:
             return self.index[rev][1]
-    def base(self, rev): return (rev < 0) and rev or self.index[rev][-5]
+    def base(self, rev):
+        if (rev == nullrev):
+            return nullrev
+        else:
+            return self.index[rev][-5]
 
     def reachable(self, rev, stop=None):
         reachable = {}