[PATCH 4 of 5] summary: move mergemod before parents to give access to ms

timeless timeless at gmail.com
Thu Mar 17 11:50:25 EDT 2016


It's technically possible to avoid changing where the warning appears,
but TBH, having the warning buried in the middle of the output really
doesn't do anyone any favors.

On Thu, Mar 17, 2016 at 11:46 AM, timeless <timeless at mozdev.org> wrote:
> # HG changeset patch
> # User timeless <timeless at mozdev.org>
> # Date 1458226229 0
> #      Thu Mar 17 14:50:29 2016 +0000
> # Node ID 8472502ee330689965b34f4bf51286ed4b481203
> # Parent  90b56e5e614a0696ded4e75349317b55b9c30533
> summary: move mergemod before parents to give access to ms
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -6525,6 +6525,17 @@
>      pnode = parents[0].node()
>      marks = []
>
> +    ms = None
> +    try:
> +        ms = mergemod.mergestate.read(repo)
> +    except error.UnsupportedMergeRecords as e:
> +        s = ' '.join(e.recordtypes)
> +        ui.warn(
> +            _('warning: merge state has unsupported record types: %s\n') % s)
> +        unresolved = 0
> +    else:
> +        unresolved = [f for f in ms if ms[f] == 'u']
> +
>      for p in parents:
>          # label with log.changeset (instead of log.parent) since this
>          # shows a working directory parent *changeset*:
> @@ -6580,16 +6591,6 @@
>          if d in status.added:
>              status.added.remove(d)
>
> -    try:
> -        ms = mergemod.mergestate.read(repo)
> -    except error.UnsupportedMergeRecords as e:
> -        s = ' '.join(e.recordtypes)
> -        ui.warn(
> -            _('warning: merge state has unsupported record types: %s\n') % s)
> -        unresolved = 0
> -    else:
> -        unresolved = [f for f in ms if ms[f] == 'u']
> -
>      subs = [s for s in ctx.substate if ctx.sub(s).dirty()]
>
>      labels = [(ui.label(_('%d modified'), 'status.modified'), status.modified),
> diff --git a/tests/test-resolve.t b/tests/test-resolve.t
> --- a/tests/test-resolve.t
> +++ b/tests/test-resolve.t
> @@ -332,12 +332,12 @@
>    (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
>    [255]
>    $ hg summary
> +  warning: merge state has unsupported record types: X
>    parent: 2:57653b9f834a
>     append baz to files
>    parent: 1:dc77451844e3
>     append bar to files
>    branch: default
> -  warning: merge state has unsupported record types: X
>    commit: 2 modified, 2 unknown (merge)
>    update: 2 new changesets (update)
>    phases: 5 draft
> _______________________________________________
> 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