[meld/VersionControlRework: 109/123] vcview: Use standard relative path calculations



commit d58ba75dc6683769b1ac2c6d36c40cfdcaede9db
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Apr 18 08:37:58 2015 +1000

    vcview: Use standard relative path calculations

 meld/vcview.py |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)
---
diff --git a/meld/vcview.py b/meld/vcview.py
index 2ecbfb6..3a4b0b7 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -573,13 +573,7 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
                 return '"%s"' % s if len(s.split()) > 1 else s
             return " ".join(quote(tok) for tok in command)
 
-        def relpath(pbase, p):
-            kill = 0
-            if len(pbase) and p.startswith(pbase):
-                kill = len(pbase) + 1
-            return p[kill:] or "."
-
-        files = [relpath(working_dir, f) for f in files]
+        files = [os.path.relpath(f, working_dir) for f in files]
         r = None
         msg = shelljoin(command + files) + " (in %s)\n" % working_dir
         self.consolestream.command(msg)


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