mercurial/templatekw.py
changeset 17355 c25531ed58b0
parent 17187 293dd81e4601
child 17358 2917f82f6040
equal deleted inserted replaced
17354:c87ba0a6fb79 17355:c25531ed58b0
   273     """:node: String. The changeset identification hash, as a 40 hexadecimal
   273     """:node: String. The changeset identification hash, as a 40 hexadecimal
   274     digit string.
   274     digit string.
   275     """
   275     """
   276     return ctx.hex()
   276     return ctx.hex()
   277 
   277 
       
   278 def showparent1(repo, ctx, templ, **args):
       
   279     """:parent1: Integer. The repository-local revision number of the
       
   280     changeset's first parent, or -1 if the changeset has no parents."""
       
   281     return ctx.parents()[0].rev()
       
   282 
       
   283 def showparent2(repo, ctx, templ, **args):
       
   284     """:parent2: Integer. The repository-local revision number of the
       
   285     changeset's second parent, or -1 if the changeset has no second parent."""
       
   286     parents = ctx.parents()
       
   287     if len(parents) > 1:
       
   288         return parents[1].rev()
       
   289     else:
       
   290         return repo['null'].rev()
       
   291 
       
   292 def showparent1node(repo, ctx, templ, **args):
       
   293     """:parent1node: String. The identification hash of the changeset's
       
   294     first parent, as a 40 digit hexadecimal string. If the changeset has no
       
   295     parents, all digits are 0."""
       
   296     return ctx.parents()[0].hex()
       
   297 
       
   298 def showparent2node(repo, ctx, templ, **args):
       
   299     """:parent2node: String. The identification hash of the changeset's
       
   300     second parent, as a 40 digit hexadecimal string. If the changeset has no
       
   301     second parent, all digits are 0."""
       
   302     parents = ctx.parents()
       
   303     if len(parents) > 1:
       
   304         return parents[1].hex()
       
   305     else:
       
   306         return repo['null'].hex()
       
   307 
   278 def showphase(repo, ctx, templ, **args):
   308 def showphase(repo, ctx, templ, **args):
   279     """:phase: String. The changeset phase name."""
   309     """:phase: String. The changeset phase name."""
   280     return ctx.phasestr()
   310     return ctx.phasestr()
   281 
   311 
   282 def showphaseidx(repo, ctx, templ, **args):
   312 def showphaseidx(repo, ctx, templ, **args):
   318     'files': showfiles,
   348     'files': showfiles,
   319     'latesttag': showlatesttag,
   349     'latesttag': showlatesttag,
   320     'latesttagdistance': showlatesttagdistance,
   350     'latesttagdistance': showlatesttagdistance,
   321     'manifest': showmanifest,
   351     'manifest': showmanifest,
   322     'node': shownode,
   352     'node': shownode,
       
   353     'parent1': showparent1,
       
   354     'parent1node': showparent1node,
       
   355     'parent2': showparent2,
       
   356     'parent2node': showparent2node,
   323     'phase': showphase,
   357     'phase': showphase,
   324     'phaseidx': showphaseidx,
   358     'phaseidx': showphaseidx,
   325     'rev': showrev,
   359     'rev': showrev,
   326     'tags': showtags,
   360     'tags': showtags,
   327 }
   361 }