D5180: logtoprocess: fix message formatting
lothiraldan (Boris Feld)
phabricator at mercurial-scm.org
Mon Oct 22 11:49:58 EDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6bd477ee7294: logtoprocess: fix message formatting (authored by lothiraldan, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D5180?vs=12297&id=12306
REVISION DETAIL
https://phab.mercurial-scm.org/D5180
AFFECTED FILES
hgext/logtoprocess.py
tests/test-logtoprocess.t
CHANGE DETAILS
diff --git a/tests/test-logtoprocess.t b/tests/test-logtoprocess.t
--- a/tests/test-logtoprocess.t
+++ b/tests/test-logtoprocess.t
@@ -19,7 +19,7 @@
> )
> @command(b'foo', [])
> def foo(ui, repo):
- > ui.log('foo', 'a message: %(bar)s\n', bar='spam')
+ > ui.log('foo', 'a message: %s\n', 'spam')
> EOF
$ cp $HGRCPATH $HGRCPATH.bak
$ cat >> $HGRCPATH << EOF
@@ -39,7 +39,7 @@
> foo=(echo 'logtoprocess foo output:';
> echo "\$EVENT";
> echo "\$MSG1";
- > echo "\$OPT_BAR") > $TESTTMP/foo.log
+ > echo "\$MSG2") > $TESTTMP/foo.log
> EOF
Running a command triggers both a ui.log('command') and a
diff --git a/hgext/logtoprocess.py b/hgext/logtoprocess.py
--- a/hgext/logtoprocess.py
+++ b/hgext/logtoprocess.py
@@ -113,10 +113,8 @@
# try to format the log message given the remaining
# arguments
try:
- # Python string formatting with % either uses a
- # dictionary *or* tuple, but not both. If we have
- # keyword options, assume we need a mapping.
- formatted = msg[0] % (opts or msg[1:])
+ # Format the message as blackbox does
+ formatted = msg[0] % msg[1:]
except (TypeError, KeyError):
# Failed to apply the arguments, ignore
formatted = msg[0]
To: lothiraldan, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list