Patchwork [1,of,2] largefiles: don't clobber merge action message with user message

login
register
mail settings
Submitter Martin von Zweigbergk
Date Dec. 3, 2014, 7:45 p.m.
Message ID <e615814e438cbe0254d8.1417635926@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/6985/
State Accepted
Headers show

Comments

Martin von Zweigbergk - Dec. 3, 2014, 7:45 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1416599097 28800
#      Fri Nov 21 11:44:57 2014 -0800
# Node ID e615814e438cbe0254d89252e4f1ad385baac022
# Parent  fc76f55705eb5884707c977ecb756aee7c794676
largefiles: don't clobber merge action message with user message

The message in the action is used for debugging and should not be the
same as the question presented to the user. Use a different variable
for the user message, so the 'msg' variable already in scope does not
get overwritten.
Mads Kiilerich - Dec. 4, 2014, 3:52 a.m.
On 12/03/2014 08:45 PM, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1416599097 28800
> #      Fri Nov 21 11:44:57 2014 -0800
> # Node ID e615814e438cbe0254d89252e4f1ad385baac022
> # Parent  fc76f55705eb5884707c977ecb756aee7c794676
> largefiles: don't clobber merge action message with user message
>
> The message in the action is used for debugging and should not be the
> same as the question presented to the user. Use a different variable
> for the user message, so the 'msg' variable already in scope does not
> get overwritten.
>
> diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
> --- a/hgext/largefiles/overrides.py
> +++ b/hgext/largefiles/overrides.py
> @@ -437,7 +437,7 @@
>               # the second parent
>               lfile = splitstandin
>               standin = f
> -            msg = _('remote turned local normal file %s into a largefile\n'
> +            usermsg = _('remote turned local normal file %s into a largefile\n'
>                       'use (l)argefile or keep (n)ormal file?'
>                       '$$ &Largefile $$ &Normal file') % lfile

Adjust indentation?

/Mads
Martin von Zweigbergk - Dec. 4, 2014, 4:52 a.m.
On Wed Dec 03 2014 at 7:52:51 PM Mads Kiilerich <mads@kiilerich.com> wrote:

> On 12/03/2014 08:45 PM, Martin von Zweigbergk wrote:
> > # HG changeset patch
> > # User Martin von Zweigbergk <martinvonz@google.com>
> > # Date 1416599097 28800
> > #      Fri Nov 21 11:44:57 2014 -0800
> > # Node ID e615814e438cbe0254d89252e4f1ad385baac022
> > # Parent  fc76f55705eb5884707c977ecb756aee7c794676
> > largefiles: don't clobber merge action message with user message
> >
> > The message in the action is used for debugging and should not be the
> > same as the question presented to the user. Use a different variable
> > for the user message, so the 'msg' variable already in scope does not
> > get overwritten.
> >
> > diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.
> py
> > --- a/hgext/largefiles/overrides.py
> > +++ b/hgext/largefiles/overrides.py
> > @@ -437,7 +437,7 @@
> >               # the second parent
> >               lfile = splitstandin
> >               standin = f
> > -            msg = _('remote turned local normal file %s into a
> largefile\n'
> > +            usermsg = _('remote turned local normal file %s into a
> largefile\n'
> >                       'use (l)argefile or keep (n)ormal file?'
> >                       '$$ &Largefile $$ &Normal file') % lfile
>
> Adjust indentation?
>

Yes, sorry. Maybe Pierre-Yves is nice enough to fix that in flight?

Patch

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -437,7 +437,7 @@ 
             # the second parent
             lfile = splitstandin
             standin = f
-            msg = _('remote turned local normal file %s into a largefile\n'
+            usermsg = _('remote turned local normal file %s into a largefile\n'
                     'use (l)argefile or keep (n)ormal file?'
                     '$$ &Largefile $$ &Normal file') % lfile
             if (# local has unchanged normal file, pick remote largefile
@@ -447,7 +447,7 @@ 
                 not (pas and standin in pas[0] and
                      not pas[0][standin].cmp(p2[standin])) and
                 # else, prompt
-                repo.ui.promptchoice(msg, 0) == 0
+                repo.ui.promptchoice(usermsg, 0) == 0
                 ): # pick remote largefile
                 actions['r'].append((lfile, None, msg))
                 newglist.append((standin, (p2.flags(standin),), msg))
@@ -458,7 +458,7 @@ 
             # the second parent
             standin = lfutil.standin(f)
             lfile = f
-            msg = _('remote turned local largefile %s into a normal file\n'
+            usermsg = _('remote turned local largefile %s into a normal file\n'
                     'keep (l)argefile or use (n)ormal file?'
                     '$$ &Largefile $$ &Normal file') % lfile
             if (# if remote has unchanged normal file, pick local largefile
@@ -468,7 +468,7 @@ 
                 not (pas and standin in pas[0] and
                      not pas[0][standin].cmp(p1[standin])) and
                 # else, prompt
-                repo.ui.promptchoice(msg, 0) == 0
+                repo.ui.promptchoice(usermsg, 0) == 0
                 ): # keep local largefile
                 if branchmerge:
                     # largefile can be restored from standin safely