Dirstate walking with name mangling filesystems [Was: Cleanup of the purge extension]
Emanuele Aina
faina.mail at tiscali.it
Sun Mar 11 20:43:06 UTC 2007
Alexis S. L. Carvalho delineò:
> IOW, there are 2 different problems: hg is usually interested only in
> tracked files - it can just lstat every file in this list to see if it's
> on the filesystem. OTOH, purge has a list of the files on the
> filesystem and it wants to know which ones are not tracked by hg -
> which, as we're seeing, can be quite a chore when there are aliases
> around.
Maybe I can add a repo.listdir() method which on a sane filesystem just
calls os.listdir() but on a name mangling one it creates a dict with the
normalized filenames (e.g. lowercase) and the corresponding filename as
stored in the dirstate. The method then will call os.listdir() using the
created dict to yield filenames as stored in the dirstate.
Something along these lines:
for filename in dirstate:
canonicalized_filename = filename.upper()
name_map[canonicalized_filename] = filename
return [name_map.get(i.upper(), i) for i in os.listdir():
What do you think?
--
Buongiorno.
Complimenti per l'ottima scelta.
More information about the Mercurial-devel
mailing list