hgext/convert/cvs.py
changeset 5308 9400d677efc7
parent 5182 7e05bdeee7de
parent 5306 7256cc396bbf
child 5381 6874368120dc
--- a/hgext/convert/cvs.py	Tue Sep 11 23:38:29 2007 +0200
+++ b/hgext/convert/cvs.py	Fri Sep 14 23:10:41 2007 +0200
@@ -40,9 +40,10 @@
                 try:
                     # date
                     util.parsedate(self.rev, ['%Y/%m/%d %H:%M:%S'])
-                    cmd = "%s -d '1970/01/01 00:00:01' -d '%s'" % (cmd, self.rev)
+                    cmd = '%s -d "1970/01/01 00:00:01" -d "%s"' % (cmd, self.rev)
                 except util.Abort:
                     raise util.Abort('revision %s is not a patchset number or date' % self.rev)
+        cmd += " 2>&1"
 
         d = os.getcwd()
         try:
@@ -166,7 +167,8 @@
             if root.startswith(":ext:"):
                 root = root[5:]
             m = re.match(r'(?:([^@:/]+)@)?([^:/]+):?(.*)', root)
-            if not m:
+            # Do not take Windows path "c:\foo\bar" for a connection strings
+            if os.path.isdir(root) or not m:
                 conntype = "local"
             else:
                 conntype = "rsh"
@@ -180,7 +182,10 @@
                 else:
                     cmd = [rsh, host] + cmd
 
-            self.writep, self.readp = os.popen2(cmd)
+            # popen2 does not support argument lists under Windows
+            cmd = [util.shellquote(arg) for arg in cmd]
+            cmd = util.quotecommand(' '.join(cmd))
+            self.writep, self.readp = os.popen2(cmd, 'b')
 
         self.realroot = root
 
@@ -206,7 +211,7 @@
             raise IOError
 
         args = ("-N -P -kk -r %s --" % rev).split()
-        args.append(os.path.join(self.cvsrepo, name))
+        args.append(self.cvsrepo + '/' + name)
         for x in args:
             self.writep.write("Argument %s\n" % x)
         self.writep.write("Directory .\n%s\nco\n" % self.realroot)