[PATCH 1 of 1 RFC] scmutil: eliminate util.samestat

Matt Mackall mpm at selenic.com
Tue Jun 12 18:16:59 CDT 2012


On Wed, 2012-06-13 at 01:03 +0200, Adrian Buehlmann wrote:
> On 2012-06-13 00:32, Adrian Buehlmann wrote:
> > On 2012-06-13 00:04, Matt Mackall wrote:
> >> On Sat, 2012-06-09 at 11:58 +0200, Adrian Buehlmann wrote:
> >>> # HG changeset patch
> >>> # User Adrian Buehlmann <adrian at cadifra.com>
> >>> # Date 1339182525 -7200
> >>> # Node ID 48649541c9a2002a148699136cff71865b18dc60
> >>> # Parent  2255950e1f7663a9faa6b57040cc5c0debe7d4dd
> >>> scmutil: eliminate util.samestat
> >>>
> >>> It's impossible to implement that on Windows.
> >>
> >> First, I don't know why that in itself is an argument for removing it.
> >> We have plenty of utility functions that are only relevant to one
> >> platform.
> >>
> >> Second, I don't believe it's impossible to implement and happen to know
> >> that analogous functions exist. For instance, GetFileInformationByHandle
> >> has fields that would serve the same purpose (volume serial number and
> >> file index):
> >>
> >>  http://msdn.microsoft.com/en-us/library/aa363788%28VS.85%29.aspx
> >>
> > 
> > That works only for files, for directories, samestat is impossible.

...

> $ python
> Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from mercurial import win32
> >>> win32.samefile('C:/Users/adi', 'C:/Users/adi')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "mercurial\win32.py", line 220, in samefile
>     res1 = _getfileinfo(fpath1)
>   File "mercurial\win32.py", line 197, in _getfileinfo
>     _raiseoserror(name)
>   File "mercurial\win32.py", line 190, in _raiseoserror
>     raise OSError(err.errno, '%s: %s' % (name, err.strerror))
> OSError: [Errno 13] C:/Users/adi: Access is denied.

See here:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858%
28v=vs.85%29.aspx

Grep for "FILE_FLAG_BACKUP_SEMANTICS".

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list