[PATCH 3 of 3 fix-default] addrevision: only use the incoming base if it is a good delta (issue4975)

Augie Fackler raf at durin42.com
Wed Dec 2 09:28:30 CST 2015


On Wed, Dec 02, 2015 at 12:37:25AM -0800, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at fb.com>
> # Date 1449014780 28800
> #      Tue Dec 01 16:06:20 2015 -0800
> # Node ID b907edfa2c846952ff06a00abd888ce1cdca395c
> # Parent  31aafeaa7ac49cbc98d3b526b6ae67f98cc803d2
> # EXP-Topic generaldelta
> # Available At http://hg.netv6.net/marmoute-wip/mercurial/
> #              hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r b907edfa2c84
> addrevision: only use the incoming base if it is a good delta (issue4975)

queued these, thanks

>
> Before this change, the 'lazydeltabase' would blindly build a delta using the
> base provided by the incoming bundle and try to use it. If that base was far
> down the revlog, the delta would be seen as "no good" and we would fall back to
> a full text revision.
>
> We now check if the delta is good and fallback to a computing a delta again the
> tipmost revision otherwise (as we would do without general delta).
>
> Later changesets will improve the logic to compute the fallback delta using the
> general delta logic.
>
> diff --git a/mercurial/revlog.py b/mercurial/revlog.py
> --- a/mercurial/revlog.py
> +++ b/mercurial/revlog.py
> @@ -1425,11 +1425,16 @@ class revlog(object):
>          # should we try to build a delta?
>          if prev != nullrev:
>              if cachedelta and self._generaldelta and self._lazydeltabase:
>                  # Assume what we received from the server is a good choice
>                  # build delta will reuse the cache
> -                delta = builddelta(cachedelta[0])
> +                candidatedelta = builddelta(cachedelta[0])
> +                if self._isgooddelta(candidatedelta, textlen):
> +                    delta = candidatedelta
> +                elif prev != candidatedelta[3]:
> +                    # Try against prev to hopefully save us a fulltext.
> +                    delta = builddelta(prev)
>              elif self._generaldelta:
>                  if p2r != nullrev and self._aggressivemergedeltas:
>                      delta = builddelta(p1r)
>                      delta2 = builddelta(p2r)
>                      p1good = self._isgooddelta(delta, textlen)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list