[PATCH 2 of 2] sparse: use named parameters in i18n strings

Yuya Nishihara yuya at tcha.org
Sat Aug 4 08:14:26 EDT 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1533370651 -32400
#      Sat Aug 04 17:17:31 2018 +0900
# Node ID 6be3eb0c37638c886c8113a7cf51d9c69b40fcb9
# Parent  b2afb0058fd7143c12cb6ef3466ec85ee71ba8ce
sparse: use named parameters in i18n strings

This should give more hints about what the %s means, and allow reordering.

diff --git a/mercurial/sparse.py b/mercurial/sparse.py
--- a/mercurial/sparse.py
+++ b/mercurial/sparse.py
@@ -56,8 +56,8 @@ def parseconfig(ui, raw, action):
         elif line == '[include]':
             if havesection and current != includes:
                 # TODO pass filename into this API so we can report it.
-                raise error.Abort(_('%s config cannot have includes '
-                                    'after excludes') % action)
+                raise error.Abort(_('%(action)s config cannot have includes '
+                                    'after excludes') % {'action': action})
             havesection = True
             current = includes
             continue
@@ -66,15 +66,16 @@ def parseconfig(ui, raw, action):
             current = excludes
         elif line:
             if current is None:
-                raise error.Abort(_('%s config entry outside of '
-                                    'section: %s') % (action, line),
+                raise error.Abort(_('%(action)s config entry outside of '
+                                    'section: %(line)s')
+                                  % {'action': action, 'line': line},
                                   hint=_('add an [include] or [exclude] line '
                                          'to declare the entry type'))
 
             if line.strip().startswith('/'):
-                ui.warn(_('warning: %s profile cannot use'
-                          ' paths starting with /, ignoring %s\n')
-                        % (action, line))
+                ui.warn(_('warning: %(action)s profile cannot use'
+                          ' paths starting with /, ignoring %(line)s\n')
+                        % {'action': action, 'line': line})
                 continue
             current.add(line)
 


More information about the Mercurial-devel mailing list