Mercurial > hg > mercurial-crew-with-dirclash
comparison contrib/darcs2hg.py @ 5340: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 |
comparison
equal
deleted
inserted
replaced
5339:b62a59fa9d26 | 5340:ad8783fe20f7 |
---|---|
13 | 13 |
14 import os, sys | 14 import os, sys |
15 import tempfile | 15 import tempfile |
16 import xml.dom.minidom as xml_dom | 16 import xml.dom.minidom as xml_dom |
17 from time import strptime, mktime | 17 from time import strptime, mktime |
18 import re | |
18 | 19 |
19 DARCS_REPO = None | 20 DARCS_REPO = None |
20 HG_REPO = None | 21 HG_REPO = None |
21 | 22 |
22 USAGE = """\ | 23 USAGE = """\ |
91 return len(changes) | 92 return len(changes) |
92 | 93 |
93 def darcs_pull(hg_repo, darcs_repo, chash): | 94 def darcs_pull(hg_repo, darcs_repo, chash): |
94 old_tip = darcs_tip(darcs_repo) | 95 old_tip = darcs_tip(darcs_repo) |
95 res = cmd("darcs pull \"%s\" --all --match=\"hash %s\"" % (darcs_repo, chash), hg_repo) | 96 res = cmd("darcs pull \"%s\" --all --match=\"hash %s\"" % (darcs_repo, chash), hg_repo) |
97 if re.search('^We have conflicts in the following files:$', res, re.MULTILINE): | |
98 print "Trying to revert files to work around conflict..." | |
99 rev_res = cmd ("darcs revert --all", hg_repo) | |
100 print rev_res | |
96 print res | 101 print res |
97 new_tip = darcs_tip(darcs_repo) | 102 new_tip = darcs_tip(darcs_repo) |
98 if not new_tip != old_tip + 1: | 103 if not new_tip != old_tip + 1: |
99 error("Darcs pull did not work as expected: " + res) | 104 error("Darcs pull did not work as expected: " + res) |
100 | 105 |