darcs2hg: Now detects and recovers from simple darcs conflicts.
authorTerry Smith <terry@t11e.com>
Tue, 11 Sep 2007 13:13:54 -0400
changeset 5349 ad8783fe20f7
parent 5348 b62a59fa9d26
child 5350 bd706eb8bc25
darcs2hg: Now detects and recovers from simple darcs conflicts.
contrib/darcs2hg.py
--- a/contrib/darcs2hg.py	Tue Sep 11 12:42:52 2007 -0400
+++ b/contrib/darcs2hg.py	Tue Sep 11 13:13:54 2007 -0400
@@ -15,6 +15,7 @@
 import tempfile
 import xml.dom.minidom as xml_dom
 from time import strptime, mktime
+import re
 
 DARCS_REPO = None
 HG_REPO    = None
@@ -93,6 +94,10 @@
 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)
+	if re.search('^We have conflicts in the following files:$', res, re.MULTILINE):
+		print "Trying to revert files to work around conflict..."
+		rev_res = cmd ("darcs revert --all", hg_repo)
+		print rev_res
 	print res
 	new_tip = darcs_tip(darcs_repo)
 	if not new_tip != old_tip + 1: