changeset 14:e0e5c1b9febd

Fix off-by-one truncation in transaction rollback.
author mpm@selenic.com
date Wed, 04 May 2005 09:33:46 -0800
parents eb87b7dc4236
children 6daf7757e92b
files mercurial/revlog.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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)