hgkw/keyword.py
branchkwmap-templates
changeset 167 b0a5c3535727
parent 166 849e28e03fb4
child 168 368fbd5b054c
equal deleted inserted replaced
166:849e28e03fb4 167:b0a5c3535727
    96         'Source': '{root}/{file},v',
    96         'Source': '{root}/{file},v',
    97         'Id': '{file|basename},v {node|short} {date|utcdate} {author|user}',
    97         'Id': '{file|basename},v {node|short} {date|utcdate} {author|user}',
    98         'Header': '{root}/{file},v {node|short} {date|utcdate} {author|user}',
    98         'Header': '{root}/{file},v {node|short} {date|utcdate} {author|user}',
    99         }
    99         }
   100 
   100 
   101 kwcommands = ('status', 'commit', 'update', 'revert', 'backout', 'diff', 'cat',
   101 nokwcommands = ('rollback', 'incoming', 'outgoing', 'export', 'bundle', 'push')
   102               'archive', 'pull', 'unbundle', 'import')
       
   103 
   102 
   104 def utcdate(date):
   103 def utcdate(date):
   105     '''Returns hgdate in cvs-like UTC format.'''
   104     '''Returns hgdate in cvs-like UTC format.'''
   106     return time.strftime('%Y/%m/%d %H:%M:%S', time.gmtime(date[0]))
   105     return time.strftime('%Y/%m/%d %H:%M:%S', time.gmtime(date[0]))
   107 
   106 
   215     Wraps commit to overwrite configured files with updated
   214     Wraps commit to overwrite configured files with updated
   216     keyword substitutions.
   215     keyword substitutions.
   217     This is done for local repos only, and only if there are
   216     This is done for local repos only, and only if there are
   218     files configured at all for keyword substitution.'''
   217     files configured at all for keyword substitution.'''
   219 
   218 
   220     if not repo.local() or getcmd(ui) not in kwcommands:
   219     if not repo.local() or getcmd(repo.ui) in nokwcommands:
   221         return
   220         return
   222 
   221 
   223     inc, exc = [], ['.hg*']
   222     inc, exc = [], ['.hg*']
   224     for pat, opt in ui.configitems('keyword'):
   223     for pat, opt in repo.ui.configitems('keyword'):
   225         if opt != 'ignore':
   224         if opt != 'ignore':
   226             inc.append(pat)
   225             inc.append(pat)
   227         else:
   226         else:
   228             exc.append(pat)
   227             exc.append(pat)
   229     if not inc:
   228     if not inc: