hgkw/keyword.py
changeset 870 ef8b368bf24b
parent 868 16cfcb56859a
child 871 c2651cd808b7
equal deleted inserted replaced
868:16cfcb56859a 870:ef8b368bf24b
    98 # not when reading filelog, and unexpand when reading from working dir
    98 # not when reading filelog, and unexpand when reading from working dir
    99 restricted = 'merge kwexpand kwshrink record qrecord resolve transplant'
    99 restricted = 'merge kwexpand kwshrink record qrecord resolve transplant'
   100 
   100 
   101 # names of extensions using dorecord
   101 # names of extensions using dorecord
   102 recordextensions = 'record'
   102 recordextensions = 'record'
       
   103 
       
   104 colortable = {
       
   105     'kwfiles.enabled': 'green bold',
       
   106     'kwfiles.enabledunknown': 'green',
       
   107     'kwfiles.ignored': 'bold',
       
   108     'kwfiles.ignoredunknown': 'none'
       
   109 }
   103 
   110 
   104 # date like in cvs' $Date
   111 # date like in cvs' $Date
   105 utcdate = lambda x: util.datestr((x[0], 0), '%Y/%m/%d %H:%M:%S')
   112 utcdate = lambda x: util.datestr((x[0], 0), '%Y/%m/%d %H:%M:%S')
   106 # date like in svn's $Date
   113 # date like in svn's $Date
   107 svnisodate = lambda x: util.datestr(x, '%Y-%m-%d %H:%M:%S %1%2 (%a, %d %b %Y)')
   114 svnisodate = lambda x: util.datestr(x, '%Y-%m-%d %H:%M:%S %1%2 (%a, %d %b %Y)')
   108 # date like in svn's $Id
   115 # date like in svn's $Id
   109 svnutcdate = lambda x: util.datestr((x[0], 0), '%Y-%m-%d %H:%M:%SZ')
   116 svnutcdate = lambda x: util.datestr((x[0], 0), '%Y-%m-%d %H:%M:%SZ')
   110 
   117 
   111 # make keyword tools accessible
   118 # make keyword tools accessible
   112 kwtools = {'templater': None, 'hgcmd': ''}
   119 kwtools = {'templater': None, 'hgcmd': ''}
   113 
       
   114 
   120 
   115 def _defaultkwmaps(ui):
   121 def _defaultkwmaps(ui):
   116     '''Returns default keywordmaps according to keywordset configuration.'''
   122     '''Returns default keywordmaps according to keywordset configuration.'''
   117     templates = {
   123     templates = {
   118         'Revision': '{node|short}',
   124         'Revision': '{node|short}',
   445     else:
   451     else:
   446         showfiles = [], []
   452         showfiles = [], []
   447     if opts.get('all') or opts.get('ignore'):
   453     if opts.get('all') or opts.get('ignore'):
   448         showfiles += ([f for f in files if f not in kwfiles],
   454         showfiles += ([f for f in files if f not in kwfiles],
   449                       [f for f in unknown if f not in kwunknown])
   455                       [f for f in unknown if f not in kwunknown])
   450     for char, filenames in zip('KkIi', showfiles):
   456     kwlabels = 'enabled enabledunknown ignored ignoredunknown'.split()
       
   457     kwstates = zip('KkIi', showfiles, kwlabels)
       
   458     for char, filenames, kwstate in kwstates:
   451         fmt = (opts.get('all') or ui.verbose) and '%s %%s\n' % char or '%s\n'
   459         fmt = (opts.get('all') or ui.verbose) and '%s %%s\n' % char or '%s\n'
   452         for f in filenames:
   460         for f in filenames:
   453             ui.write(fmt % repo.pathto(f, cwd))
   461             ui.write(fmt % repo.pathto(f, cwd), label='kwfiles.' + kwstate)
   454 
   462 
   455 def shrink(ui, repo, *pats, **opts):
   463 def shrink(ui, repo, *pats, **opts):
   456     '''revert expanded keywords in the working directory
   464     '''revert expanded keywords in the working directory
   457 
   465 
   458     Run before changing/disabling active keywords or if you experience
   466     Run before changing/disabling active keywords or if you experience