issue332 revisit

Alexis S. L. Carvalho alexis at cecm.usp.br
Tue Mar 13 17:11:55 CDT 2007


Thus spake TK Soh:
> I'm planning to reopen isue332, by the following observation:
> 
>    % mkdir sub1
>    % touch sub1/file1
>    % hg add sub1/
>    adding sub1/file1
>    % hg rev sub1
>    sub1: No such file in rev e4c586763258
>    forgetting sub1/file1
> 
> Please let me know if I should open a new issue instead.

Please reopen it.  I think the patch below fixes it, but I'm still not
sure it won't have unintended consequences.

Alexis

diff -r 7ca05d29c1f0 mercurial/commands.py
--- a/mercurial/commands.py	Sun Mar 11 14:21:09 2007 -0700
+++ b/mercurial/commands.py	Tue Mar 13 17:58:15 2007 -0300
@@ -2174,9 +2174,18 @@ def revert(ui, repo, *pats, **opts):
 
     # walk target manifest.
 
+    def badmatch(x):
+        if x in names:
+            return True
+        x_ = x + '/'
+        for f in names:
+            if f.startswith(x_):
+                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
 


More information about the Mercurial-devel mailing list