# HG changeset patch # User Nils Decker # Date 2006-07-10 04:41:00 # Node ID 5ec2dded1bdab0ab2751b9aadc99f2a5bfef2ad1 # Parent 1f4703115e28b884467bff24451c95fd96cf63b4 darcs2hg.py: use darcs patch hash as patch identifier The use of the patch name is dangerous when duplicate names exist. In case of a duplicate name the second patch and all its dependancies are merged into a single mercurial patch. The patch identifier (hash) is always unique. diff --git a/contrib/darcs2hg.py b/contrib/darcs2hg.py --- a/contrib/darcs2hg.py +++ b/contrib/darcs2hg.py @@ -74,7 +74,8 @@ def darcs_changes(darcsRepo): else: comm = comm[0].childNodes[0].data author = patch_node.getAttribute("author") date = patch_node.getAttribute("date") - yield author, date, name, comm + hash = patch_node.getAttribute("hash") + yield hash, author, date, name, comm def darcs_pull(hg_repo, darcs_repo, change): cmd("darcs pull '%s' --all --patches='%s'" % (darcs_repo, change), hg_repo) @@ -120,9 +121,9 @@ if __name__ == "__main__": cmd("hg init '%s'" % (hg_repo)) cmd("darcs initialize", hg_repo) # Get the changes from the Darcs repository - for author, date, summary, description in darcs_changes(darcs_repo): + for hash, author, date, summary, description in darcs_changes(darcs_repo): text = summary + "\n" + description - darcs_pull(hg_repo, darcs_repo, summary) + darcs_pull(hg_repo, darcs_repo, hash) epoch = int(mktime(strptime(date, '%Y%m%d%H%M%S'))) hg_commit(hg_repo, text, author, epoch)