hgkw/keyword.py
changeset 636 d0c35f5fa25f
parent 635 49307521cf96
child 646 c2b1a05b35e1
equal deleted inserted replaced
635:49307521cf96 636:d0c35f5fa25f
    80 from mercurial import patch, localrepo, templater, templatefilters, util, match
    80 from mercurial import patch, localrepo, templater, templatefilters, util, match
    81 from mercurial.hgweb import webcommands
    81 from mercurial.hgweb import webcommands
    82 from mercurial.lock import release
    82 from mercurial.lock import release
    83 from mercurial.node import nullid
    83 from mercurial.node import nullid
    84 from mercurial.i18n import _
    84 from mercurial.i18n import _
    85 import re, shutil, tempfile, time
    85 import re, shutil, tempfile
    86 
    86 
    87 commands.optionalrepo += ' kwdemo'
    87 commands.optionalrepo += ' kwdemo'
    88 
    88 
    89 # hg commands that do not act on keywords
    89 # hg commands that do not act on keywords
    90 nokwcommands = ('add addremove annotate bundle copy export grep incoming init'
    90 nokwcommands = ('add addremove annotate bundle copy export grep incoming init'
    93 
    93 
    94 # hg commands that trigger expansion only when writing to working dir,
    94 # hg commands that trigger expansion only when writing to working dir,
    95 # not when reading filelog, and unexpand when reading from working dir
    95 # not when reading filelog, and unexpand when reading from working dir
    96 restricted = 'merge record resolve qfold qimport qnew qpush qrefresh qrecord'
    96 restricted = 'merge record resolve qfold qimport qnew qpush qrefresh qrecord'
    97 
    97 
    98 def utcdate(date):
    98 # provide cvs-like UTC date filter
    99     '''Returns hgdate in cvs-like UTC format.'''
    99 utcdate = lambda x: util.datestr(x, '%Y/%m/%d %H:%M:%S')
   100     return time.strftime('%Y/%m/%d %H:%M:%S', time.gmtime(date[0]))
       
   101 
   100 
   102 # make keyword tools accessible
   101 # make keyword tools accessible
   103 kwtools = {'templater': None, 'hgcmd': '', 'inc': [], 'exc': ['.hg*']}
   102 kwtools = {'templater': None, 'hgcmd': '', 'inc': [], 'exc': ['.hg*']}
   104 
   103 
   105 
   104