mercurial/templatekw.py
changeset 41728 36b62a522814
parent 41722 37b33c34bf4f
child 41772 52d4cb162902
equal deleted inserted replaced
41727:e1643a0455c8 41728:36b62a522814
   557 @templatekeyword('negrev', requires={'repo', 'ctx'})
   557 @templatekeyword('negrev', requires={'repo', 'ctx'})
   558 def shownegrev(context, mapping):
   558 def shownegrev(context, mapping):
   559     """Integer. The repository-local changeset negative revision number,
   559     """Integer. The repository-local changeset negative revision number,
   560     which counts in the opposite direction."""
   560     which counts in the opposite direction."""
   561     ctx = context.resource(mapping, 'ctx')
   561     ctx = context.resource(mapping, 'ctx')
   562     repo = context.resource(mapping, 'repo')
   562     rev = ctx.rev()
   563     return scmutil.intrev(ctx) - len(repo)
   563     if rev is None or rev < 0:  # wdir() or nullrev?
       
   564         return None
       
   565     repo = context.resource(mapping, 'repo')
       
   566     return rev - len(repo)
   564 
   567 
   565 @templatekeyword('node', requires={'ctx'})
   568 @templatekeyword('node', requires={'ctx'})
   566 def shownode(context, mapping):
   569 def shownode(context, mapping):
   567     """String. The changeset identification hash, as a 40 hexadecimal
   570     """String. The changeset identification hash, as a 40 hexadecimal
   568     digit string.
   571     digit string.