changeset 5349:ad8783fe20f7

darcs2hg: Now detects and recovers from simple darcs conflicts.
author Terry Smith <terry@t11e.com>
date Tue, 11 Sep 2007 13:13:54 -0400
parents b62a59fa9d26
children bd706eb8bc25
files contrib/darcs2hg.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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: