comparison hgext/keyword.py @ 13079:f3a2bb1e4255

keyword: make kwfiles show deleted files configured for expansion
author Christian Ebert <blacktrash@gmx.net>
date Sat, 04 Dec 2010 14:44:05 +0100
parents 69405131c968
children 1e0d631b843b
comparison
equal deleted inserted replaced
13078:69405131c968 13079:f3a2bb1e4255
101 # names of extensions using dorecord 101 # names of extensions using dorecord
102 recordextensions = 'record' 102 recordextensions = 'record'
103 103
104 colortable = { 104 colortable = {
105 'kwfiles.enabled': 'green bold', 105 'kwfiles.enabled': 'green bold',
106 'kwfiles.deleted': 'cyan bold underline',
106 'kwfiles.enabledunknown': 'green', 107 'kwfiles.enabledunknown': 'green',
107 'kwfiles.ignored': 'bold', 108 'kwfiles.ignored': 'bold',
108 'kwfiles.ignoredunknown': 'none' 109 'kwfiles.ignoredunknown': 'none'
109 } 110 }
110 111
443 files = [] 444 files = []
444 if not opts.get('unknown') or opts.get('all'): 445 if not opts.get('unknown') or opts.get('all'):
445 files = sorted(modified + added + clean) 446 files = sorted(modified + added + clean)
446 wctx = repo[None] 447 wctx = repo[None]
447 kwfiles = kwt.iskwfile(files, wctx) 448 kwfiles = kwt.iskwfile(files, wctx)
449 kwdeleted = kwt.iskwfile(deleted, wctx)
448 kwunknown = kwt.iskwfile(unknown, wctx) 450 kwunknown = kwt.iskwfile(unknown, wctx)
449 if not opts.get('ignore') or opts.get('all'): 451 if not opts.get('ignore') or opts.get('all'):
450 showfiles = kwfiles, kwunknown 452 showfiles = kwfiles, kwdeleted, kwunknown
451 else: 453 else:
452 showfiles = [], [] 454 showfiles = [], [], []
453 if opts.get('all') or opts.get('ignore'): 455 if opts.get('all') or opts.get('ignore'):
454 showfiles += ([f for f in files if f not in kwfiles], 456 showfiles += ([f for f in files if f not in kwfiles],
455 [f for f in unknown if f not in kwunknown]) 457 [f for f in unknown if f not in kwunknown])
456 kwlabels = 'enabled enabledunknown ignored ignoredunknown'.split() 458 kwlabels = 'enabled deleted enabledunknown ignored ignoredunknown'.split()
457 kwstates = zip('KkIi', showfiles, kwlabels) 459 kwstates = zip('K!kIi', showfiles, kwlabels)
458 for char, filenames, kwstate in kwstates: 460 for char, filenames, kwstate in kwstates:
459 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'
460 for f in filenames: 462 for f in filenames:
461 ui.write(fmt % repo.pathto(f, cwd), label='kwfiles.' + kwstate) 463 ui.write(fmt % repo.pathto(f, cwd), label='kwfiles.' + kwstate)
462 464