comparison mercurial/copies.py @ 42223:d69bc8ffbe6f

copies: inline _computenonoverlap() in mergecopies() We now call pathcopies() from the base to each of the commits, and that calls _computeforwardmissing(), which does file prefetching (in the remotefilelog override). So the call to _computenonoverlap() is now pointless (the sets of files from _computenonoverlap() are subsets of the sets of files from _computeforwardmissing()). This somehow also fixes a broken remotefilelog test. Differential Revision: https://phab.mercurial-scm.org/D6256
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 12 Apr 2019 10:44:37 -0700
parents 57203e0210f8
children a20d7c6abff2
comparison
equal deleted inserted replaced
42222:57203e0210f8 42223:d69bc8ffbe6f
351 if debug: 351 if debug:
352 repo.ui.debug('debug.copies: search mode: combined\n') 352 repo.ui.debug('debug.copies: search mode: combined\n')
353 return _chain(x, y, _backwardrenames(x, a, match=match), 353 return _chain(x, y, _backwardrenames(x, a, match=match),
354 _forwardcopies(a, y, match=match)) 354 _forwardcopies(a, y, match=match))
355 355
356 def _computenonoverlap(repo, c1, c2, addedinm1, addedinm2, debug=True):
357 """Computes, based on addedinm1 and addedinm2, the files exclusive to c1
358 and c2. This is its own function so extensions can easily wrap this call
359 to see what files mergecopies is about to process.
360
361 Even though c1 and c2 are not used in this function, they are useful in
362 other extensions for being able to read the file nodes of the changed files.
363 """
364 u1 = sorted(addedinm1 - addedinm2)
365 u2 = sorted(addedinm2 - addedinm1)
366
367 if debug:
368 header = " unmatched files in %s"
369 if u1:
370 repo.ui.debug("%s:\n %s\n" % (header % 'local', "\n ".join(u1)))
371 if u2:
372 repo.ui.debug("%s:\n %s\n" % (header % 'other', "\n ".join(u2)))
373
374 return u1, u2
375
376 def mergecopies(repo, c1, c2, base): 356 def mergecopies(repo, c1, c2, base):
377 """ 357 """
378 Finds moves and copies between context c1 and c2 that are relevant for 358 Finds moves and copies between context c1 and c2 that are relevant for
379 merging. 'base' will be used as the merge base. 359 merging. 'base' will be used as the merge base.
380 360
553 renamedeleteset.update(dsts) 533 renamedeleteset.update(dsts)
554 534
555 # find interesting file sets from manifests 535 # find interesting file sets from manifests
556 addedinm1 = m1.filesnotin(mb, repo.narrowmatch()) 536 addedinm1 = m1.filesnotin(mb, repo.narrowmatch())
557 addedinm2 = m2.filesnotin(mb, repo.narrowmatch()) 537 addedinm2 = m2.filesnotin(mb, repo.narrowmatch())
558 u1, u2 = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2) 538 u1 = sorted(addedinm1 - addedinm2)
539 u2 = sorted(addedinm2 - addedinm1)
540
541 header = " unmatched files in %s"
542 if u1:
543 repo.ui.debug("%s:\n %s\n" % (header % 'local', "\n ".join(u1)))
544 if u2:
545 repo.ui.debug("%s:\n %s\n" % (header % 'other', "\n ".join(u2)))
559 546
560 fullcopy = copies1.copy() 547 fullcopy = copies1.copy()
561 fullcopy.update(copies2) 548 fullcopy.update(copies2)
562 if not fullcopy: 549 if not fullcopy:
563 return copy, {}, diverge, renamedelete, {} 550 return copy, {}, diverge, renamedelete, {}