Patchwork [1,of,3] style: avoid an unnecessary line split

login
register
mail settings
Submitter Denis Laxalde
Date Nov. 25, 2016, 8:43 a.m.
Message ID <cde950264b07eb8626e0.1480063381@sh77.tls.logilab.fr>
Download mbox | patch
Permalink /patch/17752/
State Accepted
Headers show

Comments

Denis Laxalde - Nov. 25, 2016, 8:43 a.m.
# HG changeset patch
# User Denis Laxalde <denis.laxalde@logilab.fr>
# Date 1480061343 -3600
#      Fri Nov 25 09:09:03 2016 +0100
# Node ID cde950264b07eb8626e0aa5aa2fbcd6b27f98c10
# Parent  8836f13e3c5b8eae765372708b659c55a044cbb4
# EXP-Topic revert/interactive-remove
style: avoid an unnecessary line split
Sean Farley - Nov. 26, 2016, 2:01 a.m.
Denis Laxalde <denis.laxalde@logilab.fr> writes:

> # HG changeset patch
> # User Denis Laxalde <denis.laxalde@logilab.fr>
> # Date 1480061343 -3600
> #      Fri Nov 25 09:09:03 2016 +0100
> # Node ID cde950264b07eb8626e0aa5aa2fbcd6b27f98c10
> # Parent  8836f13e3c5b8eae765372708b659c55a044cbb4
> # EXP-Topic revert/interactive-remove
> style: avoid an unnecessary line split
>
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -3255,10 +3255,8 @@ def _performrevert(repo, parents, ctx, a
>      audit_path = pathutil.pathauditor(repo.root)
>      for f in actions['forget'][0]:
>          if interactive:
> -            choice = \
> -                repo.ui.promptchoice(
> -                    _("forget added file %s (yn)?$$ &Yes $$ &No")
> -                    % f)
> +            choice = repo.ui.promptchoice(
> +                _("forget added file %s (yn)?$$ &Yes $$ &No") % f)

If we're going to get rid of a line split, I'd prefer to also fix the
indentation:

forget_str = _("forget added file %s (yn)?$$ &Yes $$ &No")
for f in actions['forget'][0]:
    ...
    choice = repo.ui.promptchoice(forget_str % f)

Might not be worth sending a V2 and asking a commiter to change that
in-flight.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -3255,10 +3255,8 @@  def _performrevert(repo, parents, ctx, a
     audit_path = pathutil.pathauditor(repo.root)
     for f in actions['forget'][0]:
         if interactive:
-            choice = \
-                repo.ui.promptchoice(
-                    _("forget added file %s (yn)?$$ &Yes $$ &No")
-                    % f)
+            choice = repo.ui.promptchoice(
+                _("forget added file %s (yn)?$$ &Yes $$ &No") % f)
             if choice == 0:
                 repo.dirstate.drop(f)
             else: