##// END OF EJS Templates
copies: use dedicated `_revinfo_getter` function and call...
marmoute -
r46215:4f876e6b default
parent child Browse files
Show More
@@ -201,7 +201,6 def _revinfo_getter(repo):
201
201
202 return ismerged
202 return ismerged
203
203
204 if repo.filecopiesmode == b'changeset-sidedata':
205 changelogrevision = cl.changelogrevision
204 changelogrevision = cl.changelogrevision
206 flags = cl.flags
205 flags = cl.flags
207
206
@@ -260,15 +259,6 def _revinfo_getter(repo):
260 value = (p1, p2, p1copies, p2copies, removed, get_ismerged(rev))
259 value = (p1, p2, p1copies, p2copies, removed, get_ismerged(rev))
261 return value
260 return value
262
261
263 else:
264
265 def revinfo(rev):
266 p1, p2 = parents(rev)
267 ctx = repo[rev]
268 p1copies, p2copies = ctx._copies
269 removed = ctx.filesremoved()
270 return p1, p2, p1copies, p2copies, removed, get_ismerged(rev)
271
272 return revinfo
262 return revinfo
273
263
274
264
@@ -278,7 +268,6 def _changesetforwardcopies(a, b, match)
278
268
279 repo = a.repo().unfiltered()
269 repo = a.repo().unfiltered()
280 children = {}
270 children = {}
281 revinfo = _revinfo_getter(repo)
282
271
283 cl = repo.changelog
272 cl = repo.changelog
284 isancestor = cl.isancestorrev # XXX we should had chaching to this.
273 isancestor = cl.isancestorrev # XXX we should had chaching to this.
@@ -311,10 +300,12 def _changesetforwardcopies(a, b, match)
311 revs = sorted(iterrevs)
300 revs = sorted(iterrevs)
312
301
313 if repo.filecopiesmode == b'changeset-sidedata':
302 if repo.filecopiesmode == b'changeset-sidedata':
303 revinfo = _revinfo_getter(repo)
314 return _combine_changeset_copies(
304 return _combine_changeset_copies(
315 revs, children, b.rev(), revinfo, match, isancestor
305 revs, children, b.rev(), revinfo, match, isancestor
316 )
306 )
317 else:
307 else:
308 revinfo = _revinfo_getter_extra(repo)
318 return _combine_changeset_copies_extra(
309 return _combine_changeset_copies_extra(
319 revs, children, b.rev(), revinfo, match, isancestor
310 revs, children, b.rev(), revinfo, match, isancestor
320 )
311 )
@@ -428,6 +419,45 def _merge_copies_dict(minor, major, isa
428 minor[dest] = value
419 minor[dest] = value
429
420
430
421
422 def _revinfo_getter_extra(repo):
423 """return a function that return multiple data given a <rev>"i
424
425 * p1: revision number of first parent
426 * p2: revision number of first parent
427 * p1copies: mapping of copies from p1
428 * p2copies: mapping of copies from p2
429 * removed: a list of removed files
430 * ismerged: a callback to know if file was merged in that revision
431 """
432 cl = repo.changelog
433 parents = cl.parentrevs
434
435 def get_ismerged(rev):
436 ctx = repo[rev]
437
438 def ismerged(path):
439 if path not in ctx.files():
440 return False
441 fctx = ctx[path]
442 parents = fctx._filelog.parents(fctx._filenode)
443 nb_parents = 0
444 for n in parents:
445 if n != node.nullid:
446 nb_parents += 1
447 return nb_parents >= 2
448
449 return ismerged
450
451 def revinfo(rev):
452 p1, p2 = parents(rev)
453 ctx = repo[rev]
454 p1copies, p2copies = ctx._copies
455 removed = ctx.filesremoved()
456 return p1, p2, p1copies, p2copies, removed, get_ismerged(rev)
457
458 return revinfo
459
460
431 def _combine_changeset_copies_extra(
461 def _combine_changeset_copies_extra(
432 revs, children, targetrev, revinfo, match, isancestor
462 revs, children, targetrev, revinfo, match, isancestor
433 ):
463 ):
General Comments 0
You need to be logged in to leave comments. Login now