[PATCH] bundle2: handleoutput i18n

Matt Mackall mpm at selenic.com
Mon Aug 29 20:38:09 EDT 2016


On Sun, 2016-08-28 at 10:57 +0900, Akihiko Odaki wrote:
> # HG changeset patch
> # User Akihiko Odaki <akihiko.odaki.4i at stu.hosei.ac.jp>
> # Date 1472348629 -32400
> #      Sun Aug 28 10:43:49 2016 +0900
> # Node ID 3e9c35285720b3eecbda43d3d60e483d63ba7ae4
> # Parent  4fca69e3d51cc45f331a74caa6e923523ebf7f02
> bundle2: handleoutput i18n

This would be easier to read as "bundle2: localize handleoutput remote prompts"

> diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
> --- a/mercurial/bundle2.py
> +++ b/mercurial/bundle2.py
> @@ -1467,7 +1467,7 @@ def handlecheckheads(op, inpart):
>  def handleoutput(op, inpart):
>      """forward output captured on the server to the client"""
>      for line in inpart.read().splitlines():
> -        op.ui.status(('remote: %s\n' % line))

You'll note there is an extra level of useless parentheses here. They actually
serve a purpose: they stop check-code.py from complaining about not using _().

So someone didn't put _() there on purpose. Whenever you see something
apparently pointless that was also clearly done on purpose, you need to figure
out why it was done before you take it out: you might be breaking something that
isn't obvious.

But if you look into it and discover there was indeed no good reason for it, you
should explain that in your commit message. Then reviewers will know you were
paying attention.

> +        op.ui.status((_('remote: %s\n') % line))

Leaving in the extra parentheses now useless for real.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list