mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
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 format string consists of multiple string components concatenated implicitly or explicitly, This patch does below for that regexp pattern to detect "% inside _()" problems in such case. - put "+" into separator part ("[ \t\n]") for explicit concatenation ("...." + "...." style) - enclose "component and separator" part by "(?:....)+" for concatenation itself ("...." "...." or "...." + "....")
This commit is contained in:
parent
01d8b27701
commit
0eed53de6c
@ -198,8 +198,8 @@ pypats = [
|
||||
(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+]*)+%', "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"),
|
||||
|
@ -344,7 +344,7 @@ def reposetup(ui, repo):
|
||||
continue
|
||||
if inconsistenteol(data):
|
||||
raise util.Abort(_("inconsistent newline style "
|
||||
"in %s\n" % f))
|
||||
"in %s\n") % f)
|
||||
return super(eolrepo, self).commitctx(ctx, error)
|
||||
repo.__class__ = eolrepo
|
||||
repo._hgcleardirstate()
|
||||
|
@ -711,7 +711,7 @@ class patchfile(object):
|
||||
if self.exists and self.create:
|
||||
if self.copysource:
|
||||
self.ui.warn(_("cannot create %s: destination already "
|
||||
"exists\n" % self.fname))
|
||||
"exists\n") % self.fname)
|
||||
else:
|
||||
self.ui.warn(_("file %s already exists\n") % self.fname)
|
||||
self.rej.append(h)
|
||||
|
@ -1021,7 +1021,7 @@ class svnsubrepo(abstractsubrepo):
|
||||
def remove(self):
|
||||
if self.dirty():
|
||||
self._ui.warn(_('not removing repo %s because '
|
||||
'it has changes.\n' % self._path))
|
||||
'it has changes.\n') % self._path)
|
||||
return
|
||||
self._ui.note(_('removing subrepo %s\n') % self._path)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user