Mercurial > hg
comparison mercurial/dirstate.py @ 6201:305d4450036a
Extend/correct acc40572da5b regarding -qA and ignored files.
hg status -qA will now hide untracked files as described in the doc string.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Sun, 02 Mar 2008 13:52:34 +0100 |
parents | 09847b90beae |
children | f89fd07fc51d |
comparison
equal
deleted
inserted
replaced
6200:acc40572da5b | 6201:305d4450036a |
---|---|
381 def walk(self, files=None, match=util.always, badmatch=None): | 381 def walk(self, files=None, match=util.always, badmatch=None): |
382 # filter out the stat | 382 # filter out the stat |
383 for src, f, st in self.statwalk(files, match, badmatch=badmatch): | 383 for src, f, st in self.statwalk(files, match, badmatch=badmatch): |
384 yield src, f | 384 yield src, f |
385 | 385 |
386 def statwalk(self, files=None, match=util.always, ignored=False, | 386 def statwalk(self, files=None, match=util.always, unknown=True, |
387 badmatch=None, directories=False): | 387 ignored=False, badmatch=None, directories=False): |
388 ''' | 388 ''' |
389 walk recursively through the directory tree, finding all files | 389 walk recursively through the directory tree, finding all files |
390 matched by the match function | 390 matched by the match function |
391 | 391 |
392 results are yielded in a tuple (src, filename, st), where src | 392 results are yielded in a tuple (src, filename, st), where src |
410 def imatch(file_): | 410 def imatch(file_): |
411 if file_ not in dc and self._ignore(file_): | 411 if file_ not in dc and self._ignore(file_): |
412 return False | 412 return False |
413 return match(file_) | 413 return match(file_) |
414 | 414 |
415 # TODO: don't walk unknown directories if unknown and ignored are False | |
415 ignore = self._ignore | 416 ignore = self._ignore |
416 dirignore = self._dirignore | 417 dirignore = self._dirignore |
417 if ignored: | 418 if ignored: |
418 imatch = match | 419 imatch = match |
419 ignore = util.never | 420 ignore = util.never |
525 continue | 526 continue |
526 known[k] = 1 | 527 known[k] = 1 |
527 if imatch(k): | 528 if imatch(k): |
528 yield 'm', k, None | 529 yield 'm', k, None |
529 | 530 |
530 def status(self, files, match, list_ignored, list_clean): | 531 def status(self, files, match, list_ignored, list_clean, list_unknown=True): |
531 lookup, modified, added, unknown, ignored = [], [], [], [], [] | 532 lookup, modified, added, unknown, ignored = [], [], [], [], [] |
532 removed, deleted, clean = [], [], [] | 533 removed, deleted, clean = [], [], [] |
533 | 534 |
534 files = files or [] | 535 files = files or [] |
535 _join = self._join | 536 _join = self._join |
543 iadd = ignored.append | 544 iadd = ignored.append |
544 radd = removed.append | 545 radd = removed.append |
545 dadd = deleted.append | 546 dadd = deleted.append |
546 cadd = clean.append | 547 cadd = clean.append |
547 | 548 |
548 for src, fn, st in self.statwalk(files, match, ignored=list_ignored): | 549 for src, fn, st in self.statwalk(files, match, unknown=list_unknown, |
550 ignored=list_ignored): | |
549 if fn in dmap: | 551 if fn in dmap: |
550 type_, mode, size, time, foo = dmap[fn] | 552 type_, mode, size, time, foo = dmap[fn] |
551 else: | 553 else: |
552 if (list_ignored or fn in files) and self._dirignore(fn): | 554 if (list_ignored or fn in files) and self._dirignore(fn): |
553 if list_ignored: | 555 if list_ignored: |
554 iadd(fn) | 556 iadd(fn) |
555 else: | 557 elif list_unknown: |
556 uadd(fn) | 558 uadd(fn) |
557 continue | 559 continue |
558 if src == 'm': | 560 if src == 'm': |
559 nonexistent = True | 561 nonexistent = True |
560 if not st: | 562 if not st: |