[PATCH STABLE] windows: make win32 mandatory (issue1922)

Adrian Buehlmann adrian at cadifra.com
Thu Jan 20 13:05:29 CST 2011


On 2011-01-20 19:29, Matt Mackall wrote:
> On Thu, 2011-01-20 at 19:02 +0100, Adrian Buehlmann wrote:
>> On 2011-01-20 18:57, Mads Kiilerich wrote:
>>> On 01/20/2011 02:54 PM, Adrian Buehlmann wrote:
>>>> # HG changeset patch
>>>> # User Adrian Buehlmann<adrian at cadifra.com>
>>>> # Date 1295531395 -3600
>>>> # Branch stable
>>>> # Node ID 3fd55ff419f068ad5c3a96f7e2d2855072b5f32b
>>>> # Parent  75d0c38a0bca3501aaa3fa6b8c26de8ca0270803
>>>> windows: make win32 mandatory (issue1922)
>>>
>>> (It should be called pywin32 in the documentation and release note, so 
>>> why not call it that here too.)
>>>
>>>> --- a/mercurial/windows.py
>>>> +++ b/mercurial/windows.py
>>>> @@ -366,10 +366,6 @@ def groupmembers(name):
>>>>       # Don't support groups on Windows for now
>>>>       raise KeyError()
>>>>
>>>> -try:
>>>> -    # override functions with win32 versions if possible
>>>> -    from win32 import *
>>>> -except ImportError:
>>>> -    pass
>>>> +from win32 import *
>>>>
>>>>   expandglobs = True
>>>
>>> I think it would be fine to make pywin32 mandatory in 1.8, but I 
>>> wouldn't do it in a stable release. Users setups and web servers would 
>>> stop working just because of a minor version upgrade.
>>>
>>> This bug is annoying but (apparently) rare and doesn't cause data loss 
>>> unless data-losing commands are used.
>>
>> Failing to break hardlinks *does* cause repository corruption.
>>
>> hg verify will fail.
> 
> This is indeed a serious problem. But I liked the earlier idea of
> implementing our own nlink test in osutil.c. This should be fairly
> painless.

I'll try that then.

> I'll take this patch though if that doesn't work out.
> 
> We've also probably got a problem with pure/ now too.
> 

We could do

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -913,6 +913,8 @@ class opener(object):
                     # shares if the file is open.
                     fd = open(f)
                     nlink = nlinks(f)
+                    if nlink == 0:
+                        nlink = 2 # work around issue 1922
                     fd.close()
             except (OSError, IOError):
                 nlink = 0

slow but correct



More information about the Mercurial-devel mailing list