Show More
@@ -2599,37 +2599,44 b' def serve(ui, repo, **opts):' | |||
|
2599 | 2599 | def status(ui, repo, *pats, **opts): |
|
2600 | 2600 | """show changed files in the working directory |
|
2601 | 2601 | |
|
2602 |
Show |
|
|
2603 | given, only files that match are shown. | |
|
2602 | Show status of files in the repository. If names are given, only | |
|
2603 | files that match are shown. Files that are clean or ignored, are | |
|
2604 | not listed unless -c (clean), -i (ignored) or -A is given. | |
|
2604 | 2605 | |
|
2605 | 2606 | The codes used to show the status of files are: |
|
2606 | 2607 | M = modified |
|
2607 | 2608 | A = added |
|
2608 | 2609 | R = removed |
|
2610 | C = clean | |
|
2609 | 2611 | ! = deleted, but still tracked |
|
2610 | 2612 | ? = not tracked |
|
2611 | 2613 | I = ignored (not shown by default) |
|
2612 | 2614 | = the previous added file was copied from here |
|
2613 | 2615 | """ |
|
2614 | 2616 | |
|
2615 | show_ignored = opts['ignored'] and True or False | |
|
2617 | all = opts['all'] | |
|
2618 | ||
|
2616 | 2619 | files, matchfn, anypats = matchpats(repo, pats, opts) |
|
2617 | 2620 | cwd = (pats and repo.getcwd()) or '' |
|
2618 | modified, added, removed, deleted, unknown, ignored = [ | |
|
2621 | modified, added, removed, deleted, unknown, ignored, clean = [ | |
|
2619 | 2622 | [util.pathto(cwd, x) for x in n] |
|
2620 |
for n in repo. |
|
|
2621 |
|
|
|
2622 | ||
|
2623 | changetypes = [('modified', 'M', modified), | |
|
2623 | for n in repo.status(files=files, match=matchfn, | |
|
2624 | list_ignored=all or opts['ignored'], | |
|
2625 | list_clean=all or opts['clean'])] | |
|
2626 | ||
|
2627 | changetypes = (('modified', 'M', modified), | |
|
2624 | 2628 | ('added', 'A', added), |
|
2625 | 2629 | ('removed', 'R', removed), |
|
2626 | 2630 | ('deleted', '!', deleted), |
|
2627 | 2631 | ('unknown', '?', unknown), |
|
2628 |
('ignored', 'I', ignored) |
|
|
2632 | ('ignored', 'I', ignored)) | |
|
2633 | ||
|
2634 | explicit_changetypes = changetypes + (('clean', 'C', clean),) | |
|
2629 | 2635 | |
|
2630 | 2636 | end = opts['print0'] and '\0' or '\n' |
|
2631 | 2637 | |
|
2632 |
for opt, char, changes in ([ct for ct in changetypes |
|
|
2638 | for opt, char, changes in ([ct for ct in explicit_changetypes | |
|
2639 | if all or opts[ct[0]]] | |
|
2633 | 2640 | or changetypes): |
|
2634 | 2641 | if opts['no_status']: |
|
2635 | 2642 | format = "%%s%s" % end |
@@ -2638,7 +2645,7 b' def status(ui, repo, *pats, **opts):' | |||
|
2638 | 2645 | |
|
2639 | 2646 | for f in changes: |
|
2640 | 2647 | ui.write(format % f) |
|
2641 | if (opts.get('copies') and not opts.get('no_status') | |
|
2648 | if ((all or opts.get('copies')) and not opts.get('no_status') | |
|
2642 | 2649 | and opt == 'added' and repo.dirstate.copies.has_key(f)): |
|
2643 | 2650 | ui.write(' %s%s' % (repo.dirstate.copies[f], end)) |
|
2644 | 2651 | |
@@ -3123,10 +3130,12 b' table = {' | |||
|
3123 | 3130 | _('hg serve [OPTION]...')), |
|
3124 | 3131 | "^status|st": |
|
3125 | 3132 | (status, |
|
3126 |
[(' |
|
|
3133 | [('A', 'all', None, _('show status of all files')), | |
|
3134 | ('m', 'modified', None, _('show only modified files')), | |
|
3127 | 3135 | ('a', 'added', None, _('show only added files')), |
|
3128 | 3136 | ('r', 'removed', None, _('show only removed files')), |
|
3129 | 3137 | ('d', 'deleted', None, _('show only deleted (but tracked) files')), |
|
3138 | ('c', 'clean', None, _('show only files without changes')), | |
|
3130 | 3139 | ('u', 'unknown', None, _('show only unknown (not tracked) files')), |
|
3131 | 3140 | ('i', 'ignored', None, _('show ignored files')), |
|
3132 | 3141 | ('n', 'no-status', None, _('hide status prefix')), |
@@ -434,15 +434,16 b' class dirstate(object):' | |||
|
434 | 434 | if not seen(k) and (statmatch(k, None)): |
|
435 | 435 | yield 'm', k, None |
|
436 | 436 | |
|
437 |
def |
|
|
437 | def status(self, files=None, match=util.always, list_ignored=False, | |
|
438 | list_clean=False): | |
|
438 | 439 | lookup, modified, added, unknown, ignored = [], [], [], [], [] |
|
439 | removed, deleted = [], [] | |
|
440 | removed, deleted, clean = [], [], [] | |
|
440 | 441 | |
|
441 |
for src, fn, st in self.statwalk(files, match, ignored= |
|
|
442 | for src, fn, st in self.statwalk(files, match, ignored=list_ignored): | |
|
442 | 443 | try: |
|
443 | 444 | type_, mode, size, time = self[fn] |
|
444 | 445 | except KeyError: |
|
445 |
if |
|
|
446 | if list_ignored and self.ignore(fn): | |
|
446 | 447 | ignored.append(fn) |
|
447 | 448 | else: |
|
448 | 449 | unknown.append(fn) |
@@ -473,6 +474,8 b' class dirstate(object):' | |||
|
473 | 474 | modified.append(fn) |
|
474 | 475 | elif time != st.st_mtime: |
|
475 | 476 | lookup.append(fn) |
|
477 | elif list_clean: | |
|
478 | clean.append(fn) | |
|
476 | 479 | elif type_ == 'm': |
|
477 | 480 | modified.append(fn) |
|
478 | 481 | elif type_ == 'a': |
@@ -480,4 +483,5 b' class dirstate(object):' | |||
|
480 | 483 | elif type_ == 'r': |
|
481 | 484 | removed.append(fn) |
|
482 | 485 | |
|
483 |
return (lookup, modified, added, removed, deleted, unknown, ignored |
|
|
486 | return (lookup, modified, added, removed, deleted, unknown, ignored, | |
|
487 | clean) |
@@ -658,9 +658,9 b' class localrepository(repo.repository):' | |||
|
658 | 658 | for src, fn in self.dirstate.walk(files, match, badmatch=badmatch): |
|
659 | 659 | yield src, fn |
|
660 | 660 | |
|
661 |
def |
|
|
662 |
wlock=None, |
|
|
663 |
"""return |
|
|
661 | def status(self, node1=None, node2=None, files=[], match=util.always, | |
|
662 | wlock=None, list_ignored=False, list_clean=False): | |
|
663 | """return status of files between two nodes or node and working directory | |
|
664 | 664 | |
|
665 | 665 | If node1 is None, use the first dirstate parent instead. |
|
666 | 666 | If node2 is None, compare node1 with working directory. |
@@ -679,7 +679,9 b' class localrepository(repo.repository):' | |||
|
679 | 679 | del mf[fn] |
|
680 | 680 | return mf |
|
681 | 681 | |
|
682 |
modified, added, removed, deleted, unknown |
|
|
682 | modified, added, removed, deleted, unknown = [], [], [], [], [] | |
|
683 | ignored, clean = [], [] | |
|
684 | ||
|
683 | 685 | compareworking = False |
|
684 | 686 | if not node1 or (not node2 and node1 == self.dirstate.parents()[0]): |
|
685 | 687 | compareworking = True |
@@ -697,8 +699,9 b' class localrepository(repo.repository):' | |||
|
697 | 699 | wlock = self.wlock(wait=0) |
|
698 | 700 | except lock.LockException: |
|
699 | 701 | wlock = None |
|
700 |
lookup, modified, added, removed, deleted, unknown, |
|
|
701 |
self.dirstate. |
|
|
702 | (lookup, modified, added, removed, deleted, unknown, | |
|
703 | ignored, clean) = self.dirstate.status(files, match, | |
|
704 | list_ignored, list_clean) | |
|
702 | 705 | |
|
703 | 706 | # are we comparing working dir against its parent? |
|
704 | 707 | if compareworking: |
@@ -721,12 +724,11 b' class localrepository(repo.repository):' | |||
|
721 | 724 | del mf2[f] |
|
722 | 725 | else: |
|
723 | 726 | # we are comparing two revisions |
|
724 | deleted, unknown, ignored = [], [], [] | |
|
725 | 727 | mf2 = mfmatches(node2) |
|
726 | 728 | |
|
727 | 729 | if not compareworking: |
|
728 | 730 | # flush lists from dirstate before comparing manifests |
|
729 | modified, added = [], [] | |
|
731 | modified, added, clean = [], [], [] | |
|
730 | 732 | |
|
731 | 733 | # make sure to sort the files so we talk to the disk in a |
|
732 | 734 | # reasonable order |
@@ -736,6 +738,8 b' class localrepository(repo.repository):' | |||
|
736 | 738 | if mf1.has_key(fn): |
|
737 | 739 | if mf1[fn] != mf2[fn] and (mf2[fn] != "" or fcmp(fn, mf1)): |
|
738 | 740 | modified.append(fn) |
|
741 | elif list_clean: | |
|
742 | clean.append(fn) | |
|
739 | 743 | del mf1[fn] |
|
740 | 744 | else: |
|
741 | 745 | added.append(fn) |
@@ -743,12 +747,19 b' class localrepository(repo.repository):' | |||
|
743 | 747 | removed = mf1.keys() |
|
744 | 748 | |
|
745 | 749 | # sort and return results: |
|
746 | for l in modified, added, removed, deleted, unknown, ignored: | |
|
750 | for l in modified, added, removed, deleted, unknown, ignored, clean: | |
|
747 | 751 | l.sort() |
|
748 | if show_ignored is None: | |
|
749 | return (modified, added, removed, deleted, unknown) | |
|
752 | return (modified, added, removed, deleted, unknown, ignored, clean) | |
|
753 | ||
|
754 | def changes(self, node1=None, node2=None, files=[], match=util.always, | |
|
755 | wlock=None, list_ignored=False, list_clean=False): | |
|
756 | '''DEPRECATED - use status instead''' | |
|
757 | marduit = self.status(node1, node2, files, match, wlock, | |
|
758 | list_ignored, list_clean) | |
|
759 | if list_ignored: | |
|
760 | return marduit[:-1] | |
|
750 | 761 | else: |
|
751 | return (modified, added, removed, deleted, unknown, ignored) | |
|
762 | return marduit[:-2] | |
|
752 | 763 | |
|
753 | 764 | def add(self, list, wlock=None): |
|
754 | 765 | if not wlock: |
@@ -185,13 +185,15 b' hg status [OPTION]... [FILE]...' | |||
|
185 | 185 | |
|
186 | 186 | show changed files in the working directory |
|
187 | 187 | |
|
188 |
Show |
|
|
189 | given, only files that match are shown. | |
|
188 | Show status of files in the repository. If names are given, only | |
|
189 | files that match are shown. Files that are clean or ignored, are | |
|
190 | not listed unless -c (clean), -i (ignored) or -A is given. | |
|
190 | 191 | |
|
191 | 192 | The codes used to show the status of files are: |
|
192 | 193 | M = modified |
|
193 | 194 | A = added |
|
194 | 195 | R = removed |
|
196 | C = clean | |
|
195 | 197 | ! = deleted, but still tracked |
|
196 | 198 | ? = not tracked |
|
197 | 199 | I = ignored (not shown by default) |
@@ -201,10 +203,12 b' aliases: st' | |||
|
201 | 203 | |
|
202 | 204 | options: |
|
203 | 205 | |
|
206 | -A --all show status of all files | |
|
204 | 207 | -m --modified show only modified files |
|
205 | 208 | -a --added show only added files |
|
206 | 209 | -r --removed show only removed files |
|
207 | 210 | -d --deleted show only deleted (but tracked) files |
|
211 | -c --clean show only files without changes | |
|
208 | 212 | -u --unknown show only unknown (not tracked) files |
|
209 | 213 | -i --ignored show ignored files |
|
210 | 214 | -n --no-status hide status prefix |
@@ -35,3 +35,8 b' hg status modified added removed deleted' | |||
|
35 | 35 | hg copy modified copied |
|
36 | 36 | echo "hg status -C:" |
|
37 | 37 | hg status -C |
|
38 | ||
|
39 | echo "hg status -t:" | |
|
40 | hg status -t | |
|
41 | echo "hg status -A:" | |
|
42 | hg status -A |
@@ -108,3 +108,50 b' A copied' | |||
|
108 | 108 | R removed |
|
109 | 109 | ! deleted |
|
110 | 110 | ? unknown |
|
111 | hg status -t: | |
|
112 | hg status: option -t not recognized | |
|
113 | hg status [OPTION]... [FILE]... | |
|
114 | ||
|
115 | show changed files in the working directory | |
|
116 | ||
|
117 | Show status of files in the repository. If names are given, only | |
|
118 | files that match are shown. Files that are clean or ignored, are | |
|
119 | not listed unless -c (clean), -i (ignored) or -A is given. | |
|
120 | ||
|
121 | The codes used to show the status of files are: | |
|
122 | M = modified | |
|
123 | A = added | |
|
124 | R = removed | |
|
125 | C = clean | |
|
126 | ! = deleted, but still tracked | |
|
127 | ? = not tracked | |
|
128 | I = ignored (not shown by default) | |
|
129 | = the previous added file was copied from here | |
|
130 | ||
|
131 | aliases: st | |
|
132 | ||
|
133 | options: | |
|
134 | ||
|
135 | -A --all show status of all files | |
|
136 | -m --modified show only modified files | |
|
137 | -a --added show only added files | |
|
138 | -r --removed show only removed files | |
|
139 | -d --deleted show only deleted (but tracked) files | |
|
140 | -c --clean show only files without changes | |
|
141 | -u --unknown show only unknown (not tracked) files | |
|
142 | -i --ignored show ignored files | |
|
143 | -n --no-status hide status prefix | |
|
144 | -C --copies show source of copied files | |
|
145 | -0 --print0 end filenames with NUL, for use with xargs | |
|
146 | -I --include include names matching the given patterns | |
|
147 | -X --exclude exclude names matching the given patterns | |
|
148 | hg status -A: | |
|
149 | A added | |
|
150 | A copied | |
|
151 | modified | |
|
152 | R removed | |
|
153 | ! deleted | |
|
154 | ? unknown | |
|
155 | I ignored | |
|
156 | C .hgignore | |
|
157 | C modified |
General Comments 0
You need to be logged in to leave comments.
Login now