##// END OF EJS Templates
py3: replace str() with pycompat.bytestr() or ('%d' % int)...
Pulkit Goyal -
r40763:001f2797 default
parent child Browse files
Show More
@@ -39,23 +39,26 b' class defaultformatter(object):'
39 orig = hexfunc
39 orig = hexfunc
40 hexfunc = lambda x: None if x is None else orig(x)
40 hexfunc = lambda x: None if x is None else orig(x)
41 wnode = hexfunc(repo[None].p1().node()) + '+'
41 wnode = hexfunc(repo[None].p1().node()) + '+'
42 wrev = str(repo[None].p1().rev())
42 wrev = '%d' % repo[None].p1().rev()
43 wrevpad = ''
43 wrevpad = ''
44 if not opts.get('changeset'): # only show + if changeset is hidden
44 if not opts.get('changeset'): # only show + if changeset is hidden
45 wrev += '+'
45 wrev += '+'
46 wrevpad = ' '
46 wrevpad = ' '
47 revenc = lambda x: wrev if x is None else str(x) + wrevpad
47 revenc = lambda x: wrev if x is None else ('%d' % x) + wrevpad
48 csetenc = lambda x: wnode if x is None else str(x) + ' '
48 def csetenc(x):
49 if x is None:
50 return wnode
51 return pycompat.bytestr(x) + ' '
49 else:
52 else:
50 revenc = csetenc = str
53 revenc = csetenc = pycompat.bytestr
51
54
52 # opt name, separator, raw value (for json/plain), encoder (for plain)
55 # opt name, separator, raw value (for json/plain), encoder (for plain)
53 opmap = [('user', ' ', lambda x: getctx(x).user(), ui.shortuser),
56 opmap = [('user', ' ', lambda x: getctx(x).user(), ui.shortuser),
54 ('number', ' ', lambda x: getctx(x).rev(), revenc),
57 ('number', ' ', lambda x: getctx(x).rev(), revenc),
55 ('changeset', ' ', lambda x: hexfunc(x[0]), csetenc),
58 ('changeset', ' ', lambda x: hexfunc(x[0]), csetenc),
56 ('date', ' ', lambda x: getctx(x).date(), datefunc),
59 ('date', ' ', lambda x: getctx(x).date(), datefunc),
57 ('file', ' ', lambda x: x[2], str),
60 ('file', ' ', lambda x: x[2], pycompat.bytestr),
58 ('line_number', ':', lambda x: x[1] + 1, str)]
61 ('line_number', ':', lambda x: x[1] + 1, pycompat.bytestr)]
59 fieldnamemap = {'number': 'rev', 'changeset': 'node'}
62 fieldnamemap = {'number': 'rev', 'changeset': 'node'}
60 funcmap = [(get, sep, fieldnamemap.get(op, op), enc)
63 funcmap = [(get, sep, fieldnamemap.get(op, op), enc)
61 for op, sep, get, enc in opmap
64 for op, sep, get, enc in opmap
General Comments 0
You need to be logged in to leave comments. Login now