Show More
@@ -4,12 +4,11 b'' | |||
|
4 | 4 | # ----------------------------------------------------------------------------- |
|
5 | 5 | # Project : Basic Darcs to Mercurial conversion script |
|
6 | 6 | # ----------------------------------------------------------------------------- |
|
7 |
# Author |
|
|
7 | # Authors : Sebastien Pierre <sebastien@xprima.com> | |
|
8 | # TK Soh <teekaysoh@gmail.com> | |
|
9 | # ----------------------------------------------------------------------------- | |
|
8 | 10 | # Creation : 24-May-2006 |
|
9 |
# Last mod : |
|
|
10 | # History : | |
|
11 | # 26-May-2006 - Updated | |
|
12 | # 24-May-2006 - First implementation | |
|
11 | # Last mod : 01-Jun-2006 | |
|
13 | 12 | # ----------------------------------------------------------------------------- |
|
14 | 13 | |
|
15 | 14 | import os, sys |
@@ -35,7 +34,7 b' USAGE = """\\' | |||
|
35 | 34 | # |
|
36 | 35 | # ------------------------------------------------------------------------------ |
|
37 | 36 | |
|
38 | def cmd(text, path=None): | |
|
37 | def cmd(text, path=None, silent=False): | |
|
39 | 38 | """Executes a command, in the given directory (if any), and returns the |
|
40 | 39 | command result as a string.""" |
|
41 | 40 | cwd = None |
@@ -43,7 +42,7 b' def cmd(text, path=None):' | |||
|
43 | 42 | path = os.path.abspath(path) |
|
44 | 43 | cwd = os.getcwd() |
|
45 | 44 | os.chdir(path) |
|
46 | print text | |
|
45 | if not silent: print "> ", text | |
|
47 | 46 | res = os.popen(text).read() |
|
48 | 47 | if path: |
|
49 | 48 | os.chdir(cwd) |
@@ -53,6 +52,12 b' def writefile(path, data):' | |||
|
53 | 52 | """Writes the given data into the given file.""" |
|
54 | 53 | f = file(path, "w") ; f.write(data) ; f.close() |
|
55 | 54 | |
|
55 | def error( *args ): | |
|
56 | sys.stderr.write("ERROR:") | |
|
57 | for a in args: sys.stderr.write(str(a)) | |
|
58 | sys.stderr.write("\n") | |
|
59 | sys.exit(-1) | |
|
60 | ||
|
56 | 61 | # ------------------------------------------------------------------------------ |
|
57 | 62 | # |
|
58 | 63 | # Darcs interface |
@@ -64,7 +69,6 b' def darcs_changes(darcsRepo):' | |||
|
64 | 69 | chronological list of changes as (change name, change summary).""" |
|
65 | 70 | changes = cmd("darcs changes --reverse --xml-output", darcsRepo) |
|
66 | 71 | doc = xml_dom.parseString(changes) |
|
67 | res = [] | |
|
68 | 72 | for patch_node in doc.childNodes[0].childNodes: |
|
69 | 73 | name = filter(lambda n:n.nodeName == "name", patch_node.childNodes) |
|
70 | 74 | comm = filter(lambda n:n.nodeName == "comment", patch_node.childNodes) |
@@ -111,7 +115,7 b' if __name__ == "__main__":' | |||
|
111 | 115 | sys.exit(-1) |
|
112 | 116 | # Initializes the target repo |
|
113 | 117 | if not os.path.isdir(darcs_repo + "/_darcs"): |
|
114 | print "No darcs directory found at: " + darc_repo | |
|
118 | print "No darcs directory found at: " + darcs_repo | |
|
115 | 119 | sys.exit(-1) |
|
116 | 120 | if not os.path.isdir(hg_repo): |
|
117 | 121 | os.mkdir(hg_repo) |
@@ -128,4 +132,3 b' if __name__ == "__main__":' | |||
|
128 | 132 | hg_commit(hg_repo, text, author, epoch) |
|
129 | 133 | |
|
130 | 134 | # EOF |
|
131 |
General Comments 0
You need to be logged in to leave comments.
Login now