hgkw/kwutil.py
branchdecodefilter
changeset 16 e29cf107baf2
parent 14 b60345141aa5
equal deleted inserted replaced
15:4bd44185f781 16:e29cf107baf2
     6 def mkkw(repo, tip=False, node=''):
     6 def mkkw(repo, tip=False, node=''):
     7     '''Gathers info for Hg keyword and returns it as raw replacement string.'''
     7     '''Gathers info for Hg keyword and returns it as raw replacement string.'''
     8 
     8 
     9     # get hex
     9     # get hex
    10     if tip:
    10     if tip:
    11         parent1 = repo.changelog.tip()
    11         p = repo.changelog.tip()
    12     else:
    12     else:
    13         parent1 = repo.dirstate.parents()[0]
    13         p = repo.dirstate.parents()[0]
    14 
    14 
    15     if not node:
    15     if not node:
    16         node = repo.changectx(parent1)
    16         node = repo.changectx(p)
    17 
    17 
    18     user, date = repo.changelog.read(parent1)[1:3]
    18     user, date = repo.changelog.read(p)[1:3]
    19     user = util.shortuser(user)
    19     user = util.shortuser(user)
    20     date = util.datestr(date=date, format=util.defaultdateformats[0])
    20     date = util.datestr(date=date, format=util.defaultdateformats[0])
    21                                                # %Y-%m-%d %H:%M:%S
    21                                                # %Y-%m-%d %H:%M:%S
    22 
    22 
    23     return r'\1 %s %s %s $' % (node, date, user)
    23     return r'\1 %s %s %s $' % (node, date, user)