[meld] Adjust VC location semantics to require a location to be a folder



commit 730b7d99e1cd046f767bab5247dbe8d0054849d6
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Thu Oct 25 07:18:36 2012 +1000

    Adjust VC location semantics to require a location to be a folder
    
    The VC location field was only ever used to set cwd for various
    operations, to limit comparisons to subsections of a repository.
    While in theory we could use it to identify single-file comparisons,
    this was never done and isn't obviously useful.
    
    This commit changes the semantics such that the location field is
    now the folder for which the comparison was launched, regardless of
    whether it is a sub-folder or a single-file comparison.

 meld/vc/_vc.py |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/meld/vc/_vc.py b/meld/vc/_vc.py
index b9b8a0c..09f7e74 100644
--- a/meld/vc/_vc.py
+++ b/meld/vc/_vc.py
@@ -78,20 +78,20 @@ class Vc(object):
     VC_METADATA = None
 
     def __init__(self, location):
-        # Save the requested diff directory/file.  It may be a sub-directory
-        # of the repository we are diffing and can be useful in limiting meld's
-        # output to the requested location.  It can also be used to determine
-        # if the user is requesting a single-file diff or a diretcory diff.
+        # Save the requested comparison location. The location may be a
+        # sub-directory of the repository we are diffing and can be useful in
+        # limiting meld's output to the requested location.
+        #
+        # If the location requested is a file (e.g., a single-file command line
+        # comparison) then the location is set to the containing directory.
+        if not os.path.isdir(location):
+            location = os.path.dirname(location)
         self.location = location
 
-        if not os.path.isdir(location):
-            path = os.path.dirname(self.location)
-        else:
-            path = location
         if self.VC_ROOT_WALK:
-            self.root = self.find_repo_root(path)
+            self.root = self.find_repo_root(self.location)
         else:
-            self.root = self.check_repo_root(path)
+            self.root = self.check_repo_root(self.location)
 
     def commit_command(self, message):
         raise NotImplementedError()



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