# HG changeset patch # User Benoit Boissinot # Date 1156794542 -7200 # Node ID aebc3f64b20f3f8e67a79f14dd0e864dbf8d7119 # Parent db3f42261452986ea709c56e7e70e8814b2828f6 fix incorrect warning when walking on a particular rev when a directory was given instead of a file it reported incorrectly 'No such file or directory in rev ' we test if the file is a prefix directory diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -641,7 +641,11 @@ class localrepository(repo.repository): if node: fdict = dict.fromkeys(files) for fn in self.manifest.read(self.changelog.read(node)[0]): - fdict.pop(fn, None) + for ffn in fdict: + # match if the file is the exact name or a directory + if ffn == fn or fn.startswith("%s/" % ffn): + del fdict[ffn] + break if match(fn): yield 'm', fn for fn in fdict: diff --git a/tests/test-revert b/tests/test-revert --- a/tests/test-revert +++ b/tests/test-revert @@ -85,4 +85,8 @@ hg revert -rtip echo % should succeed hg revert --all -rtip +echo %% issue332 +hg ci -A -m b -d '1000001 0' +echo foobar > b/b +hg revert b true diff --git a/tests/test-revert.out b/tests/test-revert.out --- a/tests/test-revert.out +++ b/tests/test-revert.out @@ -58,3 +58,6 @@ 1 files updated, 0 files merged, 0 files abort: no files or directories specified % should succeed reverting a +%% issue332 +adding b/b +reverting b/b