Re: meld shows modified files with cvsnt, but won't compare



On Sun, Mar 8, 2009 at 6:57 PM, Vincent Legoll <vincent legoll gmail com> wrote:
> Could you try the attached patch and tell me how it behaves ?
> It tries to execute "cvs -v" and the "cvsnt -v" and then use the
> first one that can be executed.

And now with the patch...

-- 
Vincent Legoll
Index: vc/cvs.py
===================================================================
--- vc/cvs.py	(revision 1233)
+++ vc/cvs.py	(working copy)
@@ -26,11 +26,11 @@
 import re
 import time
 import misc
+import subprocess
 import _vc
 
-
 class Vc(_vc.Vc):
-    CMD = "cvs"
+    CMDS = ["cvs", "cvsnt"]
     NAME = "CVS"
     VC_DIR = "CVS"
     PATCH_INDEX_RE = "^Index:(.*)$"
@@ -38,8 +38,22 @@
     def __init__(self, location):
         if not os.path.isdir(os.path.join(location, self.VC_DIR)):
             raise ValueError
+        self._set_cmd()
         self.root = location
 
+    def _set_cmd(self):
+        devnull = open(os.devnull, 'w')
+        for cmd in self.CMDS:
+            try:
+                subprocess.Popen([cmd, '-v'], stdout = devnull,
+                                 stderr = devnull).communicate()
+                self.CMD = cmd
+                break
+            except OSError:
+                pass
+        print "Cannot execute any of the following commands: " + " ".join(self.CMDS)
+        raise ValueError
+
     def commit_command(self, message):
         return [self.CMD,"commit","-m",message]
     def diff_command(self):


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