comparison mercurial/revset.py @ 36580:04e50037d957

revset: use {force,}bytestr to fix some %r formatting issues Differential Revision: https://phab.mercurial-scm.org/D2556
author Augie Fackler <augie@google.com>
date Fri, 02 Mar 2018 11:37:21 -0500
parents 7a991241f586
children b755eab7e677
comparison
equal deleted inserted replaced
36579:be27c4e310bd 36580:04e50037d957
1009 """ 1009 """
1010 try: 1010 try:
1011 # i18n: "grep" is a keyword 1011 # i18n: "grep" is a keyword
1012 gr = re.compile(getstring(x, _("grep requires a string"))) 1012 gr = re.compile(getstring(x, _("grep requires a string")))
1013 except re.error as e: 1013 except re.error as e:
1014 raise error.ParseError(_('invalid match pattern: %s') % e) 1014 raise error.ParseError(
1015 _('invalid match pattern: %s') % util.forcebytestr(e))
1015 1016
1016 def matches(x): 1017 def matches(x):
1017 c = repo[x] 1018 c = repo[x]
1018 for e in c.files() + [c.user(), c.description()]: 1019 for e in c.files() + [c.user(), c.description()]:
1019 if gr.search(e): 1020 if gr.search(e):
1843 fk = k 1844 fk = k
1844 reverse = (k.startswith('-')) 1845 reverse = (k.startswith('-'))
1845 if reverse: 1846 if reverse:
1846 k = k[1:] 1847 k = k[1:]
1847 if k not in _sortkeyfuncs and k != 'topo': 1848 if k not in _sortkeyfuncs and k != 'topo':
1848 raise error.ParseError(_("unknown sort key %r") % fk) 1849 raise error.ParseError(
1850 _("unknown sort key %r") % pycompat.bytestr(fk))
1849 keyflags.append((k, reverse)) 1851 keyflags.append((k, reverse))
1850 1852
1851 if len(keyflags) > 1 and any(k == 'topo' for k, reverse in keyflags): 1853 if len(keyflags) > 1 and any(k == 'topo' for k, reverse in keyflags):
1852 # i18n: "topo" is a keyword 1854 # i18n: "topo" is a keyword
1853 raise error.ParseError(_('topo sort order cannot be combined ' 1855 raise error.ParseError(_('topo sort order cannot be combined '