[PATCH] clone/pull: abort on reserved filenames on Windows (2nd update)

Adrian Buehlmann adrian at cadifra.com
Fri Jun 13 09:58:37 CDT 2008


On 13.06.2008 15:54, Paul Moore wrote:
> On 13/06/2008, Adrian Buehlmann <adrian at cadifra.com> wrote:
>> --- a/mercurial/util.py Thu Jun 12 07:38:15 2008 -0500
>> +++ b/mercurial/util.py Fri Jun 13 11:50:46 2008 +0200
>> @@ -936,10 +936,23 @@
>>  def lookup_reg(key, name=None, scope=None):
>>     return None
>>
>> +_reserved_windows_filenames = '''CON PRN AUX NUL
>> +    COM1 COM2 COM3 COM4 COM5 COM6 COM7 COM8 COM9
>> +    LPT1 LPT2 LPT3 LPT4 LPT5 LPT6 LPT7 LPT8 LPT9'''.split()
>> +def win_unsupported_path(p):
> 
> You should also be able to put an override for unsupported_path in
> util_win32.py - this is read after the generic definition, and will
> override it.

Hmm. Not sure what you mean with this.

First line of util_win32.py reads:

# util_win32.py - utility functions that use win32 API

(http://hg.intevation.org/mercurial/crew/file/be55b1a6d4b1/mercurial/util_win32.py)

I don't use the win32 API.

If it helps, I deliberately defined win_unsupported_path outside

 if os.name == 'nt':

because I think win_unsupported_path may be useful for future additions,
which may call it even when running on non-Windows platforms. For example, an
extension that warns users trying to push a file with a Windows reserved
filename into a repo on a unix server (might be useful for mixed platform
projects).

I am also thinking about potential changes to hg verify, for example
we might output a notification message on "hg verify --debug" if there are files
in the repo that have a Windows reserved filename -- even if the command
is run on unix system.





More information about the Mercurial-devel mailing list