Patchwork [evolve-ext] label: make sure labelled message is a string

login
register
mail settings
Submitter via Mercurial-devel
Date May 19, 2017, 4:06 p.m.
Message ID <100581f7a6dd2a66e4dd.1495209978@martinvonz.svl.corp.google.com>
Download mbox | patch
Permalink /patch/20736/
State Not Applicable
Headers show

Comments

via Mercurial-devel - May 19, 2017, 4:06 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1495209634 25200
#      Fri May 19 09:00:34 2017 -0700
# Node ID 100581f7a6dd2a66e4ddc27e8f72dfd2cd84b4ed
# Parent  80b5fc054219d17f33c3d2fda6d46d3c5fe9908a
label: make sure labelled message is a string

When color is enabled, it tries to split the message on newlines,
which fails because we currently pass a context object as the
message. It seems to make sense for ui.label() to require its message
to be a string, so let's make sure that's what we pass.
Pierre-Yves David - May 19, 2017, 7:06 p.m.
On 05/19/2017 06:06 PM, Martin von Zweigbergk via Mercurial-devel wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1495209634 25200
> #      Fri May 19 09:00:34 2017 -0700
> # Node ID 100581f7a6dd2a66e4ddc27e8f72dfd2cd84b4ed
> # Parent  80b5fc054219d17f33c3d2fda6d46d3c5fe9908a
> label: make sure labelled message is a string
>
> When color is enabled, it tries to split the message on newlines,
> which fails because we currently pass a context object as the
> message. It seems to make sense for ui.label() to require its message
> to be a string, so let's make sure that's what we pass.

I've already pushed a fix for that today. Thanks for looking into it!

Patch

diff --git a/hgext3rd/evolve/__init__.py b/hgext3rd/evolve/__init__.py
--- a/hgext3rd/evolve/__init__.py
+++ b/hgext3rd/evolve/__init__.py
@@ -2064,7 +2064,7 @@ 
                                    False, lambda: None, category='unstable')
                 if not result:
                     ui.status(_('working directory now at %s\n')
-                              % ui.label(repo['.'], 'evolve.node'))
+                              % ui.label(str(repo['.']), 'evolve.node'))
                 return result
             return 1
         return result
@@ -2271,7 +2271,7 @@ 
                     repo._bookmarks.recordchange(tr)
                 commands.update(ui, repo, newnode.rev())
                 ui.status(_('working directory now at %s\n')
-                          % ui.label(newnode, 'evolve.node'))
+                          % ui.label(str(newnode), 'evolve.node'))
                 if movebookmark:
                     bookmarksmod.activate(repo, bookactive)