comparison mercurial/copies.py @ 45986:f9f8d8aa9a92

copies: clarify the return of _merge_copies_dict I misused that function twice in the past few days, so lets clarify the API. Differential Revision: https://phab.mercurial-scm.org/D9418
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 20 Nov 2020 11:22:28 +0100
parents b6b7626d3e06
children b9588ff9b66a
comparison
equal deleted inserted replaced
45985:b6b7626d3e06 45986:f9f8d8aa9a92
381 # potential filelog related behavior. 381 # potential filelog related behavior.
382 if parent == 1: 382 if parent == 1:
383 minor, major = othercopies, newcopies 383 minor, major = othercopies, newcopies
384 else: 384 else:
385 minor, major = newcopies, othercopies 385 minor, major = newcopies, othercopies
386 _merge_copies_dict(minor, major, isancestor, changes) 386 copies = _merge_copies_dict(minor, major, isancestor, changes)
387 all_copies[c] = minor 387 all_copies[c] = copies
388 388
389 final_copies = {} 389 final_copies = {}
390 for dest, (tt, source) in all_copies[targetrev].items(): 390 for dest, (tt, source) in all_copies[targetrev].items():
391 if source is not None: 391 if source is not None:
392 final_copies[dest] = source 392 final_copies[dest] = source
401 - `isancestors(low_rev, high_rev)`: callable return True if `low_rev` is an 401 - `isancestors(low_rev, high_rev)`: callable return True if `low_rev` is an
402 ancestors of `high_rev`, 402 ancestors of `high_rev`,
403 403
404 - `ismerged(path)`: callable return True if `path` have been merged in the 404 - `ismerged(path)`: callable return True if `path` have been merged in the
405 current revision, 405 current revision,
406
407 return the resulting dict (in practice, the "minor" object, updated)
406 """ 408 """
407 for dest, value in major.items(): 409 for dest, value in major.items():
408 other = minor.get(dest) 410 other = minor.get(dest)
409 if other is None: 411 if other is None:
410 minor[dest] = value 412 minor[dest] = value
434 elif not isancestor(new_tt, other_tt): 436 elif not isancestor(new_tt, other_tt):
435 if value[1] is not None: 437 if value[1] is not None:
436 minor[dest] = value 438 minor[dest] = value
437 elif isancestor(other_tt, new_tt): 439 elif isancestor(other_tt, new_tt):
438 minor[dest] = value 440 minor[dest] = value
441 return minor
439 442
440 443
441 def _revinfo_getter_extra(repo): 444 def _revinfo_getter_extra(repo):
442 """return a function that return multiple data given a <rev>"i 445 """return a function that return multiple data given a <rev>"i
443 446