Show More
@@ -123,7 +123,7 b' def dodiff(ui, repo, diffcmd, diffopts, ' | |||
|
123 | 123 | node1, node2 = cmdutil.revpair(repo, opts['rev']) |
|
124 | 124 | matcher = cmdutil.match(repo, pats, opts) |
|
125 | 125 | modified, added, removed, deleted, unknown = repo.status( |
|
126 |
node1, node2, matcher |
|
|
126 | node1, node2, matcher)[:5] | |
|
127 | 127 | if not (modified or added or removed): |
|
128 | 128 | return 0 |
|
129 | 129 |
@@ -56,7 +56,7 b' def difftree(ui, repo, node1=None, node2' | |||
|
56 | 56 | mmap = repo.changectx(node1).manifest() |
|
57 | 57 | mmap2 = repo.changectx(node2).manifest() |
|
58 | 58 | m = cmdutil.matchfiles(repo, files) |
|
59 |
status = repo.status(node1, node2, |
|
|
59 | status = repo.status(node1, node2, match=m)[:5] | |
|
60 | 60 | modified, added, removed, deleted, unknown = status |
|
61 | 61 | |
|
62 | 62 | empty = short(nullid) |
@@ -47,8 +47,9 b' def reposetup(ui, repo):' | |||
|
47 | 47 | # to recurse. |
|
48 | 48 | inotifyserver = False |
|
49 | 49 | |
|
50 |
def status(self |
|
|
50 | def status(self, match, list_ignored, list_clean, | |
|
51 | 51 | list_unknown=True): |
|
52 | files = match.files() | |
|
52 | 53 | try: |
|
53 | 54 | if not list_ignored and not self.inotifyserver: |
|
54 | 55 | result = client.query(ui, repo, files, match, False, |
@@ -88,7 +89,7 b' def reposetup(ui, repo):' | |||
|
88 | 89 | ui.print_exc() |
|
89 | 90 | |
|
90 | 91 | return super(inotifydirstate, self).status( |
|
91 |
|
|
|
92 | match, list_ignored, list_clean, | |
|
92 | 93 | list_unknown) |
|
93 | 94 | |
|
94 | 95 | repo.dirstate.__class__ = inotifydirstate |
@@ -256,7 +256,7 b' def _status(ui, repo, kwt, *pats, **opts' | |||
|
256 | 256 | Returns status of working directory.''' |
|
257 | 257 | if kwt: |
|
258 | 258 | matcher = cmdutil.match(repo, pats, opts) |
|
259 |
return repo.status( |
|
|
259 | return repo.status(match=matcher, list_clean=True) | |
|
260 | 260 | if ui.configitems('keyword'): |
|
261 | 261 | raise util.Abort(_('[keyword] patterns cannot match')) |
|
262 | 262 | raise util.Abort(_('no [keyword] patterns configured')) |
@@ -456,7 +456,7 b' def reposetup(ui, repo):' | |||
|
456 | 456 | return kwt.wread(filename, data) |
|
457 | 457 | |
|
458 | 458 | def commit(self, files=None, text='', user=None, date=None, |
|
459 |
match= |
|
|
459 | match=None, force=False, force_editor=False, | |
|
460 | 460 | p1=None, p2=None, extra={}, empty_ok=False): |
|
461 | 461 | wlock = lock = None |
|
462 | 462 | _p1 = _p2 = None |
@@ -506,8 +506,10 b' class queue:' | |||
|
506 | 506 | repo.dirstate.merge(f) |
|
507 | 507 | p1, p2 = repo.dirstate.parents() |
|
508 | 508 | repo.dirstate.setparents(p1, merge) |
|
509 | ||
|
509 | 510 | files = patch.updatedir(self.ui, repo, files) |
|
510 | n = repo.commit(files, message, user, date, match=util.never, | |
|
511 | match = cmdutil.matchfiles(repo, files or []) | |
|
512 | n = repo.commit(files, message, user, date, match=match, | |
|
511 | 513 | force=True) |
|
512 | 514 | |
|
513 | 515 | if n == None: |
@@ -620,7 +622,7 b' class queue:' | |||
|
620 | 622 | raise util.Abort(_('patch "%s" already exists') % patch) |
|
621 | 623 | if opts.get('include') or opts.get('exclude') or pats: |
|
622 | 624 | match = cmdutil.match(repo, pats, opts) |
|
623 |
m, a, r, d = repo.status( |
|
|
625 | m, a, r, d = repo.status(match=match)[:4] | |
|
624 | 626 | else: |
|
625 | 627 | m, a, r, d = self.check_localchanges(repo, force) |
|
626 | 628 | match = cmdutil.match(repo, m + a + r) |
@@ -1047,7 +1049,7 b' class queue:' | |||
|
1047 | 1049 | match = cmdutil.matchfiles(repo, mm + aa + dd) |
|
1048 | 1050 | else: |
|
1049 | 1051 | match = cmdutil.matchall(repo) |
|
1050 |
m, a, r, d, u = repo.status( |
|
|
1052 | m, a, r, d, u = repo.status(match=match)[:5] | |
|
1051 | 1053 | |
|
1052 | 1054 | # we might end up with files that were added between |
|
1053 | 1055 | # tip and the dirstate parent, but then changed in the |
@@ -86,8 +86,7 b' def purge(ui, repo, *dirs, **opts):' | |||
|
86 | 86 | files = [] |
|
87 | 87 | match = cmdutil.match(repo, dirs, opts) |
|
88 | 88 | match.dir = directories.append |
|
89 |
for src, f, st in repo.dirstate.statwalk(match |
|
|
90 | ignored=ignored): | |
|
89 | for src, f, st in repo.dirstate.statwalk(match, ignored=ignored): | |
|
91 | 90 | if src == 'f' and f not in repo.dirstate: |
|
92 | 91 | files.append(f) |
|
93 | 92 |
@@ -431,7 +431,7 b' def dorecord(ui, repo, committer, *pats,' | |||
|
431 | 431 | |
|
432 | 432 | if changes is None: |
|
433 | 433 | match = cmdutil.matchfiles(repo, newfiles) |
|
434 |
changes = repo.status( |
|
|
434 | changes = repo.status(match=match)[:5] | |
|
435 | 435 | modified = dict.fromkeys(changes[0]) |
|
436 | 436 | |
|
437 | 437 | # 2. backup changed files, so we can restore them in the end |
@@ -1153,7 +1153,7 b' def commit(ui, repo, commitfunc, pats, o' | |||
|
1153 | 1153 | |
|
1154 | 1154 | m = match(repo, pats, opts) |
|
1155 | 1155 | if pats: |
|
1156 |
status = repo.status( |
|
|
1156 | status = repo.status(match=m) | |
|
1157 | 1157 | modified, added, removed, deleted, unknown = status[:5] |
|
1158 | 1158 | files = modified + added + removed |
|
1159 | 1159 | slist = None |
@@ -2180,7 +2180,7 b' def remove(ui, repo, *pats, **opts):' | |||
|
2180 | 2180 | raise util.Abort(_('no files specified')) |
|
2181 | 2181 | |
|
2182 | 2182 | m = cmdutil.match(repo, pats, opts) |
|
2183 |
mardu = map(dict.fromkeys, repo.status( |
|
|
2183 | mardu = map(dict.fromkeys, repo.status(match=m))[:5] | |
|
2184 | 2184 | modified, added, removed, deleted, unknown = mardu |
|
2185 | 2185 | |
|
2186 | 2186 | remove, forget = [], [] |
@@ -2363,7 +2363,7 b' def revert(ui, repo, *pats, **opts):' | |||
|
2363 | 2363 | names[abs] = m.rel(abs), m.exact(abs) |
|
2364 | 2364 | |
|
2365 | 2365 | m = cmdutil.matchfiles(repo, names) |
|
2366 |
changes = repo.status( |
|
|
2366 | changes = repo.status(match=m)[:4] | |
|
2367 | 2367 | modified, added, removed, deleted = map(dict.fromkeys, changes) |
|
2368 | 2368 | |
|
2369 | 2369 | # if f is a rename, also revert the source |
@@ -2630,7 +2630,7 b' def status(ui, repo, *pats, **opts):' | |||
|
2630 | 2630 | matcher = cmdutil.match(repo, pats, opts) |
|
2631 | 2631 | cwd = (pats and repo.getcwd()) or '' |
|
2632 | 2632 | modified, added, removed, deleted, unknown, ignored, clean = [ |
|
2633 |
n for n in repo.status(node1, node2, matcher |
|
|
2633 | n for n in repo.status(node1, node2, matcher, | |
|
2634 | 2634 | list_ignored=opts['ignored'] |
|
2635 | 2635 | or all and not ui.quiet, |
|
2636 | 2636 | list_clean=opts['clean'] or all, |
@@ -418,10 +418,10 b' class dirstate(object):' | |||
|
418 | 418 | |
|
419 | 419 | def walk(self, match): |
|
420 | 420 | # filter out the src and stat |
|
421 |
for src, f, st in self.statwalk(match |
|
|
421 | for src, f, st in self.statwalk(match): | |
|
422 | 422 | yield f |
|
423 | 423 | |
|
424 |
def statwalk(self |
|
|
424 | def statwalk(self, match, unknown=True, ignored=False): | |
|
425 | 425 | ''' |
|
426 | 426 | walk recursively through the directory tree, finding all files |
|
427 | 427 | matched by the match function |
@@ -442,6 +442,7 b' class dirstate(object):' | |||
|
442 | 442 | badfn = match.bad |
|
443 | 443 | |
|
444 | 444 | # walk all files by default |
|
445 | files = match.files() | |
|
445 | 446 | if not files: |
|
446 | 447 | files = ['.'] |
|
447 | 448 | dc = self._map.copy() |
@@ -569,11 +570,10 b' class dirstate(object):' | |||
|
569 | 570 | if imatch(k): |
|
570 | 571 | yield 'm', k, None |
|
571 | 572 | |
|
572 |
def status(self |
|
|
573 | def status(self, match, list_ignored, list_clean, list_unknown): | |
|
573 | 574 | lookup, modified, added, unknown, ignored = [], [], [], [], [] |
|
574 | 575 | removed, deleted, clean = [], [], [] |
|
575 | 576 | |
|
576 | files = files or [] | |
|
577 | 577 | _join = self._join |
|
578 | 578 | lstat = os.lstat |
|
579 | 579 | cmap = self._copymap |
@@ -587,10 +587,10 b' class dirstate(object):' | |||
|
587 | 587 | dadd = deleted.append |
|
588 | 588 | cadd = clean.append |
|
589 | 589 | |
|
590 |
for src, fn, st in self.statwalk( |
|
|
590 | for src, fn, st in self.statwalk(match, unknown=list_unknown, | |
|
591 | 591 | ignored=list_ignored): |
|
592 | 592 | if fn not in dmap: |
|
593 |
if (list_ignored or fn |
|
|
593 | if (list_ignored or match.exact(fn)) and self._dirignore(fn): | |
|
594 | 594 | if list_ignored: |
|
595 | 595 | iadd(fn) |
|
596 | 596 | elif list_unknown: |
@@ -11,6 +11,7 b' import repo, changegroup' | |||
|
11 | 11 | import changelog, dirstate, filelog, manifest, context, weakref |
|
12 | 12 | import lock, transaction, stat, errno, ui |
|
13 | 13 | import os, revlog, time, util, extensions, hook, inspect |
|
14 | import match as match_ | |
|
14 | 15 | |
|
15 | 16 | class localrepository(repo.repository): |
|
16 | 17 | capabilities = util.set(('lookup', 'changegroupsubset')) |
@@ -748,7 +749,7 b' class localrepository(repo.repository):' | |||
|
748 | 749 | p1=p1, p2=p2, extra=extra, empty_ok=True) |
|
749 | 750 | |
|
750 | 751 | def commit(self, files=None, text="", user=None, date=None, |
|
751 |
match= |
|
|
752 | match=None, force=False, force_editor=False, | |
|
752 | 753 | p1=None, p2=None, extra={}, empty_ok=False): |
|
753 | 754 | wlock = lock = tr = None |
|
754 | 755 | valid = 0 # don't save the dirstate if this isn't set |
@@ -964,7 +965,7 b' class localrepository(repo.repository):' | |||
|
964 | 965 | for fn in self.dirstate.walk(match): |
|
965 | 966 | yield fn |
|
966 | 967 | |
|
967 |
def status(self, node1=None, node2=None, |
|
|
968 | def status(self, node1=None, node2=None, match=None, | |
|
968 | 969 | list_ignored=False, list_clean=False, list_unknown=True): |
|
969 | 970 | """return status of files between two nodes or node and working directory |
|
970 | 971 | |
@@ -984,6 +985,9 b' class localrepository(repo.repository):' | |||
|
984 | 985 | del mf[fn] |
|
985 | 986 | return mf |
|
986 | 987 | |
|
988 | if not match: | |
|
989 | match = match_.always(self.root, self.getcwd()) | |
|
990 | ||
|
987 | 991 | modified, added, removed, deleted, unknown = [], [], [], [], [] |
|
988 | 992 | ignored, clean = [], [] |
|
989 | 993 | |
@@ -1000,10 +1004,8 b' class localrepository(repo.repository):' | |||
|
1000 | 1004 | # are we comparing the working directory? |
|
1001 | 1005 | if not node2: |
|
1002 | 1006 | (lookup, modified, added, removed, deleted, unknown, |
|
1003 |
ignored, clean) = self.dirstate.status( |
|
|
1004 |
list_ |
|
|
1005 | list_unknown) | |
|
1006 | ||
|
1007 | ignored, clean) = self.dirstate.status(match, list_ignored, | |
|
1008 | list_clean, list_unknown) | |
|
1007 | 1009 | # are we comparing working dir against its parent? |
|
1008 | 1010 | if compareworking: |
|
1009 | 1011 | if lookup: |
@@ -1186,7 +1186,7 b' def diff(repo, node1=None, node2=None, m' | |||
|
1186 | 1186 | date1 = util.datestr(ctx1.date()) |
|
1187 | 1187 | |
|
1188 | 1188 | if not changes: |
|
1189 |
changes = repo.status(node1, node2, |
|
|
1189 | changes = repo.status(node1, node2, match=match)[:5] | |
|
1190 | 1190 | modified, added, removed, deleted, unknown = changes |
|
1191 | 1191 | |
|
1192 | 1192 | if not modified and not added and not removed: |
@@ -96,6 +96,7 b' abort: local changes found, refresh firs' | |||
|
96 | 96 | A somefile |
|
97 | 97 | % qnew with uncommitted changes and missing file (issue 803) |
|
98 | 98 | someotherfile: No such file or directory |
|
99 | someotherfile: No such file or directory | |
|
99 | 100 | A somefile |
|
100 | 101 | issue803.patch |
|
101 | 102 | Patch queue now empty |
General Comments 0
You need to be logged in to leave comments.
Login now