[PATCH 6 of 6] merge: reuse batchremove method for 'rm' action
Mads Kiilerich
mads at kiilerich.com
Wed Dec 3 21:57:50 CST 2014
On 12/03/2014 06:17 PM, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1416809658 28800
> # Sun Nov 23 22:14:18 2014 -0800
> # Node ID 0f8f7c4be514c6b979f3e4710adba9b42bd4c660
> # Parent 79d509ee6a41ef5903bf78cc75d9cd0e5213807d
> merge: reuse batchremove method for 'rm' action
>
> The batchremove method does what we want for the 'rm' action, so let's
> use that method for 'rm' actions as well. We don't care about the
> progress for files that have been renamed away, and worker() doesn't
> necessarily evauluate the function passed in unless one reads the
> progress, we need to force evaluation by iterating over the progress
> output.
>
> diff --git a/mercurial/merge.py b/mercurial/merge.py
> --- a/mercurial/merge.py
> +++ b/mercurial/merge.py
> @@ -638,7 +638,7 @@
>
> return actions
>
> -def batchremove(repo, actions):
> +def batchremove(repo, actiontype, actions):
> """apply removes to the working directory
>
> yields tuples for progress updates
> @@ -649,7 +649,7 @@
> audit = repo.wopener.audit
> i = 0
> for f, args, msg in actions:
> - repo.ui.debug(" %s: %s -> r\n" % (f, msg))
> + repo.ui.debug(" %s: %s -> %s\n" % (f, msg, actiontype))
In the next line we jump through loops to avoid unnecessary % expansion.
I guess we should do that even more for debug. Or is the next line
mainly to avoid _() calls?
I guess that is a reminder that we should move ui methods towards a way
where parameters just are passed and _() and % only are processed if the
message actually is shown.
> if verbose:
> repo.ui.note(_("removing %s\n") % f)
> audit(f)
Series LGTM - nice cleanups there!
/Mads
More information about the Mercurial-devel
mailing list