[darcs2hg] Windows compatibilty patct
authorSébastien Pierre <sebastien@xprima.com>
Tue, 01 Aug 2006 09:51:36 -0400
changeset 2749 d13e4ffaa79d
parent 2748 752b9475a700
child 2750 8c814c1ab31e
[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.
contrib/darcs2hg.py
--- 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