[PATCH] metadataonlyctx: speed up sanity check

Augie Fackler raf at durin42.com
Mon Mar 27 12:32:17 EDT 2017


On Sun, Mar 26, 2017 at 12:32:23PM -0700, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1490556395 25200
> #      Sun Mar 26 12:26:35 2017 -0700
> # Node ID 2793d297600133bb83a5d2f5a46bfa3fadd037ab
> # Parent  b6766d75404fb8c5d26af016caa76f44b47ce156
> # Available At https://bitbucket.org/quark-zju/hg-draft
> #              hg pull https://bitbucket.org/quark-zju/hg-draft -r 2793d2976001
> metadataonlyctx: speed up sanity check

Queued this, thanks.

>
> Previously the sanity check will construct manifestctx for both p1 and p2.
> But it only needs the "manifest node" information, which could be read from
> changelog directly.
>
> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -2061,8 +2061,8 @@ class metadataonlyctx(committablectx):
>          # manifests of our commit parents
>          mp1, mp2 = self.manifestctx().parents
> -        if p1 != nullid and p1.manifestctx().node() != mp1:
> +        if p1 != nullid and p1.changeset()[0] != mp1:
>              raise RuntimeError('can\'t reuse the manifest: '
>                                 'its p1 doesn\'t match the new ctx p1')
> -        if p2 != nullid and p2.manifestctx().node() != mp2:
> +        if p2 != nullid and p2.changeset()[0] != mp2:
>              raise RuntimeError('can\'t reuse the manifest: '
>                                 'its p2 doesn\'t match the new ctx p2')
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list