diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1697,10 +1697,8 @@ def locate(ui, repo, *pats, **opts): ret = 1 m = cmdutil.match(repo, pats, opts, default='relglob') - m.bad = lambda x,y: True + m.bad = lambda x,y: False for src, abs, rel, exact in cmdutil.walk(repo, m, node): - if src == 'b': - continue if not node and abs not in repo.dirstate: continue if opts['fullpath']: @@ -2342,11 +2340,7 @@ def revert(ui, repo, *pats, **opts): files = [] m = cmdutil.match(repo, pats, opts) - def bad(f, msg): - if f not in mf: - repo.ui.warn("%s: %s\n" % (m.rel(f), msg)) - return False - m.bad = bad + m.bad = lambda x,y: False for src, abs, rel, exact in cmdutil.walk(repo, m): names[abs] = (rel, exact) @@ -2354,17 +2348,18 @@ def revert(ui, repo, *pats, **opts): def badfn(path, msg): if path in names: - return True + return False path_ = path + '/' for f in names: if f.startswith(path_): - return True + return False + repo.ui.warn("%s: %s\n" % (m.rel(path), msg)) return False m = cmdutil.match(repo, pats, opts) m.bad = badfn for src, abs, rel, exact in cmdutil.walk(repo, m, node=node): - if abs in names or src == 'b': + if abs in names: continue names[abs] = (rel, exact) diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -432,7 +432,6 @@ class dirstate(object): 'f' the file was found in the directory tree 'd' the file is a directory of the tree 'm' the file was only in the dirstate and not in the tree - 'b' file was not found and did not match badfn and st is the stat result if the file was found in the directory. ''' @@ -543,7 +542,7 @@ class dirstate(object): if inst.errno != errno.ENOENT: fwarn(ff, inst.strerror) elif badfn(ff, inst.strerror) and imatch(nf): - yield 'b', ff, None + yield 'f', ff, None continue if s_isdir(st.st_mode): if not dirignore(nf): diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -941,7 +941,6 @@ class localrepository(repo.repository): is one of: 'f' the file was found in the directory tree 'm' the file was only in the dirstate and not in the tree - 'b' file was not found and matched badmatch ''' if node: @@ -965,7 +964,7 @@ class localrepository(repo.repository): for fn in ffiles: if match.bad(fn, 'No such file in rev ' + short(node)) \ and match(fn): - yield 'b', fn + yield 'f', fn else: for src, fn in self.dirstate.walk(match): yield src, fn diff --git a/tests/test-revert.out b/tests/test-revert.out --- a/tests/test-revert.out +++ b/tests/test-revert.out @@ -37,7 +37,7 @@ no changes needed to a %% should say file not managed file not managed: q %% should say file not found -notfound: No such file or directory +notfound: No such file in rev 095eacd0c0d7 A z ? e.orig %% should add a, remove d, forget z