[PATCH] alternative patch for issue 1364

Petr Kodl petrkodl at gmail.com
Sat Nov 1 10:33:08 CDT 2008


# HG changeset patch
# User Petr Kodl <petrkodl at gmail.com>
# Date 1225553578 14400
# Node ID 0fd651da4aa59ef8114f0014468381dd830f9968
# Parent  c4461ea8b4c8022568080ecc847ba4ed3e17906c
alternative patch for issue 1364

Disable osutil.c and related optimizations for Python < 2.5 on Win32.

osutil.c uses Win32 API instead of msvcrt calls which leads to inconsistent
DST offset handling between Python lstat modification time and osutil.c reported
values. Starting Python 2.5 lstat is implemented directly as Win32 call and
there is no inconsistency bestween lstat and osutil.c

diff -r c4461ea8b4c8 -r 0fd651da4aa5 mercurial/util.py
--- a/mercurial/util.py	Sun Oct 26 17:26:28 2008 +0100
+++ b/mercurial/util.py	Sat Nov 01 11:32:58 2008 -0400
@@ -874,7 +874,7 @@
             cache = dircache.setdefault(dir, dmap)
         yield cache.get(base, None)
 
-if sys.platform == 'win32':
+if sys.platform == 'win32' and sys.version_info[:2] > (2, 4):
     statfiles = _statfiles_clustered
 else:
     statfiles = _statfiles
diff -r c4461ea8b4c8 -r 0fd651da4aa5 setup.py
--- a/setup.py	Sun Oct 26 17:26:28 2008 +0100
+++ b/setup.py	Sat Nov 01 11:32:58 2008 -0400
@@ -103,7 +103,12 @@
 
 try:
     import msvcrt
-    ext_modules.append(Extension('mercurial.osutil', ['mercurial/osutil.c']))
+    import sys
+    # avoid Win32 native osutil for Python < 2.5
+    # Python versions older than 2.5 use msvcrt fstat call
+    # with inconsistent DST time handling
+    if sys.version_info[:2] > (2, 4):
+        ext_modules.append(Extension('mercurial.osutil', ['mercurial/osutil.c']))
 except ImportError:
     pass
 


More information about the Mercurial-devel mailing list