[PATCH STABLE] record: prevent commits that don't pick up dirty subrepo changes (issue6102)

Yuya Nishihara yuya at tcha.org
Sat Mar 16 22:01:05 EDT 2019


On Sat, 16 Mar 2019 18:20:37 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1552761621 14400
> #      Sat Mar 16 14:40:21 2019 -0400
> # Branch stable
> # Node ID 0d48bef566bf86ade809225d7e8b08c37914beb4
> # Parent  25fc5b96d1c30468417ee0d690c2979db362edd0
> record: prevent commits that don't pick up dirty subrepo changes (issue6102)

> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -248,6 +248,21 @@ def dorecord(ui, repo, commitfunc, cmdsu
>      if not opts.get('user'):
>          ui.username() # raise exception, username not provided
>  
> +    wctx = repo[None]
> +    match = scmutil.match(wctx, pats, opts)
> +    status = repo.status(match=match)
> +
> +    overrides = {(b'ui', b'commitsubrepos'): True}
> +
> +    with repo.ui.configoverride(overrides, b'record'):
> +        # Force allows -X subrepo.
> +        subs, commitsubs, newstate = subrepoutil.precommit(
> +            repo.ui, wctx, status, match, force=True)
> +        for s in subs:
> +            if s in commitsubs:
> +                dirtyreason = wctx.sub(s).dirtyreason(True)
> +                raise error.Abort(dirtyreason)

Can we move these into recordfunc() where locks should be held properly?

>      def recordfunc(ui, repo, message, match, opts):
>          """This is generic record driver.


More information about the Mercurial-devel mailing list