Patchwork [2,of,4] filemerge: make warning message more i18n friendly

login
register
mail settings
Submitter Katsunori FUJIWARA
Date May 12, 2017, 6:42 p.m.
Message ID <44e2659be1bd4f1b59db.1494614529@speaknoevil>
Download mbox | patch
Permalink /patch/20588/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - May 12, 2017, 6:42 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1494613716 -32400
#      Sat May 13 03:28:36 2017 +0900
# Node ID 44e2659be1bd4f1b59dbf2b5bf575c179730cd75
# Parent  2a8d68ad3b70ecc418ed280c0677b0d7a2b27d0e
filemerge: make warning message more i18n friendly

Before this patch, " specified for " part of warning messages
(e.g. "couldn't find merge tool TOOL specified for PAT") isn't
translatable.

Patch

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -133,7 +133,7 @@  def _picktool(repo, ui, path, binary, sy
     def check(tool, pat, symlink, binary, changedelete):
         tmsg = tool
         if pat:
-            tmsg += " specified for " + pat
+            tmsg = _("%s (for pattern %s)") % (tool, pat)
         if not _findtool(ui, tool):
             if pat: # explicitly requested tool deserves a warning
                 ui.warn(_("couldn't find merge tool %s\n") % tmsg)
diff --git a/tests/test-merge-tools.t b/tests/test-merge-tools.t
--- a/tests/test-merge-tools.t
+++ b/tests/test-merge-tools.t
@@ -392,9 +392,9 @@  merge-patterns specifies executable not 
   true.executable=cat
   # hg update -C 1
   $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistentmergetool
-  couldn't find merge tool true specified for f
-  merging f
-  couldn't find merge tool true specified for f
+  couldn't find merge tool true (for pattern f)
+  merging f
+  couldn't find merge tool true (for pattern f)
   merging f failed!
   0 files updated, 0 files merged, 0 files removed, 1 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
@@ -418,9 +418,9 @@  merge-patterns specifies executable with
   true.executable=cat
   # hg update -C 1
   $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexistent/mergetool
-  couldn't find merge tool true specified for f
-  merging f
-  couldn't find merge tool true specified for f
+  couldn't find merge tool true (for pattern f)
+  merging f
+  couldn't find merge tool true (for pattern f)
   merging f failed!
   0 files updated, 0 files merged, 0 files removed, 1 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon