[PATCH] purge --print: duplicate output (issue4092)

Sean Farley sean.michael.farley at gmail.com
Wed Feb 12 17:37:07 CST 2014

Anurag Goel <anurag.dsps at gmail.com> writes:

> # HG changeset patch
> # User anuraggoel <anurag.dsps at gmail.com>
> # Date 1392239473 -19800
> #      Thu Feb 13 02:41:13 2014 +0530
> # Node ID 05dc3cf8eb62f4dc3b19404c9b5d47ed0f9f63d2
> # Parent  d98ba4a87427ce601dd23de8d4f5288cc44fe945
> purge --print: duplicate output (issue4092)

This is a better attempt this go-around :-) Keep in mind the summary
line should have the colon after one word. So, for example, a better
summary might be:

purge: avoid duplicate output for --print (issue4092)

> Previously when "ui.verbose" is configured to true then "purge --print" results in each file being printed twice.Now it has been resolved.

There is no space after the first period but that won't matter next time
because you should just not have that second sentence at all. It's
implied that it is now resolved because you are sending a patch :-)

> I have run test suits also and it works perfectly fine.

This should *always* be true when sending a patch so you don't need to
say it explicity.

> diff -r d98ba4a87427 -r 05dc3cf8eb62 hgext/purge.py
> --- a/hgext/purge.py	Mon Feb 10 17:31:26 2014 -0600
> +++ b/hgext/purge.py	Thu Feb 13 02:41:13 2014 +0530
> @@ -82,7 +82,8 @@
>                      raise util.Abort(m)
>                  ui.warn(_('warning: %s\n') % m)
>          else:
> -            ui.write('%s%s' % (name, eol))
> +            if not ui.verbose:
> +                ui.write('%s%s' % (name, eol))

Why not combine the 'else' and 'if' into one line? Like so:

elif not ui.verbose:
    ui.write('%s%s' % (name, eol))

... but that seems to not be correct since now I won't see the expected
eol output with --print0 if I have ui.verbose=True. Instead, it might be
better to not print the other ui.note message when there is not
action (and add a comment). Something like the following:

-        ui.note(_('removing file %s\n') % f)
+        # only print a note if we are actually deleting and not just printing
+        if act:
+            ui.note(_('removing file %s\n') % f)

And similarly for the 'removing directory' message too.

More information about the Mercurial-devel mailing list