comparison mercurial/hg.py @ 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 0e0d0670b2bc
children 40cfa2d0c088
comparison
equal deleted inserted replaced
407:0e0d0670b2bc 408:3695fbd2c33b
1009 ma = self.manifest.read(man) 1009 ma = self.manifest.read(man)
1010 mfa = self.manifest.readflags(m2n) 1010 mfa = self.manifest.readflags(m2n)
1011 1011
1012 (c, a, d, u) = self.diffdir(self.root) 1012 (c, a, d, u) = self.diffdir(self.root)
1013 1013
1014 # is this a jump, or a merge? i.e. is there a linear path
1015 # from p1 to p2?
1016 linear_path = (pa == p1 or pa == p2)
1017
1014 # resolve the manifest to determine which files 1018 # resolve the manifest to determine which files
1015 # we care about merging 1019 # we care about merging
1016 self.ui.note("resolving manifests\n") 1020 self.ui.note("resolving manifests\n")
1017 self.ui.debug(" ancestor %s local %s remote %s\n" % 1021 self.ui.debug(" ancestor %s local %s remote %s\n" %
1018 (short(man), short(m1n), short(m2n))) 1022 (short(man), short(m1n), short(m2n)))
1028 for f in a + c + u: 1032 for f in a + c + u:
1029 mw[f] = "" 1033 mw[f] = ""
1030 mfw[f] = is_exec(self.wjoin(f)) 1034 mfw[f] = is_exec(self.wjoin(f))
1031 for f in d: 1035 for f in d:
1032 if f in mw: del mw[f] 1036 if f in mw: del mw[f]
1037
1038 # If we're jumping between revisions (as opposed to merging),
1039 # and if neither the working directory nor the target rev has
1040 # the file, then we need to remove it from the dirstate, to
1041 # prevent the dirstate from listing the file when it is no
1042 # longer in the manifest.
1043 if linear_path and f not in m2:
1044 self.dirstate.forget((f,))
1033 1045
1034 for f, n in mw.iteritems(): 1046 for f, n in mw.iteritems():
1035 if f in m2: 1047 if f in m2:
1036 s = 0 1048 s = 0
1037 1049
1115 if force: 1127 if force:
1116 for f in merge: 1128 for f in merge:
1117 get[f] = merge[f][1] 1129 get[f] = merge[f][1]
1118 merge = {} 1130 merge = {}
1119 1131
1120 if pa == p1 or pa == p2: 1132 if linear_path:
1121 # we don't need to do any magic, just jump to the new rev 1133 # we don't need to do any magic, just jump to the new rev
1122 mode = 'n' 1134 mode = 'n'
1123 p1, p2 = p2, nullid 1135 p1, p2 = p2, nullid
1124 else: 1136 else:
1125 if not allow: 1137 if not allow: