Mercurial > public > mercurial-scm > hg
diff mercurial/patch.py @ 3702:70c3ee224c08
Don't generate git patches that rename a file to multiple destinations
With this patch, instead of generating N renames, we'll generate
1 rename and N-1 copies.
Ideally the rename should come after the copies instead of before
them, but that'd be harder to do.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Mon, 20 Nov 2006 19:32:46 -0200 |
parents | 05c8704a3743 |
children | ab5600428b08 |
line wrap: on
line diff
--- a/mercurial/patch.py Mon Nov 20 19:32:45 2006 -0200 +++ b/mercurial/patch.py Mon Nov 20 19:32:46 2006 -0200 @@ -547,6 +547,7 @@ all = modified + added + removed all.sort() + gone = {} for f in all: to = None tn = None @@ -574,7 +575,11 @@ a, arev = copied[f] omode = gitmode(mmap.execf(a)) addmodehdr(header, omode, mode) - op = a in removed and 'rename' or 'copy' + if a in removed and a not in gone: + op = 'rename' + gone[a] = 1 + else: + op = 'copy' header.append('%s from %s\n' % (op, a)) header.append('%s to %s\n' % (op, f)) to = getfile(a).read(arev)