[PATCH 1 of 2] util: give appropriate default args to atomictempfile()

Yuya Nishihara yuya at tcha.org
Fri May 21 06:17:10 CDT 2010


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1274439280 -32400
# Node ID c6a03ac45bd3028e8f72a24eac118d49b0559374
# Parent  f4cb6aebb22610b9c797871880c18f12d0188849
util: give appropriate default args to atomictempfile()

mode='w+b' is the default of python's TemporaryFile().

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -772,7 +772,7 @@ class atomictempfile(object):
     file.  When rename is called, the copy is renamed to the original
     name, making the changes visible.
     """
-    def __init__(self, name, mode, createmode):
+    def __init__(self, name, mode='w+b', createmode=None):
         self.__name = name
         self._fp = None
         self.temp = mktempcopy(name, emptyok=('w' in mode),


More information about the Mercurial-devel mailing list