comparison mercurial/logcmdutil.py @ 39795:ba93db1745ba

log: have changesetformatter fill in wdir() rev and node (BC) This matches the behavior of the default template keywords. wdir() support is still experimental so we can change the output.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 15 Sep 2018 17:26:20 +0900
parents fa681452b249
children 94ca3579e84e
comparison
equal deleted inserted replaced
39794:4f44f747f094 39795:ba93db1745ba
323 323
324 def _show(self, ctx, copies, props): 324 def _show(self, ctx, copies, props):
325 '''show a single changeset or file revision''' 325 '''show a single changeset or file revision'''
326 fm = self._fm 326 fm = self._fm
327 fm.startitem() 327 fm.startitem()
328
329 fm.context(ctx=ctx) 328 fm.context(ctx=ctx)
330 # TODO: maybe this should be wdirrev/wdirnode? 329 fm.data(rev=scmutil.intrev(ctx),
331 rev = ctx.rev() 330 node=fm.hexfunc(scmutil.binnode(ctx)))
332 if rev is None:
333 hexnode = None
334 else:
335 hexnode = fm.hexfunc(ctx.node())
336 fm.data(rev=rev,
337 node=hexnode)
338 331
339 if self.ui.quiet: 332 if self.ui.quiet:
340 return 333 return
341 334
342 fm.data(branch=ctx.branch(), 335 fm.data(branch=ctx.branch(),
348 tags=fm.formatlist(ctx.tags(), name='tag'), 341 tags=fm.formatlist(ctx.tags(), name='tag'),
349 parents=fm.formatlist([fm.hexfunc(c.node()) 342 parents=fm.formatlist([fm.hexfunc(c.node())
350 for c in ctx.parents()], name='node')) 343 for c in ctx.parents()], name='node'))
351 344
352 if self.ui.debugflag: 345 if self.ui.debugflag:
353 if rev is None: 346 if ctx.rev() is None:
354 hexnode = None 347 hexnode = None
355 else: 348 else:
356 hexnode = fm.hexfunc(ctx.manifestnode()) 349 hexnode = fm.hexfunc(ctx.manifestnode())
357 fm.data(manifest=hexnode, 350 fm.data(manifest=hexnode,
358 extra=fm.formatdict(ctx.extra())) 351 extra=fm.formatdict(ctx.extra()))