# HG changeset patch # User Alexis S. L. Carvalho # Date 1174015372 10800 # Node ID 281f9f8f1bd44d68a5b9d908f1c00c38eb784231 # Parent 2216535f07d752e93f5626a9d9df1eae7934efef 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 diff -r 2216535f07d7 -r 281f9f8f1bd4 mercurial/commands.py --- a/mercurial/commands.py Thu Mar 15 18:55:53 2007 -0500 +++ b/mercurial/commands.py Fri Mar 16 00:22:52 2007 -0300 @@ -2166,9 +2166,19 @@ # 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 diff -r 2216535f07d7 -r 281f9f8f1bd4 tests/test-revert --- a/tests/test-revert Thu Mar 15 18:55:53 2007 -0500 +++ b/tests/test-revert Fri Mar 16 00:22:52 2007 -0300 @@ -88,5 +88,8 @@ echo %% issue332 hg ci -A -m b -d '1000001 0' echo foobar > b/b -hg revert b +mkdir newdir +echo foo > newdir/newfile +hg add newdir/newfile +hg revert b newdir true diff -r 2216535f07d7 -r 281f9f8f1bd4 tests/test-revert.out --- a/tests/test-revert.out Thu Mar 15 18:55:53 2007 -0500 +++ b/tests/test-revert.out Fri Mar 16 00:22:52 2007 -0300 @@ -61,3 +61,4 @@ %% issue332 adding b/b reverting b/b +forgetting newdir/newfile