mercurial/revlog.py
changeset 14301 f94993769c87
parent 14296 62e25c63fb3a
child 14325 f9e91a400c16
--- a/mercurial/revlog.py	Thu May 12 14:31:07 2011 +0200
+++ b/mercurial/revlog.py	Thu May 12 15:24:33 2011 +0200
@@ -1033,7 +1033,12 @@
         # should we try to build a delta?
         if prev != nullrev:
             if self._generaldelta:
-                d = builddelta(p1r)
+                if p1r >= basecache[1]:
+                    d = builddelta(p1r)
+                elif p2r >= basecache[1]:
+                    d = builddelta(p2r)
+                else:
+                    d = builddelta(prev)
             else:
                 d = builddelta(prev)
             dist, l, data, base, chainbase = d