comparison mercurial/merge.py @ 4884:931f901ab811

merge: fix unnecessary rename merges on linear update (issue631) If one side's revision is identical to the ancestor, we skip the rest of the copy detection logic.
author Matt Mackall <mpm@selenic.com>
date Sun, 15 Jul 2007 14:43:38 -0500
parents 9797124581c9
children 6fd953d5faea 60c54154ec4c
comparison
equal deleted inserted replaced
4883:72ac66e88c43 4884:931f901ab811
155 155
156 copy = {} 156 copy = {}
157 fullcopy = {} 157 fullcopy = {}
158 diverge = {} 158 diverge = {}
159 159
160 def checkcopies(c, man): 160 def checkcopies(c, man, aman):
161 '''check possible copies for filectx c''' 161 '''check possible copies for filectx c'''
162 for of in findold(c): 162 for of in findold(c):
163 fullcopy[c.path()] = of # remember for dir rename detection 163 fullcopy[c.path()] = of # remember for dir rename detection
164 if of not in man: # original file not in other manifest? 164 if of not in man: # original file not in other manifest?
165 if of in ma: 165 if of in ma:
166 diverge.setdefault(of, []).append(c.path()) 166 diverge.setdefault(of, []).append(c.path())
167 continue
168 # if the original file is unchanged on the other branch,
169 # no merge needed
170 if man[of] == aman.get(of):
167 continue 171 continue
168 c2 = ctx(of, man[of]) 172 c2 = ctx(of, man[of])
169 ca = c.ancestor(c2) 173 ca = c.ancestor(c2)
170 if not ca: # unrelated? 174 if not ca: # unrelated?
171 continue 175 continue
184 188
185 u1 = nonoverlap(m1, m2, ma) 189 u1 = nonoverlap(m1, m2, ma)
186 u2 = nonoverlap(m2, m1, ma) 190 u2 = nonoverlap(m2, m1, ma)
187 191
188 for f in u1: 192 for f in u1:
189 checkcopies(ctx(f, m1[f]), m2) 193 checkcopies(ctx(f, m1[f]), m2, ma)
190 194
191 for f in u2: 195 for f in u2:
192 checkcopies(ctx(f, m2[f]), m1) 196 checkcopies(ctx(f, m2[f]), m1, ma)
193 197
194 d2 = {} 198 d2 = {}
195 for of, fl in diverge.items(): 199 for of, fl in diverge.items():
196 for f in fl: 200 for f in fl:
197 fo = list(fl) 201 fo = list(fl)
198 fo.remove(f) 202 fo.remove(f)
199 d2[f] = (of, fo) 203 d2[f] = (of, fo)
200 #diverge = d2
201 204
202 if not fullcopy or not repo.ui.configbool("merge", "followdirs", True): 205 if not fullcopy or not repo.ui.configbool("merge", "followdirs", True):
203 return copy, diverge 206 return copy, diverge
204 207
205 # generate a directory move map 208 # generate a directory move map