Mercurial > public > mercurial-scm > hg
comparison contrib/darcs2hg.py @ 3673:eb0b4a2d70a9
white space and line break cleanups
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 17 Nov 2006 08:06:54 +0100 |
parents | d13e4ffaa79d |
children | b62a59fa9d26 |
comparison
equal
deleted
inserted
replaced
3672:e8730b5b8a32 | 3673:eb0b4a2d70a9 |
---|---|
72 """Gets the changes list from the given darcs repository. This returns the | 72 """Gets the changes list from the given darcs repository. This returns the |
73 chronological list of changes as (change name, change summary).""" | 73 chronological list of changes as (change name, change summary).""" |
74 changes = cmd("darcs changes --reverse --xml-output", darcsRepo) | 74 changes = cmd("darcs changes --reverse --xml-output", darcsRepo) |
75 doc = xml_dom.parseString(changes) | 75 doc = xml_dom.parseString(changes) |
76 for patch_node in doc.childNodes[0].childNodes: | 76 for patch_node in doc.childNodes[0].childNodes: |
77 name = filter(lambda n:n.nodeName == "name", patch_node.childNodes) | 77 name = filter(lambda n: n.nodeName == "name", patch_node.childNodes) |
78 comm = filter(lambda n:n.nodeName == "comment", patch_node.childNodes) | 78 comm = filter(lambda n: n.nodeName == "comment", patch_node.childNodes) |
79 if not name:continue | 79 if not name:continue |
80 else: name = name[0].childNodes[0].data | 80 else: name = name[0].childNodes[0].data |
81 if not comm: comm = "" | 81 if not comm: comm = "" |
82 else: comm = comm[0].childNodes[0].data | 82 else: comm = comm[0].childNodes[0].data |
83 author = patch_node.getAttribute("author") | 83 author = patch_node.getAttribute("author") |
85 chash = os.path.splitext(patch_node.getAttribute("hash"))[0] | 85 chash = os.path.splitext(patch_node.getAttribute("hash"))[0] |
86 yield author, date, name, chash, comm | 86 yield author, date, name, chash, comm |
87 | 87 |
88 def darcs_tip(darcs_repo): | 88 def darcs_tip(darcs_repo): |
89 changes = cmd("darcs changes",darcs_repo,silent=True) | 89 changes = cmd("darcs changes",darcs_repo,silent=True) |
90 changes = filter(lambda l:l.strip().startswith("* "), changes.split("\n")) | 90 changes = filter(lambda l: l.strip().startswith("* "), changes.split("\n")) |
91 return len(changes) | 91 return len(changes) |
92 | 92 |
93 def darcs_pull(hg_repo, darcs_repo, chash): | 93 def darcs_pull(hg_repo, darcs_repo, chash): |
94 old_tip = darcs_tip(darcs_repo) | 94 old_tip = darcs_tip(darcs_repo) |
95 res = cmd("darcs pull \"%s\" --all --match=\"hash %s\"" % (darcs_repo, chash), hg_repo) | 95 res = cmd("darcs pull \"%s\" --all --match=\"hash %s\"" % (darcs_repo, chash), hg_repo) |