You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/08/15 21:31:28 UTC
svn commit: r1157959 - /subversion/branches/fs-py/subversion/python/svn/fs.py
Author: hwright
Date: Mon Aug 15 19:31:28 2011
New Revision: 1157959
URL: http://svn.apache.org/viewvc?rev=1157959&view=rev
Log:
On the fs-py branch:
* subversion/python/svn/fs.py
(FS._set_revision_proplist): Use a higher-level file object for a
temporary file operation.
Modified:
subversion/branches/fs-py/subversion/python/svn/fs.py
Modified: subversion/branches/fs-py/subversion/python/svn/fs.py
URL: http://svn.apache.org/viewvc/subversion/branches/fs-py/subversion/python/svn/fs.py?rev=1157959&r1=1157958&r2=1157959&view=diff
==============================================================================
--- subversion/branches/fs-py/subversion/python/svn/fs.py (original)
+++ subversion/branches/fs-py/subversion/python/svn/fs.py Mon Aug 15 19:31:28 2011
@@ -210,12 +210,13 @@ class FS(object):
self._ensure_revision_exists(rev)
final_path = self.__path_revprops(rev)
- (fd, fn) = tempfile.mkstemp(dir=os.path.dirname(final_path))
- os.write(fd, svn.hash.encode(props, svn.hash.TERMINATOR))
- os.close(fd)
- shutil.copystat(self.__path_rev_absolute(rev), fn)
+ tempf = tempfile.NamedTemporaryFile(dir=os.path.dirname(final_path),
+ delete=False)
+ with tempf:
+ tempf.write(svn.hash.encode(props, svn.hash.TERMINATOR))
- os.rename(fn, final_path)
+ shutil.copystat(self.__path_rev_absolute(rev), tempf.name)
+ os.rename(tempf.name, final_path)
def __read_format(self):