[PATCH 0 of 2] Improved util.rename on Windows

Sune Foldager cryo at cyanite.org
Mon Feb 16 12:58:32 UTC 2009


These patches improve the util.rename functions. It has a small 'FIXME' comment which the first patch addresses,
and a more serious problem on Windows in the presense of virus scanners and similar systems, which can lead to
corruption and data loss when used in connection with strip, rebase and the like.

The controversial part of the second patch is its use of the deprecated tempfile.mktemp. As I explained in my
mails on this issue, python's reasons for deprecation are not entirely correct; in particular their comment that
uses of the function can "always be replaced with ...". On Windows, this is plainly wrong. For this particular
use we really need the mktemp semantics, as it is the best one can do on Windows, it seems.

I propose we keep mktemp in until python 3 compatibility is addressed, since mktemp (while still supported)
issues a warning when used with python 3. IMHO duplicating the function is a waste of time and effort, although
we could do with a less complicated version, compared to the one in tempfile.

-- 
Sune Foldager


More information about the Mercurial-devel mailing list