Fix off-by-one truncation in transaction rollback.
authormpm@selenic.com
Wed, 04 May 2005 09:33:46 -0800
changeset 14 e0e5c1b9febd
parent 13 eb87b7dc4236
child 15 6daf7757e92b
Fix off-by-one truncation in transaction rollback.
mercurial/revlog.py
--- a/mercurial/revlog.py	Wed May 04 09:32:39 2005 -0800
+++ b/mercurial/revlog.py	Wed May 04 09:33:46 2005 -0800
@@ -63,8 +63,8 @@
     def revisions(self, list):
         # this can be optimized to do spans, etc
         # be stupid for now
-        for r in list:
-            yield self.revision(r)
+        for node in list:
+            yield self.revision(node)
 
     def diff(self, a, b):
         return mdiff.textdiff(a, b)
@@ -151,9 +151,9 @@
         self.nodemap[node] = n
         entry = struct.pack(indexformat, *e)
 
-        transaction.add(self.datafile, e[0])
+        transaction.add(self.datafile, e[0] - 1)
         self.opener(self.datafile, "a").write(data)
-        transaction.add(self.indexfile, n * len(entry))
+        transaction.add(self.indexfile, (n + 1) * len(entry) - 1)
         self.opener(self.indexfile, "a").write(entry)
 
         self.cache = (node, n, text)