# HG changeset patch # User FUJIWARA Katsunori # Date 1396287963 -32400 # Node ID 5db105f216c3474f11bbe265227b94a17c1da051 # Parent 539d9f839197cc7ee9698efbb6c470c0e34f2c74 i18n: fix "% inside _()" problems Before this patch, "contrib/check-code.py" can't detect these problems, because the regexp pattern to detect "% inside _()" doesn't suppose the case that the format string and "%" aren't placed in the same line. This patch replaces "\s" in that regexp pattern with "[ \t\n]" to detect "% inside _()" problems in such case. "[\s\n]" can't be used in this purpose, because "\s" is automatically replaced with "[ \t]" by "_preparepats()" and "\s" in "[]" causes nested "[]" unexpectedly. diff -r 539d9f839197 -r 5db105f216c3 contrib/check-code.py --- a/contrib/check-code.py Tue Apr 01 02:46:03 2014 +0900 +++ b/contrib/check-code.py Tue Apr 01 02:46:03 2014 +0900 @@ -198,8 +198,8 @@ (r'\s<>\s', '<> operator is not available in Python 3+, use !='), (r'^\s*\t', "don't use tabs"), (r'\S;\s*\n', "semicolon"), - (r'[^_]_\("[^"]+"\s*%', "don't use % inside _()"), - (r"[^_]_\('[^']+'\s*%", "don't use % inside _()"), + (r'[^_]_\("[^"]+"[ \t\n]*%', "don't use % inside _()"), + (r"[^_]_\('[^']+'[ \t\n]*%", "don't use % inside _()"), (r'(\w|\)),\w', "missing whitespace after ,"), (r'(\w|\))[+/*\-<>]\w', "missing whitespace in expression"), (r'^\s+(\w|\.)+=\w[^,()\n]*$', "missing whitespace in assignment"), diff -r 539d9f839197 -r 5db105f216c3 hgext/largefiles/lfcommands.py --- a/hgext/largefiles/lfcommands.py Tue Apr 01 02:46:03 2014 +0900 +++ b/hgext/largefiles/lfcommands.py Tue Apr 01 02:46:03 2014 +0900 @@ -303,14 +303,14 @@ try: id, name = line.split(' ', 1) except ValueError: - ui.warn(_('skipping incorrectly formatted tag %s\n' - % line)) + ui.warn(_('skipping incorrectly formatted tag %s\n') + % line) continue try: newid = node.bin(id) except TypeError: - ui.warn(_('skipping incorrectly formatted id %s\n' - % id)) + ui.warn(_('skipping incorrectly formatted id %s\n') + % id) continue try: newdata.append('%s %s\n' % (node.hex(revmap[newid]), diff -r 539d9f839197 -r 5db105f216c3 mercurial/commands.py --- a/mercurial/commands.py Tue Apr 01 02:46:03 2014 +0900 +++ b/mercurial/commands.py Tue Apr 01 02:46:03 2014 +0900 @@ -752,8 +752,8 @@ if not changesets: extendnode = extendbisectrange(nodes, good) if extendnode is not None: - ui.write(_("Extending search to changeset %d:%s\n" - % (extendnode.rev(), extendnode))) + ui.write(_("Extending search to changeset %d:%s\n") + % (extendnode.rev(), extendnode)) state['current'] = [extendnode.node()] hbisect.save_state(repo, state) if noupdate: diff -r 539d9f839197 -r 5db105f216c3 mercurial/hg.py --- a/mercurial/hg.py Tue Apr 01 02:46:03 2014 +0900 +++ b/mercurial/hg.py Tue Apr 01 02:46:03 2014 +0900 @@ -433,7 +433,7 @@ if bn == 'default': status = _("updating to bookmark @\n") else: - status = _("updating to bookmark @ on branch %s\n" + status = (_("updating to bookmark @ on branch %s\n") % bn) except KeyError: try: diff -r 539d9f839197 -r 5db105f216c3 mercurial/merge.py --- a/mercurial/merge.py Tue Apr 01 02:46:03 2014 +0900 +++ b/mercurial/merge.py Tue Apr 01 02:46:03 2014 +0900 @@ -70,8 +70,8 @@ bits = record.split("\0") self._state[bits[0]] = bits[1:] elif not rtype.islower(): - raise util.Abort(_('unsupported merge state record: %s' - % rtype)) + raise util.Abort(_('unsupported merge state record: %s') + % rtype) self._dirty = False def _readrecords(self): v1records = self._readrecordsv1() diff -r 539d9f839197 -r 5db105f216c3 mercurial/subrepo.py --- a/mercurial/subrepo.py Tue Apr 01 02:46:03 2014 +0900 +++ b/mercurial/subrepo.py Tue Apr 01 02:46:03 2014 +0900 @@ -321,8 +321,8 @@ for f in names: if f.lower() == 'hgrc': ui.warn( - _("warning: removing potentially hostile .hg/hgrc in '%s'" - % path)) + _("warning: removing potentially hostile .hg/hgrc in '%s'") + % path) os.unlink(os.path.join(dirname, f)) os.walk(path, v, None)