diff --git a/hgext/extdiff.py b/hgext/extdiff.py --- a/hgext/extdiff.py +++ b/hgext/extdiff.py @@ -123,7 +123,7 @@ def dodiff(ui, repo, diffcmd, diffopts, node1, node2 = cmdutil.revpair(repo, opts['rev']) matcher = cmdutil.match(repo, pats, opts) modified, added, removed, deleted, unknown = repo.status( - node1, node2, matcher.files(), match=matcher)[:5] + node1, node2, matcher)[:5] if not (modified or added or removed): return 0 diff --git a/hgext/hgk.py b/hgext/hgk.py --- a/hgext/hgk.py +++ b/hgext/hgk.py @@ -56,7 +56,7 @@ def difftree(ui, repo, node1=None, node2 mmap = repo.changectx(node1).manifest() mmap2 = repo.changectx(node2).manifest() m = cmdutil.matchfiles(repo, files) - status = repo.status(node1, node2, files=m.files(), match=m)[:5] + status = repo.status(node1, node2, match=m)[:5] modified, added, removed, deleted, unknown = status empty = short(nullid) diff --git a/hgext/inotify/__init__.py b/hgext/inotify/__init__.py --- a/hgext/inotify/__init__.py +++ b/hgext/inotify/__init__.py @@ -47,8 +47,9 @@ def reposetup(ui, repo): # to recurse. inotifyserver = False - def status(self, files, match, list_ignored, list_clean, + def status(self, match, list_ignored, list_clean, list_unknown=True): + files = match.files() try: if not list_ignored and not self.inotifyserver: result = client.query(ui, repo, files, match, False, @@ -88,7 +89,7 @@ def reposetup(ui, repo): ui.print_exc() return super(inotifydirstate, self).status( - files, match or util.always, list_ignored, list_clean, + match, list_ignored, list_clean, list_unknown) repo.dirstate.__class__ = inotifydirstate diff --git a/hgext/keyword.py b/hgext/keyword.py --- a/hgext/keyword.py +++ b/hgext/keyword.py @@ -256,7 +256,7 @@ def _status(ui, repo, kwt, *pats, **opts Returns status of working directory.''' if kwt: matcher = cmdutil.match(repo, pats, opts) - return repo.status(files=matcher.files(), match=matcher, list_clean=True) + return repo.status(match=matcher, list_clean=True) if ui.configitems('keyword'): raise util.Abort(_('[keyword] patterns cannot match')) raise util.Abort(_('no [keyword] patterns configured')) @@ -456,7 +456,7 @@ def reposetup(ui, repo): return kwt.wread(filename, data) def commit(self, files=None, text='', user=None, date=None, - match=util.always, force=False, force_editor=False, + match=None, force=False, force_editor=False, p1=None, p2=None, extra={}, empty_ok=False): wlock = lock = None _p1 = _p2 = None diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -506,8 +506,10 @@ class queue: repo.dirstate.merge(f) p1, p2 = repo.dirstate.parents() repo.dirstate.setparents(p1, merge) + files = patch.updatedir(self.ui, repo, files) - n = repo.commit(files, message, user, date, match=util.never, + match = cmdutil.matchfiles(repo, files or []) + n = repo.commit(files, message, user, date, match=match, force=True) if n == None: @@ -620,7 +622,7 @@ class queue: raise util.Abort(_('patch "%s" already exists') % patch) if opts.get('include') or opts.get('exclude') or pats: match = cmdutil.match(repo, pats, opts) - m, a, r, d = repo.status(files=match.files(), match=match)[:4] + m, a, r, d = repo.status(match=match)[:4] else: m, a, r, d = self.check_localchanges(repo, force) match = cmdutil.match(repo, m + a + r) @@ -1047,7 +1049,7 @@ class queue: match = cmdutil.matchfiles(repo, mm + aa + dd) else: match = cmdutil.matchall(repo) - m, a, r, d, u = repo.status(files=match.files(), match=match)[:5] + m, a, r, d, u = repo.status(match=match)[:5] # we might end up with files that were added between # tip and the dirstate parent, but then changed in the diff --git a/hgext/purge.py b/hgext/purge.py --- a/hgext/purge.py +++ b/hgext/purge.py @@ -86,8 +86,7 @@ def purge(ui, repo, *dirs, **opts): files = [] match = cmdutil.match(repo, dirs, opts) match.dir = directories.append - for src, f, st in repo.dirstate.statwalk(match.files(), match, - ignored=ignored): + for src, f, st in repo.dirstate.statwalk(match, ignored=ignored): if src == 'f' and f not in repo.dirstate: files.append(f) diff --git a/hgext/record.py b/hgext/record.py --- a/hgext/record.py +++ b/hgext/record.py @@ -431,7 +431,7 @@ def dorecord(ui, repo, committer, *pats, if changes is None: match = cmdutil.matchfiles(repo, newfiles) - changes = repo.status(files=match.files(), match=match)[:5] + changes = repo.status(match=match)[:5] modified = dict.fromkeys(changes[0]) # 2. backup changed files, so we can restore them in the end diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1153,7 +1153,7 @@ def commit(ui, repo, commitfunc, pats, o m = match(repo, pats, opts) if pats: - status = repo.status(files=m.files(), match=m) + status = repo.status(match=m) modified, added, removed, deleted, unknown = status[:5] files = modified + added + removed slist = None diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2180,7 +2180,7 @@ def remove(ui, repo, *pats, **opts): raise util.Abort(_('no files specified')) m = cmdutil.match(repo, pats, opts) - mardu = map(dict.fromkeys, repo.status(files=m.files(), match=m))[:5] + mardu = map(dict.fromkeys, repo.status(match=m))[:5] modified, added, removed, deleted, unknown = mardu remove, forget = [], [] @@ -2363,7 +2363,7 @@ def revert(ui, repo, *pats, **opts): names[abs] = m.rel(abs), m.exact(abs) m = cmdutil.matchfiles(repo, names) - changes = repo.status(files=m.files(), match=m)[:4] + changes = repo.status(match=m)[:4] modified, added, removed, deleted = map(dict.fromkeys, changes) # if f is a rename, also revert the source @@ -2630,7 +2630,7 @@ def status(ui, repo, *pats, **opts): matcher = cmdutil.match(repo, pats, opts) cwd = (pats and repo.getcwd()) or '' modified, added, removed, deleted, unknown, ignored, clean = [ - n for n in repo.status(node1, node2, matcher.files(), matcher, + n for n in repo.status(node1, node2, matcher, list_ignored=opts['ignored'] or all and not ui.quiet, list_clean=opts['clean'] or all, diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -418,10 +418,10 @@ class dirstate(object): def walk(self, match): # filter out the src and stat - for src, f, st in self.statwalk(match.files(), match): + for src, f, st in self.statwalk(match): yield f - def statwalk(self, files, match, unknown=True, ignored=False): + def statwalk(self, match, unknown=True, ignored=False): ''' walk recursively through the directory tree, finding all files matched by the match function @@ -442,6 +442,7 @@ class dirstate(object): badfn = match.bad # walk all files by default + files = match.files() if not files: files = ['.'] dc = self._map.copy() @@ -569,11 +570,10 @@ class dirstate(object): if imatch(k): yield 'm', k, None - def status(self, files, match, list_ignored, list_clean, list_unknown): + def status(self, match, list_ignored, list_clean, list_unknown): lookup, modified, added, unknown, ignored = [], [], [], [], [] removed, deleted, clean = [], [], [] - files = files or [] _join = self._join lstat = os.lstat cmap = self._copymap @@ -587,10 +587,10 @@ class dirstate(object): dadd = deleted.append cadd = clean.append - for src, fn, st in self.statwalk(files, match, unknown=list_unknown, + for src, fn, st in self.statwalk(match, unknown=list_unknown, ignored=list_ignored): if fn not in dmap: - if (list_ignored or fn in files) and self._dirignore(fn): + if (list_ignored or match.exact(fn)) and self._dirignore(fn): if list_ignored: iadd(fn) elif list_unknown: diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -11,6 +11,7 @@ import repo, changegroup import changelog, dirstate, filelog, manifest, context, weakref import lock, transaction, stat, errno, ui import os, revlog, time, util, extensions, hook, inspect +import match as match_ class localrepository(repo.repository): capabilities = util.set(('lookup', 'changegroupsubset')) @@ -748,7 +749,7 @@ class localrepository(repo.repository): p1=p1, p2=p2, extra=extra, empty_ok=True) def commit(self, files=None, text="", user=None, date=None, - match=util.always, force=False, force_editor=False, + match=None, force=False, force_editor=False, p1=None, p2=None, extra={}, empty_ok=False): wlock = lock = tr = None valid = 0 # don't save the dirstate if this isn't set @@ -964,7 +965,7 @@ class localrepository(repo.repository): for fn in self.dirstate.walk(match): yield fn - def status(self, node1=None, node2=None, files=[], match=util.always, + def status(self, node1=None, node2=None, match=None, list_ignored=False, list_clean=False, list_unknown=True): """return status of files between two nodes or node and working directory @@ -984,6 +985,9 @@ class localrepository(repo.repository): del mf[fn] return mf + if not match: + match = match_.always(self.root, self.getcwd()) + modified, added, removed, deleted, unknown = [], [], [], [], [] ignored, clean = [], [] @@ -1000,10 +1004,8 @@ class localrepository(repo.repository): # are we comparing the working directory? if not node2: (lookup, modified, added, removed, deleted, unknown, - ignored, clean) = self.dirstate.status(files, match, - list_ignored, list_clean, - list_unknown) - + ignored, clean) = self.dirstate.status(match, list_ignored, + list_clean, list_unknown) # are we comparing working dir against its parent? if compareworking: if lookup: diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -1186,7 +1186,7 @@ def diff(repo, node1=None, node2=None, m date1 = util.datestr(ctx1.date()) if not changes: - changes = repo.status(node1, node2, files=match.files(), match=match)[:5] + changes = repo.status(node1, node2, match=match)[:5] modified, added, removed, deleted, unknown = changes if not modified and not added and not removed: diff --git a/tests/test-mq.out b/tests/test-mq.out --- a/tests/test-mq.out +++ b/tests/test-mq.out @@ -96,6 +96,7 @@ abort: local changes found, refresh firs A somefile % qnew with uncommitted changes and missing file (issue 803) someotherfile: No such file or directory +someotherfile: No such file or directory A somefile issue803.patch Patch queue now empty