equal
deleted
inserted
replaced
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) |