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