##// END OF EJS Templates
annotate: pass around full hex node until formatting plain output...
Yuya Nishihara -
r39833:a677261e default
parent child Browse files
Show More
@@ -303,6 +303,11 b' def annotate(ui, repo, *pats, **opts):'
303 ctx = scmutil.revsingle(repo, rev)
303 ctx = scmutil.revsingle(repo, rev)
304
304
305 rootfm = ui.formatter('annotate', opts)
305 rootfm = ui.formatter('annotate', opts)
306 if ui.debugflag:
307 shorthex = pycompat.identity
308 else:
309 def shorthex(h):
310 return h[:12]
306 if ui.quiet:
311 if ui.quiet:
307 datefunc = dateutil.shortdate
312 datefunc = dateutil.shortdate
308 else:
313 else:
@@ -312,7 +317,7 b' def annotate(ui, repo, *pats, **opts):'
312 if node is None:
317 if node is None:
313 return None
318 return None
314 else:
319 else:
315 return rootfm.hexfunc(node)
320 return hex(node)
316 if opts.get('changeset'):
321 if opts.get('changeset'):
317 # omit "+" suffix which is appended to node hex
322 # omit "+" suffix which is appended to node hex
318 def formatrev(rev):
323 def formatrev(rev):
@@ -326,14 +331,15 b' def annotate(ui, repo, *pats, **opts):'
326 return '%d+' % ctx.p1().rev()
331 return '%d+' % ctx.p1().rev()
327 else:
332 else:
328 return '%d ' % rev
333 return '%d ' % rev
329 def formathex(hex):
334 def formathex(h):
330 if hex is None:
335 if h is None:
331 return '%s+' % rootfm.hexfunc(ctx.p1().node())
336 return '%s+' % shorthex(hex(ctx.p1().node()))
332 else:
337 else:
333 return '%s ' % hex
338 return '%s ' % shorthex(h)
334 else:
339 else:
335 hexfn = rootfm.hexfunc
340 hexfn = hex
336 formatrev = formathex = pycompat.bytestr
341 formatrev = b'%d'.__mod__
342 formathex = shorthex
337
343
338 opmap = [('user', ' ', lambda x: x.fctx.user(), ui.shortuser),
344 opmap = [('user', ' ', lambda x: x.fctx.user(), ui.shortuser),
339 ('rev', ' ', lambda x: x.fctx.rev(), formatrev),
345 ('rev', ' ', lambda x: x.fctx.rev(), formatrev),
General Comments 0
You need to be logged in to leave comments. Login now