Rev 4942: Review feedback from Martin <gzlist> in http://bazaar.launchpad.net/~jameinel/bzr/2.1.0rc1-set-mtime

John Arbash Meinel john at arbash-meinel.com
Wed Jan 6 18:15:42 GMT 2010


At http://bazaar.launchpad.net/~jameinel/bzr/2.1.0rc1-set-mtime

------------------------------------------------------------
revno: 4942
revision-id: john at arbash-meinel.com-20100106181517-4ktyo41hygkua09c
parent: john at arbash-meinel.com-20100106172057-inza3wazs24pbith
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0rc1-set-mtime
timestamp: Wed 2010-01-06 12:15:17 -0600
message:
  Review feedback from Martin <gzlist>
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2010-01-05 21:41:09 +0000
+++ b/NEWS	2010-01-06 18:15:17 +0000
@@ -67,9 +67,8 @@
 * Operations which update the working tree should now create all files
   with the same mtime. So if you version a generated file and its source,
   when updating you should get the same mtime for both files. We use
-  ``SetFileInformationByHandle`` on Windows, and ``futimes()`` on POSIX
-  systems to achieve this effect. This only works when extensions are
-  compiled as pure-python does not expose similar functionality.
+  ``SetFileInformationByHandle`` on Windows, ``futimes()`` on POSIX, an
+  ``os.utime`` otherwise to achieve this effect.
   (John Arbash Meinel, #488724)
 
 * The 2a format wasn't properly restarting autopacks when something

=== modified file 'bzrlib/_walkdirs_win32.pyx'
--- a/bzrlib/_walkdirs_win32.pyx	2010-01-06 17:20:57 +0000
+++ b/bzrlib/_walkdirs_win32.pyx	2010-01-06 18:15:17 +0000
@@ -93,7 +93,6 @@
     object PyUnicode_AsUTF8String(object)
 
 
-import msvcrt
 import operator
 import stat
 

=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py	2010-01-06 17:20:57 +0000
+++ b/bzrlib/osutils.py	2010-01-06 18:15:17 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2006, 2007, 2009 Canonical Ltd
+# Copyright (C) 2005, 2006, 2007, 2009, 2010 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -1902,10 +1902,7 @@
 def fset_mtime(f, mtime):
     """Set the last-modified time (mtime) for this file handle.
 
-    This uses native OS functionality to set file times. As such, if extensions
-    are not compiled, this function becomes a no-op.
-
-    :param f: A File object (from open())
+    :param f: A File object (from open()).
     :param mtime: time-since-epoch to set the mtime to. (same as time.time(),
         or st.st_mtime, etc.). This can be a floating point number, but we
         don't guarantee better than 1s resolution.
@@ -1913,20 +1910,15 @@
     """
     global _set_mtime_func
     if _set_mtime_func is None:
-        if sys.platform == "win32":
-            try:
+        try:
+            if sys.platform == "win32":
                 from bzrlib._walkdirs_win32 import fset_mtime
-            except ImportError:
-                _set_mtime_func = _utime_fset_mtime
             else:
-                _set_mtime_func = fset_mtime
-        else:
-            try:
                 from bzrlib._readdir_pyx import fset_mtime
-            except ImportError:
-                _set_mtime_func = _utime_fset_mtime
-            else:
-                _set_mtime_func = fset_mtime
+        except ImportError:
+            _set_mtime_func = _utime_fset_mtime
+        else:
+            _set_mtime_func = fset_mtime
     return _set_mtime_func(f, mtime)
 
 



More information about the bazaar-commits mailing list