[meld] Rename repo-file-path API to be less confusing



commit e13d2f528d21d08214debe86511613a7bfd5f2ec
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Dec 1 06:20:57 2012 +1000

    Rename repo-file-path API to be less confusing

 meld/vc/_vc.py    |   23 +++++++++--------------
 meld/vc/git.py    |    2 +-
 meld/vc/svn.py    |    2 +-
 meld/vc/svn_17.py |    2 +-
 meld/vcview.py    |    3 ++-
 5 files changed, 14 insertions(+), 18 deletions(-)
---
diff --git a/meld/vc/_vc.py b/meld/vc/_vc.py
index 09f7e74..322bf34 100644
--- a/meld/vc/_vc.py
+++ b/meld/vc/_vc.py
@@ -110,23 +110,18 @@ class Vc(object):
     def patch_command(self, workdir):
         return ["patch", "-p%i" % self.PATCH_STRIP_NUM, "-R", "-d", workdir]
 
-    def get_repo_file_path(self, path, commit=None):
-        """Requests a file path for the repository copy of the given path.
+    def get_path_for_repo_file(self, path, commit=None):
+        """Returns a file path for the repository path at commit
 
-        Regardless of whether the VCS in question maintains an on-disk copy of
-        the given path, to avoid destructive editing, a temp file with the
-        given content must be created and its path returned. The VCS plugin
-        must **not** delete temp files it creates.
+        If *commit* is given, the path returned will point to a copy of
+        the file at *path* at the given commit, as interpreted by the
+        VCS. If *commit* is **None**, the current revision is used.
 
-        If *commit* is given, then the path returned will point to a copy of
-        the file at path at the given commit, as interpreted by the VCS in
-        question. If *commit* is **None**, then the current tip is used.
+        Even if the VCS maintains an on-disk copy of the given path, a
+        temp file with file-at-commit content must be created and its
+        path returned, to avoid destructive editing. The VCS plugin
+        must **not** delete temp files it creates.
         """
-
-        # TODO: This method is required to return a path because of how
-        # FileDiff currently operates. In the future, allowing for blob
-        # returns would be desirable.
-
         raise NotImplementedError()
 
     def check_repo_root(self, location):
diff --git a/meld/vc/git.py b/meld/vc/git.py
index 852418c..82a634a 100644
--- a/meld/vc/git.py
+++ b/meld/vc/git.py
@@ -79,7 +79,7 @@ class Vc(_vc.CachedVc):
     def revert_command(self):
         return [self.CMD,"checkout"]
 
-    def get_repo_file_path(self, path, commit=None):
+    def get_path_for_repo_file(self, path, commit=None):
         if commit is None:
             commit = "HEAD"
         else:
diff --git a/meld/vc/svn.py b/meld/vc/svn.py
index 99e277f..d17e4be 100644
--- a/meld/vc/svn.py
+++ b/meld/vc/svn.py
@@ -69,7 +69,7 @@ class Vc(_vc.CachedVc):
     def resolved_command(self):
         return [self.CMD,"resolved"]
 
-    def get_repo_file_path(self, path, commit=None):
+    def get_path_for_repo_file(self, path, commit=None):
         if commit is not None:
             raise NotImplementedError()
 
diff --git a/meld/vc/svn_17.py b/meld/vc/svn_17.py
index 2cbac8f..8133c10 100644
--- a/meld/vc/svn_17.py
+++ b/meld/vc/svn_17.py
@@ -37,7 +37,7 @@ class Vc(svn.Vc):
     def _repo_version_support(self, version):
         return version >= 12
 
-    def get_repo_file_path(self, path, commit=None):
+    def get_path_for_repo_file(self, path, commit=None):
         if commit is None:
             commit = "BASE"
         else:
diff --git a/meld/vcview.py b/meld/vcview.py
index 62b15c5..a221ff8 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -455,7 +455,8 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
     def run_diff(self, path_list):
         try:
             for path in path_list:
-                comp_path = self.vc.get_repo_file_path(path)
+                comp_path = self.vc.get_path_for_repo_file(path)
+                os.chmod(comp_path, 0o444)
                 _temp_files.append(comp_path)
                 self.emit("create-diff", [comp_path, path])
         except NotImplementedError:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]