The associated branch does exactly this on Windows, using ctypes to get at the "GetFileInformationByHandleEx" and "SetFileInformationByHandle" functions.
It is ugly and hackish, and needs the 'set_mtime()' functionality to be factored out into a helper (like something in osutils, etc.)
Also, I think eventually we would move the functions into _walkdirs_win32_pyx.pyx and _read_dir_pyx.pyx since they are platform specific stuff.
I think the test case for TreeTransform is reasonable, as is the basic layout of calling self._set_mtime() on the newly created file. It does test that:
1) The mtime is set to self._creation_mtime. We may actually want to expose this via an api, for people who want the timestamp of files to be set to the commit timestamp... (though that would be different for each file.)
2) Ensures that creating 2 different files gets the same timestamp, and that matches _creation_mtime.
Potentially the test needs to be updated so that comparisons are in seconds or milliseconds. I think it would be reasonable to test that st1.st_mtime is exactly st2.st_mtime, but we can compare that to _creation_mtime with just 1-sec resolution. (We should ensure that the time for the files is exact, but we don't care the exact time.)
The associated branch does exactly this on Windows, using ctypes to get at the "GetFileInforma tionByHandleEx" and "SetFileInforma tionByHandle" functions.
It is ugly and hackish, and needs the 'set_mtime()' functionality to be factored out into a helper (like something in osutils, etc.)
Also, I think eventually we would move the functions into _walkdirs_ win32_pyx. pyx and _read_dir_pyx.pyx since they are platform specific stuff.
I think the test case for TreeTransform is reasonable, as is the basic layout of calling self._set_mtime() on the newly created file. It does test that:
1) The mtime is set to self._creation_ mtime. We may actually want to expose this via an api, for people who want the timestamp of files to be set to the commit timestamp... (though that would be different for each file.)
2) Ensures that creating 2 different files gets the same timestamp, and that matches _creation_mtime.
Potentially the test needs to be updated so that comparisons are in seconds or milliseconds. I think it would be reasonable to test that st1.st_mtime is exactly st2.st_mtime, but we can compare that to _creation_mtime with just 1-sec resolution. (We should ensure that the time for the files is exact, but we don't care the exact time.)
I'll probably poke at this some more.