##// END OF EJS Templates
copies: directly pass a changes object to the copy tracing code...
marmoute -
r46217:2693659c default
parent child Browse files
Show More
@@ -171,34 +171,15 b' def _committedforwardcopies(a, b, base, '
171 171
172 172
173 173 def _revinfo_getter(repo):
174 """return a function that return multiple data given a <rev>"i
174 """returns a function that returns the following data given a <rev>"
175 175
176 176 * p1: revision number of first parent
177 177 * p2: revision number of first parent
178 * p1copies: mapping of copies from p1
179 * p2copies: mapping of copies from p2
180 * removed: a list of removed files
181 * ismerged: a callback to know if file was merged in that revision
178 * changes: a ChangingFiles object
182 179 """
183 180 cl = repo.changelog
184 181 parents = cl.parentrevs
185 182
186 def get_ismerged(rev):
187 ctx = repo[rev]
188
189 def ismerged(path):
190 if path not in ctx.files():
191 return False
192 fctx = ctx[path]
193 parents = fctx._filelog.parents(fctx._filenode)
194 nb_parents = 0
195 for n in parents:
196 if n != node.nullid:
197 nb_parents += 1
198 return nb_parents >= 2
199
200 return ismerged
201
202 183 changelogrevision = cl.changelogrevision
203 184
204 185 # A small cache to avoid doing the work twice for merges
@@ -232,23 +213,10 b' def _revinfo_getter(repo):'
232 213 e = merge_caches.pop(rev, None)
233 214 if e is not None:
234 215 return e
235 c = changelogrevision(rev)
236 p1copies = c.p1copies
237 p2copies = c.p2copies
238 removed = c.filesremoved
216 value = (p1, p2, changelogrevision(rev).changes)
239 217 if p1 != node.nullrev and p2 != node.nullrev:
240 218 # XXX some case we over cache, IGNORE
241 value = merge_caches[rev] = (
242 p1,
243 p2,
244 p1copies,
245 p2copies,
246 removed,
247 get_ismerged(rev),
248 )
249
250 if value is None:
251 value = (p1, p2, p1copies, p2copies, removed, get_ismerged(rev))
219 merge_caches[rev] = value
252 220 return value
253 221
254 222 return revinfo
@@ -324,14 +292,14 b' def _combine_changeset_copies('
324 292 # this is a root
325 293 copies = {}
326 294 for i, c in enumerate(children[r]):
327 p1, p2, p1copies, p2copies, removed, ismerged = revinfo(c)
295 p1, p2, changes = revinfo(c)
328 296 if r == p1:
329 297 parent = 1
330 childcopies = p1copies
298 childcopies = changes.copied_from_p1
331 299 else:
332 300 assert r == p2
333 301 parent = 2
334 childcopies = p2copies
302 childcopies = changes.copied_from_p2
335 303 if not alwaysmatch:
336 304 childcopies = {
337 305 dst: src for dst, src in childcopies.items() if match(dst)
@@ -345,7 +313,7 b' def _combine_changeset_copies('
345 313 source = prev[1]
346 314 newcopies[dest] = (c, source)
347 315 assert newcopies is not copies
348 for f in removed:
316 for f in changes.removed:
349 317 if f in newcopies:
350 318 if newcopies is copies:
351 319 # copy on write to avoid affecting potential other
@@ -366,11 +334,11 b' def _combine_changeset_copies('
366 334 # potential filelog related behavior.
367 335 if parent == 1:
368 336 _merge_copies_dict(
369 othercopies, newcopies, isancestor, ismerged
337 othercopies, newcopies, isancestor, changes
370 338 )
371 339 else:
372 340 _merge_copies_dict(
373 newcopies, othercopies, isancestor, ismerged
341 newcopies, othercopies, isancestor, changes
374 342 )
375 343 all_copies[c] = newcopies
376 344
@@ -381,7 +349,7 b' def _combine_changeset_copies('
381 349 return final_copies
382 350
383 351
384 def _merge_copies_dict(minor, major, isancestor, ismerged):
352 def _merge_copies_dict(minor, major, isancestor, changes):
385 353 """merge two copies-mapping together, minor and major
386 354
387 355 In case of conflict, value from "major" will be picked.
@@ -406,7 +374,7 b' def _merge_copies_dict(minor, major, isa'
406 374 if (
407 375 new_tt == other_tt
408 376 or not isancestor(new_tt, other_tt)
409 or ismerged(dest)
377 or dest in changes.merged
410 378 ):
411 379 minor[dest] = value
412 380
General Comments 0
You need to be logged in to leave comments. Login now