[meld] Support direct repo file access in Fossil VC
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Support direct repo file access in Fossil VC
- Date: Fri, 21 Jun 2013 22:03:56 +0000 (UTC)
commit 15649d3cdca09ad137b7d1647bea78d1d1a05107
Author: Kai Willadsen <kai willadsen gmail com>
Date: Tue Jun 18 06:27:01 2013 +1000
Support direct repo file access in Fossil VC
meld/vc/fossil.py | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/meld/vc/fossil.py b/meld/vc/fossil.py
index ba4a203..3f08f76 100644
--- a/meld/vc/fossil.py
+++ b/meld/vc/fossil.py
@@ -26,6 +26,9 @@
import errno
import logging
import os
+import shutil
+import subprocess
+import tempfile
from . import _vc
@@ -82,6 +85,27 @@ class Vc(_vc.CachedVc):
def get_working_directory(self, workdir):
return self.root
+ def get_path_for_repo_file(self, path, commit=None):
+ if commit is None:
+ commit = ""
+
+ if not path.startswith(self.root + os.path.sep):
+ raise _vc.InvalidVCPath(self, path, "Path not in repository")
+ path = path[len(self.root) + 1:]
+
+ command = [self.CMD, "finfo", "-p", path]
+ if commit:
+ command.extend(["-r", commit])
+
+ process = subprocess.Popen(command,
+ cwd=self.root, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ vc_file = process.stdout
+
+ with tempfile.NamedTemporaryFile(prefix='meld-tmp', delete=False) as f:
+ shutil.copyfileobj(vc_file, f)
+ return f.name
+
def _lookup_tree_cache(self, rootdir):
log = logging.getLogger(__name__)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]