revlog: append delta against p1
authorPradeepkumar Gayam <in3xes@gmail.com>
Tue, 10 Aug 2010 22:27:41 +0530
changeset 11931 6051db1327f8
parent 11930 12547cedc264
child 11932 01778673aab7
revlog: append delta against p1
mercurial/revlog.py
--- a/mercurial/revlog.py	Tue Aug 10 22:27:16 2010 +0530
+++ b/mercurial/revlog.py	Tue Aug 10 22:27:41 2010 +0530
@@ -1157,10 +1157,15 @@
         prev = curr - 1
         base = self.base(prev)
         offset = self.end(prev)
+        flags = 0
 
         if curr:
             if not d:
-                ptext = self.revision(self.node(prev))
+                if self._parentdelta:
+                    ptext = self.revision(p1)
+                    flags = REVIDX_PARENTDELTA
+                else:
+                    ptext = self.revision(self.node(prev))
                 d = mdiff.textdiff(ptext, text)
             data = compress(d)
             l = len(data[1]) + len(data[0])
@@ -1175,7 +1180,7 @@
             l = len(data[1]) + len(data[0])
             base = curr
 
-        e = (offset_type(offset, 0), l, len(text),
+        e = (offset_type(offset, flags), l, len(text),
              base, link, self.rev(p1), self.rev(p2), node)
         self.index.insert(-1, e)
         self.nodemap[node] = curr