[PATCH 4 of 4] revlog: don't consider nullrev when choosing delta base

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sat Dec 5 23:47:48 CST 2015



On 12/04/2015 09:57 PM, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1449280016 28800
> #      Fri Dec 04 17:46:56 2015 -0800
> # Node ID b94cd7a1f543b3b80ad196e1f8731e44afefdb2a
> # Parent  fd8f2cd725f35a189e01c2d89b19f2ea004276f1
> revlog: don't consider nullrev when choosing delta base

Thanks for doing this. I meant to do this but you raced me to it ☺

There is a couple of other improvement I'm considering for that code:

1) has each builddelta call is followed but a _isgooddelta, we should 
probably just have a function returning "a good delta or None"

2) There is case were we could know by advance that the delta will be 
bad (eg: base is soo far down that the distance is already off limit). 
We could skip delta general in this case.

3) That could just be a single loop consuming a list of list. Each entry 
in the list would be a set of base to consider. We would stop at the 
first entry returning a good delta and pick the best delta of that 
entry. This would allow a more extensible testing strategy.

The current behavior are encoded that way:

- generaldelta + lazy base + aggressive parents:
       [(<base>,), (p1, p2), (prev,)]
- generaldelta + lazy base:
       [(<base>,), (max(p1, p2),), (prev,)]
- generaldelta +  aggressive parents
       [(p1, p2), (prev,)]
- generaldelta:
       [(max(p1, p2),), (prev,)]
- nothing:
   [(prev,)]


Having that list would allow to play with more strategy easily:
- Try the other parent if the first one was bad:
       [(max(p1, p2),), (min(p1, p2)), (prev,)]
- aggressively pick best of current options
       [(p1, p2, prev)]
- some injected parent from obsolescence information:
       …

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list