mercurial/logcmdutil.py
changeset 39796 94ca3579e84e
parent 39795 ba93db1745ba
child 40285 96164fb9b913
equal deleted inserted replaced
39795:ba93db1745ba 39796:94ca3579e84e
    11 import os
    11 import os
    12 
    12 
    13 from .i18n import _
    13 from .i18n import _
    14 from .node import (
    14 from .node import (
    15     nullid,
    15     nullid,
       
    16     wdirid,
       
    17     wdirrev,
    16 )
    18 )
    17 
    19 
    18 from . import (
    20 from . import (
    19     dagop,
    21     dagop,
    20     error,
    22     error,
   189             self._show(ctx, copies, props)
   191             self._show(ctx, copies, props)
   190 
   192 
   191     def _show(self, ctx, copies, props):
   193     def _show(self, ctx, copies, props):
   192         '''show a single changeset or file revision'''
   194         '''show a single changeset or file revision'''
   193         changenode = ctx.node()
   195         changenode = ctx.node()
   194         rev = ctx.rev()
       
   195 
   196 
   196         if self.ui.quiet:
   197         if self.ui.quiet:
   197             self.ui.write("%s\n" % scmutil.formatchangeid(ctx),
   198             self.ui.write("%s\n" % scmutil.formatchangeid(ctx),
   198                           label='log.node')
   199                           label='log.node')
   199             return
   200             return
   224         for pctx in scmutil.meaningfulparents(self.repo, ctx):
   225         for pctx in scmutil.meaningfulparents(self.repo, ctx):
   225             label = 'log.parent changeset.%s' % pctx.phasestr()
   226             label = 'log.parent changeset.%s' % pctx.phasestr()
   226             self.ui.write(columns['parent'] % scmutil.formatchangeid(pctx),
   227             self.ui.write(columns['parent'] % scmutil.formatchangeid(pctx),
   227                           label=label)
   228                           label=label)
   228 
   229 
   229         if self.ui.debugflag and rev is not None:
   230         if self.ui.debugflag:
   230             mnode = ctx.manifestnode()
   231             mnode = ctx.manifestnode()
   231             mrev = self.repo.manifestlog.rev(mnode)
   232             if mnode is None:
       
   233                 mnode = wdirid
       
   234                 mrev = wdirrev
       
   235             else:
       
   236                 mrev = self.repo.manifestlog.rev(mnode)
   232             self.ui.write(columns['manifest']
   237             self.ui.write(columns['manifest']
   233                           % scmutil.formatrevnode(self.ui, mrev, mnode),
   238                           % scmutil.formatrevnode(self.ui, mrev, mnode),
   234                           label='ui.debug log.manifest')
   239                           label='ui.debug log.manifest')
   235         self.ui.write(columns['user'] % ctx.user(), label='log.user')
   240         self.ui.write(columns['user'] % ctx.user(), label='log.user')
   236         self.ui.write(columns['date'] % dateutil.datestr(ctx.date()),
   241         self.ui.write(columns['date'] % dateutil.datestr(ctx.date()),
   341                 tags=fm.formatlist(ctx.tags(), name='tag'),
   346                 tags=fm.formatlist(ctx.tags(), name='tag'),
   342                 parents=fm.formatlist([fm.hexfunc(c.node())
   347                 parents=fm.formatlist([fm.hexfunc(c.node())
   343                                        for c in ctx.parents()], name='node'))
   348                                        for c in ctx.parents()], name='node'))
   344 
   349 
   345         if self.ui.debugflag:
   350         if self.ui.debugflag:
   346             if ctx.rev() is None:
   351             fm.data(manifest=fm.hexfunc(ctx.manifestnode() or wdirid),
   347                 hexnode = None
       
   348             else:
       
   349                 hexnode = fm.hexfunc(ctx.manifestnode())
       
   350             fm.data(manifest=hexnode,
       
   351                     extra=fm.formatdict(ctx.extra()))
   352                     extra=fm.formatdict(ctx.extra()))
   352 
   353 
   353             files = ctx.p1().status(ctx)
   354             files = ctx.p1().status(ctx)
   354             fm.data(modified=fm.formatlist(files[0], name='file'),
   355             fm.data(modified=fm.formatlist(files[0], name='file'),
   355                     added=fm.formatlist(files[1], name='file'),
   356                     added=fm.formatlist(files[1], name='file'),