hgkw/keyword.py
branchself_initializing_hook
changeset 89 16f1a5ed70ce
parent 88 ffec227fced3
child 90 2e930f842242
equal deleted inserted replaced
88:ffec227fced3 89:16f1a5ed70ce
    45     '''Called by kwfilelog.read and pretxnkw.
    45     '''Called by kwfilelog.read and pretxnkw.
    46     Sets supported keywords as local variables and evaluates them to
    46     Sets supported keywords as local variables and evaluates them to
    47     their expansion if matchobj is equal to string representation.'''
    47     their expansion if matchobj is equal to string representation.'''
    48     c = context.filectx(repo, path,
    48     c = context.filectx(repo, path,
    49             changeid=changeid, fileid=fileid, filelog=filelog)
    49             changeid=changeid, fileid=fileid, filelog=filelog)
    50     date = c.date()
    50     def Revision():
    51     Revision = c.changectx()
    51         return c.changectx()
    52     Author = c.user()
    52     def Author():
    53     RCSFile = os.path.basename(path)+',v'
    53         return c.user()
    54     Source = repo.wjoin(path)+',v'
    54     def Date():
    55     Date = util.datestr(date=date)
    55         return util.datestr(date=c.date())
    56     revdateauth = '%s %s %s' % (Revision,
    56     def RCSFile():
    57             util.datestr(date=date, format=util.defaultdateformats[0]),
    57         return os.path.basename(path)+',v'
    58             util.shortuser(Author))
    58     def Source():
    59     Header = '%s %s' % (Source, revdateauth)
    59         return repo.wjoin(path)+',v'
    60     Id = '%s %s' % (RCSFile, revdateauth)
    60     def revdateauth():
    61     return '$%s: %s $' % (matchobj.group(1), eval(matchobj.group(1)))
    61         return '%s %s %s' % (c.changectx(),
       
    62             util.datestr(date=c.date(), format=util.defaultdateformats[0]),
       
    63             util.shortuser(c.user()))
       
    64     def Header():
       
    65         return '%s %s' % (Source(), revdateauth())
       
    66     def Id():
       
    67         return '%s %s' % (RCSFile(), revdateauth())
       
    68     return '$%s: %s $' % (matchobj.group(1), eval('%s()' % matchobj.group(1)))
    62 
    69 
    63 def kwfmatches(ui, repo, files):
    70 def kwfmatches(ui, repo, files):
    64     '''Selects candidates for keyword substitution
    71     '''Selects candidates for keyword substitution
    65     configured in keyword section in hgrc.'''
    72     configured in keyword section in hgrc.'''
    66     files = [f for f in files if not f.startswith('.hg')]
    73     files = [f for f in files if not f.startswith('.hg')]