changeset 23285:6cc1f388ac80

revlog: store fulltext when compressed delta is bigger than it This is a very silly case and not particularly likely to happen in the wild, but it turns out we can hit it in a couple of places. As we tune the storage parameters we're likely to hit more such cases. The affected test cases all have smaller revlogs now.
author Siddharth Agarwal <sid0@fb.com>
date Tue, 11 Nov 2014 21:41:12 -0800
parents 8d47c212b0dd
children 40e0067899d4
files mercurial/revlog.py tests/test-copy.t tests/test-obsolete.t tests/test-relink.t tests/test-revlog-packentry.t
diffstat 5 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Tue Nov 11 21:39:56 2014 -0800
+++ b/mercurial/revlog.py	Tue Nov 11 21:41:12 2014 -0800
@@ -1254,7 +1254,7 @@
                                         cachedelta[1])
         else:
             textlen = len(text)
-        if (d is None or dist > textlen * 2 or
+        if (d is None or dist > textlen * 2 or l > textlen or
             (self._maxchainlen and chainlen > self._maxchainlen)):
             text = buildtext()
             data = self.compress(text)
--- a/tests/test-copy.t	Tue Nov 11 21:39:56 2014 -0800
+++ b/tests/test-copy.t	Tue Nov 11 21:41:12 2014 -0800
@@ -184,7 +184,7 @@
      rev    offset  length  ..... linkrev nodeid       p1           p2 (re)
        0         0      69  .....       1 7711d36246cc 000000000000 000000000000 (re)
        1        69       6  .....       2 bdf70a2b8d03 7711d36246cc 000000000000 (re)
-       2        75      81  .....       3 b2558327ea8d 000000000000 000000000000 (re)
+       2        75      71  .....       3 b2558327ea8d 000000000000 000000000000 (re)
 should match
   $ hg debugindex foo
      rev    offset  length  ..... linkrev nodeid       p1           p2 (re)
--- a/tests/test-obsolete.t	Tue Nov 11 21:39:56 2014 -0800
+++ b/tests/test-obsolete.t	Tue Nov 11 21:41:12 2014 -0800
@@ -90,8 +90,8 @@
   # rev p1rev p2rev start   end deltastart base   p1   p2 rawsize totalsize compression heads chainlen
       0    -1    -1     0    59          0    0    0    0      58        58           0     1        0
       1     0    -1    59   118         59   59    0    0      58       116           0     1        0
-      2     1    -1   118   204         59   59   59    0      76       192           0     1        1
-      3     1    -1   204   271        204  204   59    0      66       258           0     2        0
+      2     1    -1   118   193        118  118   59    0      76       192           0     1        0
+      3     1    -1   193   260        193  193   59    0      66       258           0     2        0
   $ hg debugobsolete
   245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
 
--- a/tests/test-relink.t	Tue Nov 11 21:39:56 2014 -0800
+++ b/tests/test-relink.t	Tue Nov 11 21:41:12 2014 -0800
@@ -87,7 +87,7 @@
   pruned down to 2 probably relinkable files
   relinking: data/a.i 1/2 files (50.00%)
   not linkable: data/dummy.i
-  relinked 1 files (1.37 KB reclaimed)
+  relinked 1 files (1.36 KB reclaimed)
   $ cd ..
 
 
--- a/tests/test-revlog-packentry.t	Tue Nov 11 21:39:56 2014 -0800
+++ b/tests/test-revlog-packentry.t	Tue Nov 11 21:41:12 2014 -0800
@@ -18,6 +18,6 @@
   $ hg debugindex foo
      rev    offset  length  ..... linkrev nodeid       p1           p2 (re)
        0         0       0  .....       0 b80de5d13875 000000000000 000000000000 (re)
-       1         0      24  .....       1 0376abec49b8 000000000000 000000000000 (re)
+       1         0      13  .....       1 0376abec49b8 000000000000 000000000000 (re)
 
   $ cd ..