From patchwork Sun Apr 13 13:32:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1,of,3,STABLE] i18n: fix "% inside _()" problems From: Katsunori FUJIWARA X-Patchwork-Id: 4314 Message-Id: <6c252c9898beaedcf323.1397395937@feefifofum> To: mercurial-devel@selenic.com Date: Sun, 13 Apr 2014 22:32:17 +0900 # HG changeset patch # User FUJIWARA Katsunori # Date 1397394948 -32400 # Sun Apr 13 22:15:48 2014 +0900 # Branch stable # Node ID 6c252c9898beaedcf3230741445310b0071e5cb4 # Parent 469d949a7cb8d20e0fee7464c3b12dcac1e55d4c 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 there are white-space characters between the left parenthesis of "_()" and the format string. This patch adds regexp pattern "[ \t\n]*" to match against such white-space characters. "[\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 --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -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'[^_]_\((?:"[^"]+"[ \t\n+]*)+%', "don't use % inside _()"), - (r"[^_]_\((?:'[^']+'[ \t\n+]*)+%", "don't use % inside _()"), + (r'[^_]_\([ \t\n]*(?:"[^"]+"[ \t\n+]*)+%', "don't use % inside _()"), + (r"[^_]_\([ \t\n]*(?:'[^']+'[ \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 --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -760,8 +760,8 @@ d = hg.defaultdest(source) if opts.get('all_largefiles') and not hg.islocal(d): raise util.Abort(_( - '--all-largefiles is incompatible with non-local destination %s' % - d)) + '--all-largefiles is incompatible with non-local destination %s') % + d) return orig(ui, source, dest, **opts)