comparison mercurial/util.py @ 11212:4d8db9676171

util: give appropriate default args to atomictempfile() mode='w+b' is the default of python's TemporaryFile().
author Yuya Nishihara <yuya@tcha.org>
date Fri, 21 May 2010 19:54:40 +0900
parents 648130161e4d
children 97f6d2a02c1f
comparison
equal deleted inserted replaced
11211:e43c23d189a5 11212:4d8db9676171
770 770
771 All writes will be redirected to a temporary copy of the original 771 All writes will be redirected to a temporary copy of the original
772 file. When rename is called, the copy is renamed to the original 772 file. When rename is called, the copy is renamed to the original
773 name, making the changes visible. 773 name, making the changes visible.
774 """ 774 """
775 def __init__(self, name, mode, createmode): 775 def __init__(self, name, mode='w+b', createmode=None):
776 self.__name = name 776 self.__name = name
777 self._fp = None 777 self._fp = None
778 self.temp = mktempcopy(name, emptyok=('w' in mode), 778 self.temp = mktempcopy(name, emptyok=('w' in mode),
779 createmode=createmode) 779 createmode=createmode)
780 self._fp = posixfile(self.temp, mode) 780 self._fp = posixfile(self.temp, mode)