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