changeset 3019:aebc3f64b20f

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 <rev>' we test if the file is a prefix directory
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Mon, 28 Aug 2006 21:49:02 +0200
parents db3f42261452
children ea2a9c13afc6
files mercurial/localrepo.py tests/test-revert tests/test-revert.out
diffstat 3 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Sat Aug 26 11:19:00 2006 +0200
+++ b/mercurial/localrepo.py	Mon Aug 28 21:49:02 2006 +0200
@@ -641,7 +641,11 @@
         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:
--- a/tests/test-revert	Sat Aug 26 11:19:00 2006 +0200
+++ b/tests/test-revert	Mon Aug 28 21:49:02 2006 +0200
@@ -85,4 +85,8 @@
 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
--- a/tests/test-revert.out	Sat Aug 26 11:19:00 2006 +0200
+++ b/tests/test-revert.out	Mon Aug 28 21:49:02 2006 +0200
@@ -58,3 +58,6 @@
 abort: no files or directories specified
 % should succeed
 reverting a
+%% issue332
+adding b/b
+reverting b/b