annotate contrib/darcs2hg.py @ 5736:6e79d5e0e541

bisect: keep history of all bad revisions - use a single state dict - find the minimum bad revision
author Matt Mackall <mpm@selenic.com>
date Thu, 27 Dec 2007 23:55:40 -0600
parents 6b6104430964
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
1 #!/usr/bin/env python
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
2 # Encoding: iso-8859-1
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
3 # vim: tw=80 ts=4 sw=4 noet
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
4 # -----------------------------------------------------------------------------
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
5 # Project : Basic Darcs to Mercurial conversion script
5359
6b6104430964 convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents: 5350
diff changeset
6 #
6b6104430964 convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents: 5350
diff changeset
7 # *** DEPRECATED. Use the convert extension instead. This script will
6b6104430964 convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents: 5350
diff changeset
8 # *** be removed soon.
6b6104430964 convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents: 5350
diff changeset
9 #
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
10 # -----------------------------------------------------------------------------
2586
bb63d29ce03d darcs2hg: improved logging
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
11 # Authors : Sebastien Pierre <sebastien@xprima.com>
bb63d29ce03d darcs2hg: improved logging
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
12 # TK Soh <teekaysoh@gmail.com>
bb63d29ce03d darcs2hg: improved logging
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
13 # -----------------------------------------------------------------------------
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
14 # Creation : 24-May-2006
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
15 # -----------------------------------------------------------------------------
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
16
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
17 import os, sys
2352
61909dfb316d various fixes to darcs conversion script
TK Soh <teekaysoh@yahoo.com>
parents: 2349
diff changeset
18 import tempfile
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
19 import xml.dom.minidom as xml_dom
2352
61909dfb316d various fixes to darcs conversion script
TK Soh <teekaysoh@yahoo.com>
parents: 2349
diff changeset
20 from time import strptime, mktime
5349
ad8783fe20f7 darcs2hg: Now detects and recovers from simple darcs conflicts.
Terry Smith <terry@t11e.com>
parents: 5348
diff changeset
21 import re
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
22
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
23 DARCS_REPO = None
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
24 HG_REPO = None
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
25
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
26 USAGE = """\
2587
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
27 %s DARCSREPO HGREPO [SKIP]
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
28
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
29 Converts the given Darcs repository to a new Mercurial repository. The given
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
30 HGREPO must not exist, as it will be created and filled up (this will avoid
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
31 overwriting valuable data.
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
32
2587
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
33 In case an error occurs within the process, you can resume the process by
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
34 giving the last successfuly applied change number.
2352
61909dfb316d various fixes to darcs conversion script
TK Soh <teekaysoh@yahoo.com>
parents: 2349
diff changeset
35 """ % (os.path.basename(sys.argv[0]))
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
36
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
37 # ------------------------------------------------------------------------------
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
38 #
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
39 # Utilities
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
40 #
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
41 # ------------------------------------------------------------------------------
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
42
2586
bb63d29ce03d darcs2hg: improved logging
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
43 def cmd(text, path=None, silent=False):
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
44 """Executes a command, in the given directory (if any), and returns the
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
45 command result as a string."""
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
46 cwd = None
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
47 if path:
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
48 path = os.path.abspath(path)
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
49 cwd = os.getcwd()
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
50 os.chdir(path)
2586
bb63d29ce03d darcs2hg: improved logging
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
51 if not silent: print "> ", text
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
52 res = os.popen(text).read()
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
53 if path:
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
54 os.chdir(cwd)
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
55 return res
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
56
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
57 def writefile(path, data):
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
58 """Writes the given data into the given file."""
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
59 f = file(path, "w") ; f.write(data) ; f.close()
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
60
2586
bb63d29ce03d darcs2hg: improved logging
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
61 def error( *args ):
2587
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
62 sys.stderr.write("ERROR: ")
2586
bb63d29ce03d darcs2hg: improved logging
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
63 for a in args: sys.stderr.write(str(a))
bb63d29ce03d darcs2hg: improved logging
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
64 sys.stderr.write("\n")
2587
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
65 sys.stderr.write("You can make manual fixes if necessary and then resume by"
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
66 " giving the last changeset number")
2586
bb63d29ce03d darcs2hg: improved logging
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
67 sys.exit(-1)
bb63d29ce03d darcs2hg: improved logging
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
68
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
69 # ------------------------------------------------------------------------------
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
70 #
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
71 # Darcs interface
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
72 #
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
73 # ------------------------------------------------------------------------------
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
74
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
75 def darcs_changes(darcsRepo):
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
76 """Gets the changes list from the given darcs repository. This returns the
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
77 chronological list of changes as (change name, change summary)."""
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
78 changes = cmd("darcs changes --reverse --xml-output", darcsRepo)
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
79 doc = xml_dom.parseString(changes)
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
80 for patch_node in doc.childNodes[0].childNodes:
3673
eb0b4a2d70a9 white space and line break cleanups
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2749
diff changeset
81 name = filter(lambda n: n.nodeName == "name", patch_node.childNodes)
eb0b4a2d70a9 white space and line break cleanups
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2749
diff changeset
82 comm = filter(lambda n: n.nodeName == "comment", patch_node.childNodes)
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
83 if not name:continue
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
84 else: name = name[0].childNodes[0].data
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
85 if not comm: comm = ""
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
86 else: comm = comm[0].childNodes[0].data
2352
61909dfb316d various fixes to darcs conversion script
TK Soh <teekaysoh@yahoo.com>
parents: 2349
diff changeset
87 author = patch_node.getAttribute("author")
2587
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
88 date = patch_node.getAttribute("date")
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
89 chash = os.path.splitext(patch_node.getAttribute("hash"))[0]
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
90 yield author, date, name, chash, comm
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
91
2587
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
92 def darcs_tip(darcs_repo):
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
93 changes = cmd("darcs changes",darcs_repo,silent=True)
3673
eb0b4a2d70a9 white space and line break cleanups
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2749
diff changeset
94 changes = filter(lambda l: l.strip().startswith("* "), changes.split("\n"))
2587
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
95 return len(changes)
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
96
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
97 def darcs_pull(hg_repo, darcs_repo, chash):
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
98 old_tip = darcs_tip(darcs_repo)
2749
d13e4ffaa79d [darcs2hg] Windows compatibilty patct
Sébastien Pierre <sebastien@xprima.com>
parents: 2588
diff changeset
99 res = cmd("darcs pull \"%s\" --all --match=\"hash %s\"" % (darcs_repo, chash), hg_repo)
5349
ad8783fe20f7 darcs2hg: Now detects and recovers from simple darcs conflicts.
Terry Smith <terry@t11e.com>
parents: 5348
diff changeset
100 if re.search('^We have conflicts in the following files:$', res, re.MULTILINE):
ad8783fe20f7 darcs2hg: Now detects and recovers from simple darcs conflicts.
Terry Smith <terry@t11e.com>
parents: 5348
diff changeset
101 print "Trying to revert files to work around conflict..."
ad8783fe20f7 darcs2hg: Now detects and recovers from simple darcs conflicts.
Terry Smith <terry@t11e.com>
parents: 5348
diff changeset
102 rev_res = cmd ("darcs revert --all", hg_repo)
ad8783fe20f7 darcs2hg: Now detects and recovers from simple darcs conflicts.
Terry Smith <terry@t11e.com>
parents: 5348
diff changeset
103 print rev_res
2587
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
104 print res
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
105 new_tip = darcs_tip(darcs_repo)
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
106 if not new_tip != old_tip + 1:
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
107 error("Darcs pull did not work as expected: " + res)
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
108
5348
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
109 def darcs_changes_summary(darcs_repo, chash):
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
110 """Gets the changes from the darcs summary. This returns the chronological
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
111 list of changes as (change_type, args). Eg. ('add_file', 'foo.txt') or
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
112 ('move', ['foo.txt','bar.txt'])."""
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
113 change = cmd("darcs changes --summary --xml-output --match=\"hash %s\"" % (chash), darcs_repo)
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
114 doc = xml_dom.parseString(change)
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
115 for patch_node in doc.childNodes[0].childNodes:
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
116 summary_nodes = filter(lambda n: n.nodeName == "summary" and n.nodeType == n.ELEMENT_NODE, patch_node.childNodes)
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
117 for summary_node in summary_nodes:
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
118 change_nodes = filter(lambda n: n.nodeType == n.ELEMENT_NODE, summary_node.childNodes)
5350
bd706eb8bc25 darcs2hg: Added support for darcs tags.
Terry Smith <terry@t11e.com>
parents: 5349
diff changeset
119 if len(change_nodes) == 0:
bd706eb8bc25 darcs2hg: Added support for darcs tags.
Terry Smith <terry@t11e.com>
parents: 5349
diff changeset
120 name = filter(lambda n: n.nodeName == "name", patch_node.childNodes)
bd706eb8bc25 darcs2hg: Added support for darcs tags.
Terry Smith <terry@t11e.com>
parents: 5349
diff changeset
121 if not name:
bd706eb8bc25 darcs2hg: Added support for darcs tags.
Terry Smith <terry@t11e.com>
parents: 5349
diff changeset
122 error("Darcs patch has an empty summary node and no name: " + patch_node.toxml())
bd706eb8bc25 darcs2hg: Added support for darcs tags.
Terry Smith <terry@t11e.com>
parents: 5349
diff changeset
123 name = name[0].childNodes[0].data.strip()
bd706eb8bc25 darcs2hg: Added support for darcs tags.
Terry Smith <terry@t11e.com>
parents: 5349
diff changeset
124 (tag, sub_count) = re.subn('^TAG ', '', name, 1)
bd706eb8bc25 darcs2hg: Added support for darcs tags.
Terry Smith <terry@t11e.com>
parents: 5349
diff changeset
125 if sub_count != 1:
bd706eb8bc25 darcs2hg: Added support for darcs tags.
Terry Smith <terry@t11e.com>
parents: 5349
diff changeset
126 error("Darcs patch has an empty summary node but doesn't look like a tag: " + patch_node.toxml());
5348
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
127 for change_node in change_nodes:
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
128 change = change_node.nodeName
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
129 if change == 'modify_file':
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
130 yield change, change_node.childNodes[0].data.strip()
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
131 elif change == 'add_file':
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
132 yield change, change_node.childNodes[0].data.strip()
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
133 elif change == 'remove_file':
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
134 yield change, change_node.childNodes[0].data.strip()
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
135 elif change == 'add_directory':
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
136 yield change, change_node.childNodes[0].data.strip()
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
137 elif change == 'remove_directory':
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
138 yield change, change_node.childNodes[0].data.strip()
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
139 elif change == 'move':
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
140 yield change, (change_node.getAttribute('from'), change_node.getAttribute('to'))
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
141 else:
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
142 error('Problem parsing summary xml: Unexpected element: ' + change_node.toxml())
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
143
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
144 # ------------------------------------------------------------------------------
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
145 #
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
146 # Mercurial interface
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
147 #
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
148 # ------------------------------------------------------------------------------
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
149
2352
61909dfb316d various fixes to darcs conversion script
TK Soh <teekaysoh@yahoo.com>
parents: 2349
diff changeset
150 def hg_commit( hg_repo, text, author, date ):
61909dfb316d various fixes to darcs conversion script
TK Soh <teekaysoh@yahoo.com>
parents: 2349
diff changeset
151 fd, tmpfile = tempfile.mkstemp(prefix="darcs2hg_")
61909dfb316d various fixes to darcs conversion script
TK Soh <teekaysoh@yahoo.com>
parents: 2349
diff changeset
152 writefile(tmpfile, text)
2587
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
153 old_tip = hg_tip(hg_repo)
2352
61909dfb316d various fixes to darcs conversion script
TK Soh <teekaysoh@yahoo.com>
parents: 2349
diff changeset
154 cmd("hg add -X _darcs", hg_repo)
61909dfb316d various fixes to darcs conversion script
TK Soh <teekaysoh@yahoo.com>
parents: 2349
diff changeset
155 cmd("hg remove -X _darcs --after", hg_repo)
2749
d13e4ffaa79d [darcs2hg] Windows compatibilty patct
Sébastien Pierre <sebastien@xprima.com>
parents: 2588
diff changeset
156 res = cmd("hg commit -l %s -u \"%s\" -d \"%s 0\"" % (tmpfile, author, date), hg_repo)
d13e4ffaa79d [darcs2hg] Windows compatibilty patct
Sébastien Pierre <sebastien@xprima.com>
parents: 2588
diff changeset
157 os.close(fd)
2352
61909dfb316d various fixes to darcs conversion script
TK Soh <teekaysoh@yahoo.com>
parents: 2349
diff changeset
158 os.unlink(tmpfile)
2587
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
159 new_tip = hg_tip(hg_repo)
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
160 if not new_tip == old_tip + 1:
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
161 # Sometimes we may have empty commits, we simply skip them
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
162 if res.strip().lower().find("nothing changed") != -1:
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
163 pass
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
164 else:
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
165 error("Mercurial commit did not work as expected: " + res)
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
166
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
167 def hg_tip( hg_repo ):
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
168 """Returns the latest local revision number in the given repository."""
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
169 tip = cmd("hg tip", hg_repo, silent=True)
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
170 tip = tip.split("\n")[0].split(":")[1].strip()
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
171 return int(tip)
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
172
5348
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
173 def hg_rename( hg_repo, from_file, to_file ):
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
174 cmd("hg rename --after \"%s\" \"%s\"" % (from_file, to_file), hg_repo);
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
175
5350
bd706eb8bc25 darcs2hg: Added support for darcs tags.
Terry Smith <terry@t11e.com>
parents: 5349
diff changeset
176 def hg_tag ( hg_repo, text, author, date ):
bd706eb8bc25 darcs2hg: Added support for darcs tags.
Terry Smith <terry@t11e.com>
parents: 5349
diff changeset
177 old_tip = hg_tip(hg_repo)
bd706eb8bc25 darcs2hg: Added support for darcs tags.
Terry Smith <terry@t11e.com>
parents: 5349
diff changeset
178 res = cmd("hg tag -u \"%s\" -d \"%s 0\" \"%s\"" % (author, date, text), hg_repo)
bd706eb8bc25 darcs2hg: Added support for darcs tags.
Terry Smith <terry@t11e.com>
parents: 5349
diff changeset
179 new_tip = hg_tip(hg_repo)
bd706eb8bc25 darcs2hg: Added support for darcs tags.
Terry Smith <terry@t11e.com>
parents: 5349
diff changeset
180 if not new_tip == old_tip + 1:
bd706eb8bc25 darcs2hg: Added support for darcs tags.
Terry Smith <terry@t11e.com>
parents: 5349
diff changeset
181 error("Mercurial tag did not work as expected: " + res)
bd706eb8bc25 darcs2hg: Added support for darcs tags.
Terry Smith <terry@t11e.com>
parents: 5349
diff changeset
182
bd706eb8bc25 darcs2hg: Added support for darcs tags.
Terry Smith <terry@t11e.com>
parents: 5349
diff changeset
183 def hg_handle_change( hg_repo, author, date, change, arg ):
5348
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
184 """Processes a change event as output by darcs_changes_summary. These
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
185 consist of file move/rename/add/delete commands."""
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
186 if change == 'modify_file':
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
187 pass
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
188 elif change == 'add_file':
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
189 pass
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
190 elif change =='remove_file':
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
191 pass
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
192 elif change == 'add_directory':
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
193 pass
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
194 elif change == 'remove_directory':
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
195 pass
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
196 elif change == 'move':
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
197 hg_rename(hg_repo, arg[0], arg[1])
5350
bd706eb8bc25 darcs2hg: Added support for darcs tags.
Terry Smith <terry@t11e.com>
parents: 5349
diff changeset
198 elif change == 'tag':
bd706eb8bc25 darcs2hg: Added support for darcs tags.
Terry Smith <terry@t11e.com>
parents: 5349
diff changeset
199 hg_tag(hg_repo, arg, author, date)
5348
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
200 else:
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
201 error('Unknown change type ' + change + ': ' + arg)
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
202
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
203 # ------------------------------------------------------------------------------
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
204 #
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
205 # Main
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
206 #
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
207 # ------------------------------------------------------------------------------
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
208
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
209 if __name__ == "__main__":
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
210 args = sys.argv[1:]
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
211 # We parse the arguments
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
212 if len(args) == 2:
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
213 darcs_repo = os.path.abspath(args[0])
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
214 hg_repo = os.path.abspath(args[1])
2587
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
215 skip = None
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
216 elif len(args) == 3:
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
217 darcs_repo = os.path.abspath(args[0])
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
218 hg_repo = os.path.abspath(args[1])
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
219 skip = int(args[2])
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
220 else:
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
221 print USAGE
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
222 sys.exit(-1)
5359
6b6104430964 convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents: 5350
diff changeset
223 print 'This command is deprecated. Use the convert extension instead.'
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
224 # Initializes the target repo
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
225 if not os.path.isdir(darcs_repo + "/_darcs"):
2586
bb63d29ce03d darcs2hg: improved logging
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
226 print "No darcs directory found at: " + darcs_repo
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
227 sys.exit(-1)
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
228 if not os.path.isdir(hg_repo):
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
229 os.mkdir(hg_repo)
2587
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
230 elif skip == None:
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
231 print "Given HG repository must not exist when no SKIP is specified."
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
232 sys.exit(-1)
2587
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
233 if skip == None:
2749
d13e4ffaa79d [darcs2hg] Windows compatibilty patct
Sébastien Pierre <sebastien@xprima.com>
parents: 2588
diff changeset
234 cmd("hg init \"%s\"" % (hg_repo))
2587
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
235 cmd("darcs initialize", hg_repo)
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
236 # Get the changes from the Darcs repository
2587
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
237 change_number = 0
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
238 for author, date, summary, chash, description in darcs_changes(darcs_repo):
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
239 print "== changeset", change_number,
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
240 if skip != None and change_number <= skip:
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
241 print "(skipping)"
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
242 else:
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
243 text = summary + "\n" + description
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
244 # The commit hash has a date like 20021020201112
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
245 # --------------------------------YYYYMMDDHHMMSS
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
246 date = chash.split("-")[0]
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
247 epoch = int(mktime(strptime(date, '%Y%m%d%H%M%S')))
5348
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
248 darcs_pull(hg_repo, darcs_repo, chash)
b62a59fa9d26 darcs2hg: Now understands files that were explicitly renamed in darcs.
Terry Smith <terry@t11e.com>
parents: 3673
diff changeset
249 for change, arg in darcs_changes_summary(darcs_repo, chash):
5350
bd706eb8bc25 darcs2hg: Added support for darcs tags.
Terry Smith <terry@t11e.com>
parents: 5349
diff changeset
250 hg_handle_change(hg_repo, author, epoch, change, arg)
2587
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
251 hg_commit(hg_repo, text, author, epoch)
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
252 change_number += 1
fe3e87358b47 darcs2hg: pause and resume support, date extraction from commit hash, does not break on empty commits
Sébastien Pierre <sebastien@xprima.com>
parents: 2585
diff changeset
253 print "Darcs repository (_darcs) was not deleted. You can keep or remove it."
2349
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
254
88c881bda888 darcs2hg.py: import darcs project into mercurial
Sébastien Pierre <sebastien@xprima.com>
parents:
diff changeset
255 # EOF