[PATCH] revlog: converting from inline to non-inline works after a strip

Matt Mackall mpm at selenic.com
Wed Mar 25 15:55:26 CDT 2015


On Wed, 2015-03-25 at 15:59 -0400, Mike Edgar wrote:
> # HG changeset patch
> # User Mike Edgar <adgar at google.com>
> # Date 1427313511 14400
> #      Wed Mar 25 15:58:31 2015 -0400
> # Node ID a34e493f59fb430c1945f40212299fd7e9836297
> # Parent  fe41722ee8e5a92447bb8a79f9b234fdfb098d05
> revlog: converting from inline to non-inline works after a strip

This style of summary is confusing since it's just describing a state
rather than a change. I'm guessing you mean:

revlog: make converting from inline to non-line work after a strip

..yes?

In general, without looking at the code, I'm confused about whether the
rest of your description refers to the before state or the after state
or even both, since it uses words like "currently":

> The checkinlinesize function, which converts inline revlogs to non-inline,
> uses the current transaction's contents to determine how to update the
> transaction after the conversion. The transaction's "data" field for the
> revlog file is used; for revlogs "data" typically contains the first new
> revnum added in the transaction.
> 
> Conversion currently fails if the transaction begins by stripping the inline
> revlog, as the strip operation does not have a new revnum to include as
> transaction data. In lieu of this revnum, the revlog conversion code can use
> the post-strip size of the revlog when updating the transaction.
> 
> This change should not impact recoverability because strip already produces
> backup bundles to recover the data that transactions can't recover.
> 
> diff -r fe41722ee8e5 -r a34e493f59fb 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)
>  
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list