Mercurial > hg
changeset 35557:2df8d12f23bc
revsetlang: avoid string concatenation in formatspec()
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 01 Apr 2017 16:50:11 +0900 |
parents | b58964b9b541 |
children | dfc628611144 |
files | mercurial/revsetlang.py |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revsetlang.py Thu Jan 04 12:30:55 2018 +0900 +++ b/mercurial/revsetlang.py Sat Apr 01 16:50:11 2017 +0900 @@ -620,7 +620,7 @@ return '(%s or %s)' % (listexp(s[:m], t), listexp(s[m:], t)) expr = pycompat.bytestr(expr) - ret = '' + ret = [] pos = 0 arg = 0 while pos < len(expr): @@ -629,24 +629,24 @@ pos += 1 d = expr[pos] if d == '%': - ret += d + ret.append(d) elif d in 'dsnbr': - ret += argtype(d, args[arg]) + ret.append(argtype(d, args[arg])) arg += 1 elif d == 'l': # a list of some type pos += 1 d = expr[pos] - ret += listexp(list(args[arg]), d) + ret.append(listexp(list(args[arg]), d)) arg += 1 else: raise error.Abort(_('unexpected revspec format character %s') % d) else: - ret += c + ret.append(c) pos += 1 - return ret + return ''.join(ret) def prettyformat(tree): return parser.prettyformat(tree, ('string', 'symbol'))