[PATCH 2 of 2] test-convert-git: remove the read-only attribute of repository files

Eduard-Cristian Stefan alexandrul.ct at gmail.com
Sat Jun 9 06:53:44 CDT 2012


On 2012-06-09 00:40, Mads Kiilerich wrote:
> alexandrul.ct at gmail.com wrote, On 06/08/2012 05:23 PM:
>> test-convert-git: remove the read-only attribute of repository files
>>
>> diff --git a/tests/test-convert-git.t b/tests/test-convert-git.t
>> --- a/tests/test-convert-git.t
>> +++ b/tests/test-convert-git.t
>> @@ -283,11 +283,17 @@
>>     $ cat > damage.py <<EOF
>>     > import os
>> +  > import stat
>>     > for root, dirs, files in os.walk('git-repo4/.git/objects'):
>>     >     if files:
>>     >         path = os.path.join(root, files[0])
>> -  >         os.remove(path)
>> -  >         break
>> +  >         try:
>> +  >             if os.name == 'nt':
>> +  >                 os.chmod(path, stat.S_IWRITE)
>
> Why is this needed now ... or why is it only needed on windows?
On windows the git repository files have the read-only attribute set,
at least on my PC.

>> +  >             os.remove(path)
>> +  >             break
>> +  >         except:
>> +  >             continue
>
> Why this blank except/continue? What problem will it hide ... and why is that not a problem?

Will eat any exceptions in the hope that some other file
in the git repository will be succesfully deleted
so the repository will be in an invalid state
(as expected in the last part of the test).

IMHO it's not a problem because without deleting
one of those files the test will fail anyway.



More information about the Mercurial-devel mailing list