[PATCH V4] test-walk: enable for Windows

Adrian Buehlmann adrian at cadifra.com
Tue Jun 12 13:57:27 CDT 2012


On 2012-06-12 12:19, Mads Kiilerich wrote:
> On 12/06/12 11:08, Adrian Buehlmann wrote:
>> # HG changeset patch
>> # User Adrian Buehlmann <adrian at cadifra.com>
>> # Date 1339418460 -7200
>> # Node ID 2b3241a77d6dc768d8821bf96484232564fb1611
>> # Parent  b112e265b78a614dac15d5be92d39926d5e653da
>> test-walk: enable for Windows
>>
>> Changes to V2 of the patch:
>>
>>   - less glob-ish
>>   - less horrible to review
>>   - still keeps that glog:glob file for all cases
>>   - simply doing replace('\\', '/') in debugwalk (after all, it's
>>     just a debug command, so why fuss over it?)
>>
>> diff --git a/mercurial/commands.py b/mercurial/commands.py
>> --- a/mercurial/commands.py
>> +++ b/mercurial/commands.py
>> @@ -2375,7 +2375,8 @@
>>           max([len(abs) for abs in items]),
>>           max([len(m.rel(abs)) for abs in items]))
>>       for abs in items:
>> -        line = fmt % (abs, m.rel(abs), m.exact(abs) and 'exact' or '')
>> +        line = fmt % (abs, m.rel(abs).replace('\\', '/'),
>> +                      m.exact(abs) and 'exact' or '')
>>           ui.write("%s\n" % line.rstrip())
>>   
>>   @command('debugwireargs',
>> diff --git a/tests/test-walk.t b/tests/test-walk.t
>> --- a/tests/test-walk.t
>> +++ b/tests/test-walk.t
>> @@ -1,5 +1,3 @@
>> -  $ "$TESTDIR/hghave" no-windows || exit 80
>> -
>>     $ hg init t
>>     $ cd t
>>     $ mkdir -p beans
>> @@ -14,7 +12,6 @@
>>     $ echo fennel > fennel
>>     $ echo fenugreek > fenugreek
>>     $ echo fiddlehead > fiddlehead
>> -  $ echo glob:glob > glob:glob
> 
> Btw, not stated explicitly in this thread: This echo will on windows 
> create an empty file 'glob'.
> 
>>     $ hg addremove
>>     adding beans/black
>>     adding beans/borlotti
>> @@ -25,14 +22,19 @@
>>     adding fennel
>>     adding fenugreek
>>     adding fiddlehead
>> -  adding glob:glob
>>     adding mammals/Procyonidae/cacomistle
>>     adding mammals/Procyonidae/coatimundi
>>     adding mammals/Procyonidae/raccoon
>>     adding mammals/skunk
>> +#if no-windows
>> +  $ echo glob:glob > glob:glob
>> +  $ hg addremove
>> +  adding glob:glob
>>     warning: filename contains ':', which is reserved on Windows: 'glob:glob'
>> +#endif
>>     $ hg commit -m "commit #0"
> 
> I would prefer to move all the testing of the file 'glob:glob' to one 
> no-windows section ... and then remove the file again so it doesn't 
> clobber the rest of the tests.
> 
>> @@ -114,13 +181,18 @@
>>     f  beans/navy      ../beans/navy
>>     f  beans/pinto     ../beans/pinto
>>     f  beans/turtle    ../beans/turtle
>> -  $ hg debugwalk -I 'relpath:../beans'
>> +
>> +(arguments 'foo:../bar' are mangled by MSYS, so we do these in Python)
>> +
>> +  >>> from mercurial.dispatch import request, dispatch
>> +  >>> dispatch(request(['debugwalk', '-I', 'relpath:../beans']))
> 
> Matt do not like this hack.
> 
> relpath and listfile is probably not so relevant to test on all 
> platforms. I guess putting this in a #if no-msys could do.
> 
> 'relpath:ghost/../../beans' could however also be used to work around 
> the stupid msys quoting ... and arguably improve the test.
> 
> (For glob patterns it might be possible to use 'glob:[.]./beans' ... but 
> there is apparently not a problem with globs in the test.)
> 
>>   Test patterns:
>>   
>> +#if no-windows
>>     $ hg debugwalk glob:\*
>>     f  fennel      fennel
>>     f  fenugreek   fenugreek
>>     f  fiddlehead  fiddlehead
>>     f  glob:glob   glob:glob
> 
> I think this is where the 'glob:glob' file really matterns. Creating the 
> file here, addremove, walking and deleting it again will give 
> approximately the same test coverage as before.
> 
> (Experimenting with this gave some unexpected behaviour with glob:glob 
> being shown by debugwalk after it had been removed. YYMV.)
> 
> Moving 'glob:glob' might however lead to reductio ad absurdum. It is 
> possible that 'glob:glob' doesn't test anything relevant that isn't 
> tested elsewhere. It just don't think the case should be removed 
> silently without reasonable arguments.
> 
>> +#else
>> +  $ hg debugwalk glob:\*
>> +  f  fennel      fennel
>> +  f  fenugreek   fenugreek
>> +  f  fiddlehead  fiddlehead
>> +#endif

Thanks for the comments. Can I hand the porting of this test over to you?

I think you have now sufficently played with it yourself that I think it
is simpler if you do it yourself. Instead of me trying again. Thanks.


More information about the Mercurial-devel mailing list