comparison mercurial/copies.py @ 25279:708b19c18adf stable

mergecopies: avoid slowdown from linkrev adjustment (issue4680) checkcopies was using fctx.rev() which it was expecting would be equivalent to linkrev() but was triggering the new _adjustlinkrev path. This was making grafts and merges with large sets of potential copies very expensive.
author Matt Mackall <mpm@selenic.com>
date Tue, 26 May 2015 06:45:18 -0500
parents 4906dc0e038c
children 6ac860f700b5
comparison
equal deleted inserted replaced
25268:a973b050621d 25279:708b19c18adf
454 if f1 == f2: 454 if f1 == f2:
455 return f1 # a match 455 return f1 # a match
456 456
457 g1, g2 = f1.ancestors(), f2.ancestors() 457 g1, g2 = f1.ancestors(), f2.ancestors()
458 try: 458 try:
459 f1r, f2r = f1.rev(), f2.rev() 459 f1r, f2r = f1.linkrev(), f2.linkrev()
460 460
461 if f1r is None: 461 if f1r is None:
462 f1 = g1.next() 462 f1 = g1.next()
463 if f2r is None: 463 if f2r is None:
464 f2 = g2.next() 464 f2 = g2.next()
465 465
466 while True: 466 while True:
467 f1r, f2r = f1.rev(), f2.rev() 467 f1r, f2r = f1.linkrev(), f2.linkrev()
468 if f1r > f2r: 468 if f1r > f2r:
469 f1 = g1.next() 469 f1 = g1.next()
470 elif f2r > f1r: 470 elif f2r > f1r:
471 f2 = g2.next() 471 f2 = g2.next()
472 elif f1 == f2: 472 elif f1 == f2:
477 return False 477 return False
478 478
479 of = None 479 of = None
480 seen = set([f]) 480 seen = set([f])
481 for oc in ctx(f, m1[f]).ancestors(): 481 for oc in ctx(f, m1[f]).ancestors():
482 ocr = oc.rev() 482 ocr = oc.linkrev()
483 of = oc.path() 483 of = oc.path()
484 if of in seen: 484 if of in seen:
485 # check limit late - grab last rename before 485 # check limit late - grab last rename before
486 if ocr < limit: 486 if ocr < limit:
487 break 487 break