Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 27E587ADA for ; Mon, 15 Aug 2011 19:31:52 +0000 (UTC) Received: (qmail 57859 invoked by uid 500); 15 Aug 2011 19:31:52 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 57665 invoked by uid 500); 15 Aug 2011 19:31:51 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 57614 invoked by uid 99); 15 Aug 2011 19:31:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Aug 2011 19:31:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Aug 2011 19:31:48 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 721CA238885D for ; Mon, 15 Aug 2011 19:31:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1157959 - /subversion/branches/fs-py/subversion/python/svn/fs.py Date: Mon, 15 Aug 2011 19:31:28 -0000 To: commits@subversion.apache.org From: hwright@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110815193128.721CA238885D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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):