[meld] Fix Windows-style paths when passing refs to Git (close bgo#615661)



commit c42dc94539ffcf67b3d40bf5faf69ea988fa0d53
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Mar 31 14:20:35 2013 +1000

    Fix Windows-style paths when passing refs to Git (close bgo#615661)
    
    Git expects Unix-style paths, even on Windows. This commit fixes this
    case for the new VC infrastructure; the old infrastructure still
    breaks, but fixing it is more involved and not worth the time.

 meld/vc/git.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/meld/vc/git.py b/meld/vc/git.py
index 98e9bfb..5b296c1 100644
--- a/meld/vc/git.py
+++ b/meld/vc/git.py
@@ -97,6 +97,8 @@ class Vc(_vc.CachedVc):
             return path, False
 
         path = path[len(self.root) + 1:]
+        if os.name == "nt":
+            path = path.replace("\\", "/")
 
         args = ["git", "show", ":%s:%s" % (self.conflict_map[conflict], path)]
         process = subprocess.Popen(args,
@@ -122,6 +124,8 @@ class Vc(_vc.CachedVc):
         if not path.startswith(self.root + os.path.sep):
             raise _vc.InvalidVCPath(self, path, "Path not in repository")
         path = path[len(self.root) + 1:]
+        if os.name == "nt":
+            path = path.replace("\\", "/")
 
         obj = commit + ":" + path
         process = subprocess.Popen([self.CMD, "cat-file", "blob", obj],


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