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.deleted': 'cyan bold underline', |
|
107 'kwfiles.enabledunknown': 'green', |
|
108 'kwfiles.ignored': 'bold', |
|
109 'kwfiles.ignoredunknown': 'none' |
|
110 } |
103 |
111 |
104 # date like in cvs' $Date |
112 # date like in cvs' $Date |
105 utcdate = lambda x: util.datestr((x[0], 0), '%Y/%m/%d %H:%M:%S') |
113 utcdate = lambda x: util.datestr((x[0], 0), '%Y/%m/%d %H:%M:%S') |
106 # date like in svn's $Date |
114 # 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)') |
115 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 |
116 # date like in svn's $Id |
109 svnutcdate = lambda x: util.datestr((x[0], 0), '%Y-%m-%d %H:%M:%SZ') |
117 svnutcdate = lambda x: util.datestr((x[0], 0), '%Y-%m-%d %H:%M:%SZ') |
110 |
118 |
111 # make keyword tools accessible |
119 # make keyword tools accessible |
112 kwtools = {'templater': None, 'hgcmd': ''} |
120 kwtools = {'templater': None, 'hgcmd': ''} |
113 |
|
114 |
121 |
115 def _defaultkwmaps(ui): |
122 def _defaultkwmaps(ui): |
116 '''Returns default keywordmaps according to keywordset configuration.''' |
123 '''Returns default keywordmaps according to keywordset configuration.''' |
117 templates = { |
124 templates = { |
118 'Revision': '{node|short}', |
125 'Revision': '{node|short}', |
437 files = [] |
444 files = [] |
438 if not opts.get('unknown') or opts.get('all'): |
445 if not opts.get('unknown') or opts.get('all'): |
439 files = sorted(modified + added + clean) |
446 files = sorted(modified + added + clean) |
440 wctx = repo[None] |
447 wctx = repo[None] |
441 kwfiles = kwt.iskwfile(files, wctx) |
448 kwfiles = kwt.iskwfile(files, wctx) |
|
449 kwdeleted = kwt.iskwfile(deleted, wctx) |
442 kwunknown = kwt.iskwfile(unknown, wctx) |
450 kwunknown = kwt.iskwfile(unknown, wctx) |
443 if not opts.get('ignore') or opts.get('all'): |
451 if not opts.get('ignore') or opts.get('all'): |
444 showfiles = kwfiles, kwunknown |
452 showfiles = kwfiles, kwdeleted, kwunknown |
445 else: |
453 else: |
446 showfiles = [], [] |
454 showfiles = [], [], [] |
447 if opts.get('all') or opts.get('ignore'): |
455 if opts.get('all') or opts.get('ignore'): |
448 showfiles += ([f for f in files if f not in kwfiles], |
456 showfiles += ([f for f in files if f not in kwfiles], |
449 [f for f in unknown if f not in kwunknown]) |
457 [f for f in unknown if f not in kwunknown]) |
450 for char, filenames in zip('KkIi', showfiles): |
458 kwlabels = 'enabled deleted enabledunknown ignored ignoredunknown'.split() |
|
459 kwstates = zip('K!kIi', showfiles, kwlabels) |
|
460 for char, filenames, kwstate in kwstates: |
451 fmt = (opts.get('all') or ui.verbose) and '%s %%s\n' % char or '%s\n' |
461 fmt = (opts.get('all') or ui.verbose) and '%s %%s\n' % char or '%s\n' |
452 for f in filenames: |
462 for f in filenames: |
453 ui.write(fmt % repo.pathto(f, cwd)) |
463 ui.write(fmt % repo.pathto(f, cwd), label='kwfiles.' + kwstate) |
454 |
464 |
455 def shrink(ui, repo, *pats, **opts): |
465 def shrink(ui, repo, *pats, **opts): |
456 '''revert expanded keywords in the working directory |
466 '''revert expanded keywords in the working directory |
457 |
467 |
458 Run before changing/disabling active keywords or if you experience |
468 Run before changing/disabling active keywords or if you experience |