[meld/VersionControlRework: 108/123] vc: Make the working directory always be whatever we're given



commit f4b11cb7d6e027bb6ef31db9d4e236711517260a
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Apr 18 08:31:35 2015 +1000

    vc: Make the working directory always be whatever we're given
    
    This should be a no-op in all cases, and is the only sane thing
    to do anyway.

 meld/vc/_vc.py       |    3 ---
 meld/vc/bzr.py       |    3 ---
 meld/vc/git.py       |    6 ------
 meld/vc/mercurial.py |    6 ------
 meld/vcview.py       |   12 ++++++------
 5 files changed, 6 insertions(+), 24 deletions(-)
---
diff --git a/meld/vc/_vc.py b/meld/vc/_vc.py
index aa91f60..24476e3 100644
--- a/meld/vc/_vc.py
+++ b/meld/vc/_vc.py
@@ -202,9 +202,6 @@ class Vc(object):
         """
         raise NotImplementedError()
 
-    def get_working_directory(self, workdir):
-        return workdir
-
     def refresh_vc_state(self, path=None):
         """Update cached version control state
 
diff --git a/meld/vc/bzr.py b/meld/vc/bzr.py
index ef71432..da35894 100644
--- a/meld/vc/bzr.py
+++ b/meld/vc/bzr.py
@@ -130,9 +130,6 @@ class Vc(_vc.Vc):
     def valid_repo(cls, path):
         return not _vc.call([cls.CMD, "root"], cwd=path)
 
-    def get_working_directory(self, workdir):
-        return self.root
-
     def get_files_to_commit(self, paths):
         files = []
         for p in paths:
diff --git a/meld/vc/git.py b/meld/vc/git.py
index b8e6856..ee059df 100644
--- a/meld/vc/git.py
+++ b/meld/vc/git.py
@@ -238,12 +238,6 @@ class Vc(_vc.Vc):
         # appears to be correct under the default git bash shell however.
         return not _vc.call([cls.CMD, "branch"], cwd=path)
 
-    def get_working_directory(self, workdir):
-        if workdir.startswith("/"):
-            return self.root
-        else:
-            return ''
-
     def _get_modified_files(self, path):
         # Update the index to avoid reading stale status information
         proc = self.run("update-index", "--refresh")
diff --git a/meld/vc/mercurial.py b/meld/vc/mercurial.py
index 137f449..6ba4e42 100644
--- a/meld/vc/mercurial.py
+++ b/meld/vc/mercurial.py
@@ -71,12 +71,6 @@ class Vc(_vc.Vc):
     def valid_repo(cls, path):
         return not _vc.call([cls.CMD, "root"], cwd=path)
 
-    def get_working_directory(self, workdir):
-        if workdir.startswith("/"):
-            return self.root
-        else:
-            return ''
-
     def get_path_for_repo_file(self, path, commit=None):
         if commit is not None:
             raise NotImplementedError()
diff --git a/meld/vcview.py b/meld/vcview.py
index 51f5990..2ecbfb6 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -578,13 +578,13 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
             if len(pbase) and p.startswith(pbase):
                 kill = len(pbase) + 1
             return p[kill:] or "."
-        workdir = self.vc.get_working_directory(working_dir)
-        files = [relpath(workdir, f) for f in files]
+
+        files = [relpath(working_dir, f) for f in files]
         r = None
-        msg = shelljoin(command + files) + " (in %s)\n" % workdir
+        msg = shelljoin(command + files) + " (in %s)\n" % working_dir
         self.consolestream.command(msg)
         readiter = misc.read_pipe_iter(command + files, self.consolestream,
-                                       workdir=workdir)
+                                       workdir=working_dir)
         try:
             while r is None:
                 r = next(readiter)
@@ -601,8 +601,8 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
             self.console_vbox.show()
 
         if refresh:
-            self.refresh_partial(workdir)
-        yield workdir, r
+            self.refresh_partial(working_dir)
+        yield working_dir, r
 
     def has_command(self, command):
         vc_command = self.command_map.get(command)


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