[PATCH] 2/3 to contrib/darcs2hg.py

Terry Smith terry at shebiki.org
Thu Sep 13 14:41:07 CDT 2007


# HG changeset patch
# User Terry Smith <terry at t11e.com>
# Date 1189530834 14400
# Node ID ad8783fe20f73fb92c30cb7b36beb38dff3efcca
# Parent  b62a59fa9d26824ebc7b30645a02fc1e042d7f15
darcs2hg: Now detects and recovers from simple darcs conflicts.

diff -r b62a59fa9d26 -r ad8783fe20f7 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 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, chas
  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:



More information about the Mercurial-devel mailing list