diff mercurial/commands.py @ 4225:281f9f8f1bd4

Fix confusing message from hg revert (issue332) % mkdir sub1 % touch sub1/file1 % hg add sub1/ adding sub1/file1 % hg rev sub1 sub1: No such file in rev e4c586763258 forgetting sub1/file1
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 16 Mar 2007 00:22:52 -0300
parents 3be4785f8994
children 24c22a3f2ef8
line wrap: on
line diff
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2166,9 +2166,19 @@ def revert(ui, repo, *pats, **opts):
 
     # walk target manifest.
 
+    def badmatch(path):
+        if path in names:
+            return True
+        path_ = path + '/'
+        for f in names:
+            if f.startswith(path_):
+                return True
+        return False
+
     for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, node=node,
-                                             badmatch=names.has_key):
-        if abs in names: continue
+                                             badmatch=badmatch):
+        if abs in names or src == 'b':
+            continue
         names[abs] = (rel, exact)
         target_only[abs] = True