# HG changeset patch # User Alexis S. L. Carvalho # Date 1164058365 7200 # Node ID 05c8704a3743a45f6f5b305a971cc0fdae6ee6f3 # Parent 4c158de5f245f7ae6cfa4573927021022a60595a handle git patches that rename a file to more than one destination diff -r 4c158de5f245 -r 05c8704a3743 mercurial/patch.py --- a/mercurial/patch.py Mon Nov 20 19:32:43 2006 -0200 +++ b/mercurial/patch.py Mon Nov 20 19:32:45 2006 -0200 @@ -341,7 +341,7 @@ if not patches: return copies = [] - removes = [] + removes = {} cfiles = patches.keys() cwd = repo.getcwd() if cwd: @@ -350,16 +350,18 @@ ctype, gp = patches[f] if ctype == 'RENAME': copies.append((gp.oldpath, gp.path, gp.copymod)) - removes.append(gp.oldpath) + removes[gp.oldpath] = 1 elif ctype == 'COPY': copies.append((gp.oldpath, gp.path, gp.copymod)) elif ctype == 'DELETE': - removes.append(gp.path) + removes[gp.path] = 1 for src, dst, after in copies: if not after: copyfile(src, dst, repo.root) repo.copy(src, dst, wlock=wlock) + removes = removes.keys() if removes: + removes.sort() repo.remove(removes, True, wlock=wlock) for f in patches: ctype, gp = patches[f] diff -r 4c158de5f245 -r 05c8704a3743 tests/test-git-import --- a/tests/test-git-import Mon Nov 20 19:32:43 2006 -0200 +++ b/tests/test-git-import Mon Nov 20 19:32:45 2006 -0200 @@ -127,3 +127,19 @@ hg locate copy2 hg cat rename2 + +echo % one file renamed multiple times +hg import -mmultirenames - <