[PATCH 2 of 2] test-convert-git: remove the read-only attribute of repository files
Mads Kiilerich
mads at kiilerich.com
Sat Jun 9 07:34:40 CDT 2012
Eduard-Cristian Stefan wrote, On 06/09/2012 01:53 PM:
> 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.
Pushed to crew with an updated description, thanks.
>
>>> + > 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).
- but without this change. If you think it is a good idea then it is a
separate change with its own rationale.
/Mads
More information about the Mercurial-devel
mailing list