Patchwork [v2] revlog: make converting from inline to non-line work after a strip

login
register
mail settings
Submitter adgar@google.com
Date March 25, 2015, 11:41 p.m.
Message ID <9901deb8af50c6b0578f.1427326915@adgar.nyc.corp.google.com>
Download mbox | patch
Permalink /patch/8275/
State Accepted
Commit 59904edf0a5e38e70d04f6d9693ac2a97e5dbe8d
Headers show

Comments

adgar@google.com - March 25, 2015, 11:41 p.m.
# HG changeset patch
# User Mike Edgar <adgar@google.com>
# Date 1427313511 14400
#      Wed Mar 25 15:58:31 2015 -0400
# Node ID 9901deb8af50c6b0578f8e861f9795949d962f03
# Parent  fe41722ee8e5a92447bb8a79f9b234fdfb098d05
revlog: make converting from inline to non-line work after a strip

The checkinlinesize function, which converts inline revlogs to non-inline,
uses the current transaction's "data" field to determine how to update the
transaction after the conversion.

This change works around the missing data field, which is not in the
transaction after a strip.
Matt Mackall - March 26, 2015, 8:11 p.m.
On Wed, 2015-03-25 at 19:41 -0400, Mike Edgar wrote:
> # HG changeset patch
> # User Mike Edgar <adgar@google.com>
> # Date 1427313511 14400
> #      Wed Mar 25 15:58:31 2015 -0400
> # Node ID 9901deb8af50c6b0578f8e861f9795949d962f03
> # Parent  fe41722ee8e5a92447bb8a79f9b234fdfb098d05
> revlog: make converting from inline to non-line work after a strip
> 
> The checkinlinesize function, which converts inline revlogs to non-inline,
> uses the current transaction's "data" field to determine how to update the
> transaction after the conversion.
> 
> This change works around the missing data field, which is not in the
> transaction after a strip.

Much improved. Queued, thanks!

Patch

diff -r fe41722ee8e5 -r 9901deb8af50 mercurial/revlog.py
--- a/mercurial/revlog.py	Tue Mar 24 12:52:53 2015 -0700
+++ b/mercurial/revlog.py	Wed Mar 25 15:58:31 2015 -0400
@@ -1126,7 +1126,12 @@ 
                               % self.indexfile)
 
         trindex = trinfo[2]
-        dataoff = self.start(trindex)
+        if trindex is not None:
+            dataoff = self.start(trindex)
+        else:
+            # revlog was stripped at start of transaction, use all leftover data
+            trindex = len(self) - 1
+            dataoff = self.end(-2)
 
         tr.add(self.datafile, dataoff)