diff contrib/darcs2hg.py @ 2749:d13e4ffaa79d

[darcs2hg] Windows compatibilty patct Originally submitted by Daiju Kito 1. single quote didn't work in several cases 2. os.unlink tries to delete tmpfile when it's called. It won't wait like unix.
author Sébastien Pierre <sebastien@xprima.com>
date Tue, 01 Aug 2006 09:51:36 -0400
parents 8210cf2ec19d
children eb0b4a2d70a9
line wrap: on
line diff
--- a/contrib/darcs2hg.py	Mon Jul 31 20:33:56 2006 -0700
+++ b/contrib/darcs2hg.py	Tue Aug 01 09:51:36 2006 -0400
@@ -92,7 +92,7 @@
 
 def darcs_pull(hg_repo, darcs_repo, chash):
 	old_tip = darcs_tip(darcs_repo)
-	res     = cmd("darcs pull '%s' --all --match='hash %s'" % (darcs_repo, chash), hg_repo)
+	res     = cmd("darcs pull \"%s\" --all --match=\"hash %s\"" % (darcs_repo, chash), hg_repo)
 	print res
 	new_tip = darcs_tip(darcs_repo)
 	if not new_tip != old_tip + 1:
@@ -110,7 +110,8 @@
 	old_tip = hg_tip(hg_repo)
 	cmd("hg add -X _darcs", hg_repo)
 	cmd("hg remove -X _darcs --after", hg_repo)
-	res = cmd("hg commit -l %s -u '%s' -d '%s 0'"  % (tmpfile, author, date), hg_repo)
+	res = cmd("hg commit -l %s -u \"%s\" -d \"%s 0\""  % (tmpfile, author, date), hg_repo)
+	os.close(fd)
 	os.unlink(tmpfile)
 	new_tip = hg_tip(hg_repo)
 	if not new_tip == old_tip + 1:
@@ -156,7 +157,7 @@
 		print "Given HG repository must not exist when no SKIP is specified."
 		sys.exit(-1)
 	if skip == None:
-		cmd("hg init '%s'" % (hg_repo))
+		cmd("hg init \"%s\"" % (hg_repo))
 		cmd("darcs initialize", hg_repo)
 	# Get the changes from the Darcs repository
 	change_number = 0