D4380: revert: fix the inconsistency of status msgs in --interactive mode

Yuya Nishihara yuya at tcha.org
Fri Aug 31 07:53:27 EDT 2018


> @@ -3034,7 +3035,19 @@
>              prefetch(repo, [ctx.rev()],
>                       matchfiles(repo,
>                                  [f for sublist in oplist for f in sublist]))
> -            _performrevert(repo, parents, ctx, actions, interactive, tobackup)
> +            # give status messages for actions to be performed
> +            acts = "add drop undelete forget remove revert".split()
> +            if interactive:
> +                # exclude ("forget", "remove", "revert") as status msg for these
> +                # actions will be handled in interactive session.
> +                acts = acts[:3]
> +            for act in acts:
> +                for f in actions[act][0]:
> +                    rel, exact = names[f]
> +                    if ui.verbose or not exact:
> +                        ui.status(actions[act][1] % rel)
> +            _performrevert(repo, parents, ctx, names, actions, interactive,
> +                           tobackup)

Looks generally good, but I think the original patch was better in that
status message is printed just before the action, no matter if interactive
or not.

> +                rel, exact = names[f]
> +                if repo.ui.verbose or not exact:
> +                    repo.ui.status(actions['forget'][1] % rel)

This can be factored out to a closure function if you think it's too verbose
to copy around.


More information about the Mercurial-devel mailing list