[PATCH V3] update: fix edge-case with update.atomic-file and read-only files

Boris FELD boris.feld at octobus.net
Thu Jan 17 09:17:32 EST 2019


Indeed, I am not yet familiar with the windows/posix module juggling.

I will send a V4 shortly.

On 17/01/2019 12:59, Yuya Nishihara wrote:
> On Mon, 14 Jan 2019 10:04:30 +0100, Boris Feld wrote:
>> # HG changeset patch
>> # User Boris Feld <boris.feld at octobus.net>
>> # Date 1547128621 -3600
>> #      Thu Jan 10 14:57:01 2019 +0100
>> # Node ID 0a3fe47decbe8920754e44d6448bfa474990edd3
>> # Parent  963462786f6e028563bcedc9008622e0f3b59c86
>> # EXP-Topic atomic-update-read-only
>> # Available At https://bitbucket.org/octobus/mercurial-devel/
>> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 0a3fe47decbe
>> update: fix edge-case with update.atomic-file and read-only files
>>
>> We used to create the tempfile with the original file mode. That means
>> creating a read-only tempfile when the original file is read-only, which crash
>> if we need to write on the tempfile.
>>
>> The file in the working directory ends up being writable with and without the
>> atomic update config, so the behavior is the same.
>>
>> diff --git a/mercurial/posix.py b/mercurial/posix.py
>> --- a/mercurial/posix.py
>> +++ b/mercurial/posix.py
>> @@ -153,7 +153,7 @@ def setflags(f, l, x):
>>          # Turn off all +x bits
>>          os.chmod(f, s & 0o666)
>>  
>> -def copymode(src, dst, mode=None):
>> +def copymode(src, dst, mode=None, enforcewritable=False):
> Need to update windows.copymode() as well.
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list