changeset 11931:6051db1327f8

revlog: append delta against p1
author Pradeepkumar Gayam <in3xes@gmail.com>
date Tue, 10 Aug 2010 22:27:41 +0530
parents 12547cedc264
children 01778673aab7
files mercurial/revlog.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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