view rewrite-log @ 408:3695fbd2c33b

[PATCH] Merging files that are deleted in both branches -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [PATCH] Merging files that are deleted in both branches From: Michael A Fetterman <Michael.Fetterman@cl.cam.ac.uk> OK, attached is an improved version of this patch... When I went back through it, I discovered that the prior version was wrong when doing real merges (as opposed to jumping between revisions that have a simple linear relationship). So that's been addressed here, too. > Here's an hg changeset patch that deals with simultaneous deletion of a file > in both the working directory and in a merged branch. > > Test case included in the patch. manifest hash: c8078733c252403314d8046efa6ecefc49c83050 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCuNF8ywK+sNU5EO8RArtdAJ9syw/JXRZzP1sxnEYXzZywkJLAPACeKpqL 5osA3AggrCbbSLTNcYVXJ8U= =T5Ik -----END PGP SIGNATURE-----
author mpm@selenic.com
date Tue, 21 Jun 2005 18:48:28 -0800
parents 5f471a75d607
children
line wrap: on
line source

#!/usr/bin/env python
import sys, os
from mercurial import hg

f = sys.argv[1]

r1 = hg.revlog(open, f + ".i", f + ".d")
r2 = hg.revlog(open, f + ".i2", f + ".d2")

tr = hg.transaction(open, "journal")

for i in xrange(r1.count()):
    n = r1.node(i)
    p1, p2 = r1.parents(n)
    l = r1.linkrev(n)
    t = r1.revision(n)
    n2 = r2.addrevision(t, tr, l, p1, p2)
tr.close()

os.rename(f + ".i", f + ".i.old")
os.rename(f + ".d", f + ".d.old")
os.rename(f + ".i2", f + ".i")
os.rename(f + ".d2", f + ".d")