##// END OF EJS Templates
New option -i/--ignored for 'hg status' to show ignored files....
Thomas Arendsen Hein -
r2022:a59da8cc default
parent child Browse files
Show More
@@ -2464,19 +2464,23 def status(ui, repo, *pats, **opts):
2464 2464 R = removed
2465 2465 ! = deleted, but still tracked
2466 2466 ? = not tracked
2467 I = ignored (not shown by default)
2467 2468 """
2468 2469
2470 show_ignored = opts['ignored'] and True or False
2469 2471 files, matchfn, anypats = matchpats(repo, pats, opts)
2470 2472 cwd = (pats and repo.getcwd()) or ''
2471 modified, added, removed, deleted, unknown = [
2473 modified, added, removed, deleted, unknown, ignored = [
2472 2474 [util.pathto(cwd, x) for x in n]
2473 for n in repo.changes(files=files, match=matchfn)]
2475 for n in repo.changes(files=files, match=matchfn,
2476 show_ignored=show_ignored)]
2474 2477
2475 2478 changetypes = [('modified', 'M', modified),
2476 2479 ('added', 'A', added),
2477 2480 ('removed', 'R', removed),
2478 2481 ('deleted', '!', deleted),
2479 ('unknown', '?', unknown)]
2482 ('unknown', '?', unknown),
2483 ('ignored', 'I', ignored)]
2480 2484
2481 2485 end = opts['print0'] and '\0' or '\n'
2482 2486
@@ -2952,6 +2956,7 table = {
2952 2956 ('r', 'removed', None, _('show only removed files')),
2953 2957 ('d', 'deleted', None, _('show only deleted (but tracked) files')),
2954 2958 ('u', 'unknown', None, _('show only unknown (not tracked) files')),
2959 ('i', 'ignored', None, _('show ignored files')),
2955 2960 ('n', 'no-status', None, _('hide status prefix')),
2956 2961 ('0', 'print0', None,
2957 2962 _('end filenames with NUL, for use with xargs')),
@@ -294,7 +294,7 class dirstate(object):
294 294 kind))
295 295 return False
296 296
297 def statwalk(self, files=None, match=util.always, dc=None):
297 def statwalk(self, files=None, match=util.always, dc=None, ignored=False):
298 298 self.lazyread()
299 299
300 300 # walk all files by default
@@ -307,7 +307,7 class dirstate(object):
307 307
308 308 def statmatch(file_, stat):
309 309 file_ = util.pconvert(file_)
310 if file_ not in dc and self.ignore(file_):
310 if not ignored and file_ not in dc and self.ignore(file_):
311 311 return False
312 312 return match(file_)
313 313
@@ -409,14 +409,17 class dirstate(object):
409 409 if not seen(k) and (statmatch(k, None)):
410 410 yield 'm', k, None
411 411
412 def changes(self, files=None, match=util.always):
413 lookup, modified, added, unknown = [], [], [], []
412 def changes(self, files=None, match=util.always, show_ignored=None):
413 lookup, modified, added, unknown, ignored = [], [], [], [], []
414 414 removed, deleted = [], []
415 415
416 for src, fn, st in self.statwalk(files, match):
416 for src, fn, st in self.statwalk(files, match, ignored=show_ignored):
417 417 try:
418 418 type_, mode, size, time = self[fn]
419 419 except KeyError:
420 if show_ignored and self.ignore(fn):
421 ignored.append(fn)
422 else:
420 423 unknown.append(fn)
421 424 continue
422 425 if src == 'm':
@@ -453,4 +456,4 class dirstate(object):
453 456 elif type_ == 'r':
454 457 removed.append(fn)
455 458
456 return (lookup, modified, added, removed, deleted, unknown)
459 return (lookup, modified, added, removed, deleted, unknown, ignored)
@@ -498,7 +498,7 class localrepository(object):
498 498 yield src, fn
499 499
500 500 def changes(self, node1=None, node2=None, files=[], match=util.always,
501 wlock=None):
501 wlock=None, show_ignored=None):
502 502 """return changes between two nodes or node and working directory
503 503
504 504 If node1 is None, use the first dirstate parent instead.
@@ -531,8 +531,8 class localrepository(object):
531 531 wlock = self.wlock(wait=0)
532 532 except lock.LockException:
533 533 wlock = None
534 lookup, modified, added, removed, deleted, unknown = (
535 self.dirstate.changes(files, match))
534 lookup, modified, added, removed, deleted, unknown, ignored = (
535 self.dirstate.changes(files, match, show_ignored))
536 536
537 537 # are we comparing working dir against its parent?
538 538 if not node1:
@@ -555,7 +555,7 class localrepository(object):
555 555 del mf2[f]
556 556 else:
557 557 # we are comparing two revisions
558 deleted, unknown = [], []
558 deleted, unknown, ignored = [], [], []
559 559 mf2 = mfmatches(node2)
560 560
561 561 if node1:
@@ -573,9 +573,12 class localrepository(object):
573 573 removed = mf1.keys()
574 574
575 575 # sort and return results:
576 for l in modified, added, removed, deleted, unknown:
576 for l in modified, added, removed, deleted, unknown, ignored:
577 577 l.sort()
578 if show_ignored is None:
578 579 return (modified, added, removed, deleted, unknown)
580 else:
581 return (modified, added, removed, deleted, unknown, ignored)
579 582
580 583 def add(self, list, wlock=None):
581 584 if not wlock:
@@ -190,6 +190,7 show changed files in the working direct
190 190 R = removed
191 191 ! = deleted, but still tracked
192 192 ? = not tracked
193 I = ignored (not shown by default)
193 194
194 195 aliases: st
195 196
@@ -200,6 +201,7 options:
200 201 -r --removed show only removed files
201 202 -d --deleted show only deleted (but tracked) files
202 203 -u --unknown show only unknown (not tracked) files
204 -i --ignored show ignored files
203 205 -n --no-status hide status prefix
204 206 -0 --print0 end filenames with NUL, for use with xargs
205 207 -I --include include names matching the given patterns
General Comments 0
You need to be logged in to leave comments. Login now