[meld] Python 2.6 updates for Git file request code
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Python 2.6 updates for Git file request code
- Date: Sun, 2 Dec 2012 21:25:31 +0000 (UTC)
commit 3e27ba5c6c7e86a346a07ac34709ea08ee23e730
Author: Kai Willadsen <kai willadsen gmail com>
Date: Tue Oct 23 06:50:57 2012 +1000
Python 2.6 updates for Git file request code
meld/vc/git.py | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/meld/vc/git.py b/meld/vc/git.py
index a352d2d..852418c 100644
--- a/meld/vc/git.py
+++ b/meld/vc/git.py
@@ -92,13 +92,9 @@ class Vc(_vc.CachedVc):
vc_file = _vc.popen(["git", "cat-file", "blob", commit + ":" + path],
cwd=self.location)
- # TODO: In Python 2.6+, this could be done with NamedTemporaryFile
- tmp_handle, tmp_path = tempfile.mkstemp(prefix='meld-tmp', text=True)
- tmp_file = os.fdopen(tmp_handle, 'w')
- shutil.copyfileobj(vc_file, tmp_file)
- tmp_file.close()
-
- return tmp_path
+ with tempfile.NamedTemporaryFile(prefix='meld-tmp', delete=False) as f:
+ shutil.copyfileobj(vc_file, f)
+ return f.name
def valid_repo(self):
# TODO: On Windows, this exit code is wrong under the normal shell; it
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]