[PATCH] metadataonlyctx: speed up sanity check

Yuya Nishihara yuya at tcha.org
Mon Mar 27 11:48:20 EDT 2017


On Sun, 26 Mar 2017 12:32:23 -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
> 
> 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:

Perhaps ctx.manifestnode() can be used.


More information about the Mercurial-devel mailing list