##// END OF EJS Templates
py3: drop b'' from repr() of smartset...
Yuya Nishihara -
r35922:fc44c265 default
parent child Browse files
Show More
@@ -1563,11 +1563,6 b" def export(repo, revs, fntemplate='hg-%h"
1563 if fo is not None:
1563 if fo is not None:
1564 fo.close()
1564 fo.close()
1565
1565
1566 def _maybebytestr(v):
1567 if isinstance(v, bytes):
1568 return pycompat.bytestr(v)
1569 return v
1570
1571 def showmarker(fm, marker, index=None):
1566 def showmarker(fm, marker, index=None):
1572 """utility function to display obsolescence marker in a readable way
1567 """utility function to display obsolescence marker in a readable way
1573
1568
@@ -1586,7 +1581,7 b' def showmarker(fm, marker, index=None):'
1586 fm.write('date', '(%s) ', fm.formatdate(marker.date()))
1581 fm.write('date', '(%s) ', fm.formatdate(marker.date()))
1587 meta = marker.metadata().copy()
1582 meta = marker.metadata().copy()
1588 meta.pop('date', None)
1583 meta.pop('date', None)
1589 smeta = util.rapply(_maybebytestr, meta)
1584 smeta = util.rapply(pycompat.maybebytestr, meta)
1590 fm.write('metadata', '{%s}', fm.formatdict(smeta, fmt='%r: %r', sep=', '))
1585 fm.write('metadata', '{%s}', fm.formatdict(smeta, fmt='%r: %r', sep=', '))
1591 fm.plain('\n')
1586 fm.plain('\n')
1592
1587
@@ -161,6 +161,12 b' if ispy3:'
161 """Iterate bytes as if it were a str object of Python 2"""
161 """Iterate bytes as if it were a str object of Python 2"""
162 return map(bytechr, s)
162 return map(bytechr, s)
163
163
164 def maybebytestr(s):
165 """Promote bytes to bytestr"""
166 if isinstance(s, bytes):
167 return bytestr(s)
168 return s
169
164 def sysbytes(s):
170 def sysbytes(s):
165 """Convert an internal str (e.g. keyword, __doc__) back to bytes
171 """Convert an internal str (e.g. keyword, __doc__) back to bytes
166
172
@@ -267,6 +273,7 b' else:'
267 bytechr = chr
273 bytechr = chr
268 bytestr = str
274 bytestr = str
269 iterbytestr = iter
275 iterbytestr = iter
276 maybebytestr = identity
270 sysbytes = identity
277 sysbytes = identity
271 sysstr = identity
278 sysstr = identity
272 strurl = identity
279 strurl = identity
@@ -105,6 +105,9 b' def _getrevsource(repo, r):'
105 pass
105 pass
106 return None
106 return None
107
107
108 def _sortedb(xs):
109 return sorted(util.rapply(pycompat.maybebytestr, xs))
110
108 # operator methods
111 # operator methods
109
112
110 def stringset(repo, subset, x, order):
113 def stringset(repo, subset, x, order):
@@ -507,7 +510,7 b' def branch(repo, subset, x):'
507 b.add(getbranch(r))
510 b.add(getbranch(r))
508 c = s.__contains__
511 c = s.__contains__
509 return subset.filter(lambda r: c(r) or getbranch(r) in b,
512 return subset.filter(lambda r: c(r) or getbranch(r) in b,
510 condrepr=lambda: '<branch %r>' % sorted(b))
513 condrepr=lambda: '<branch %r>' % _sortedb(b))
511
514
512 @predicate('phasedivergent()', safe=True)
515 @predicate('phasedivergent()', safe=True)
513 def phasedivergent(repo, subset, x):
516 def phasedivergent(repo, subset, x):
@@ -760,7 +763,7 b' def destination(repo, subset, x):'
760 src = _getrevsource(repo, r)
763 src = _getrevsource(repo, r)
761
764
762 return subset.filter(dests.__contains__,
765 return subset.filter(dests.__contains__,
763 condrepr=lambda: '<destination %r>' % sorted(dests))
766 condrepr=lambda: '<destination %r>' % _sortedb(dests))
764
767
765 @predicate('contentdivergent()', safe=True)
768 @predicate('contentdivergent()', safe=True)
766 def contentdivergent(repo, subset, x):
769 def contentdivergent(repo, subset, x):
@@ -29,7 +29,7 b' def _formatsetrepr(r):'
29 if r is None:
29 if r is None:
30 return ''
30 return ''
31 elif isinstance(r, tuple):
31 elif isinstance(r, tuple):
32 return r[0] % r[1:]
32 return r[0] % util.rapply(pycompat.maybebytestr, r[1:])
33 elif isinstance(r, bytes):
33 elif isinstance(r, bytes):
34 return r
34 return r
35 elif callable(r):
35 elif callable(r):
General Comments 0
You need to be logged in to leave comments. Login now