##// END OF EJS Templates
copies: inline _computenonoverlap() in mergecopies()...
Martin von Zweigbergk -
r42409:d69bc8ff default
parent child Browse files
Show More
@@ -487,37 +487,6 b' def onetimeclientsetup(ui):'
487 return orig(repo, matcher, added, removed, *args, **kwargs)
487 return orig(repo, matcher, added, removed, *args, **kwargs)
488 extensions.wrapfunction(scmutil, '_findrenames', findrenames)
488 extensions.wrapfunction(scmutil, '_findrenames', findrenames)
489
489
490 # prefetch files before mergecopies check
491 def computenonoverlap(orig, repo, c1, c2, *args, **kwargs):
492 u1, u2 = orig(repo, c1, c2, *args, **kwargs)
493 if isenabled(repo):
494 m1 = c1.manifest()
495 m2 = c2.manifest()
496 files = []
497
498 sparsematch1 = repo.maybesparsematch(c1.rev())
499 if sparsematch1:
500 sparseu1 = set()
501 for f in u1:
502 if sparsematch1(f):
503 files.append((f, hex(m1[f])))
504 sparseu1.add(f)
505 u1 = sparseu1
506
507 sparsematch2 = repo.maybesparsematch(c2.rev())
508 if sparsematch2:
509 sparseu2 = set()
510 for f in u2:
511 if sparsematch2(f):
512 files.append((f, hex(m2[f])))
513 sparseu2.add(f)
514 u2 = sparseu2
515
516 # batch fetch the needed files from the server
517 repo.fileservice.prefetch(files)
518 return u1, u2
519 extensions.wrapfunction(copies, '_computenonoverlap', computenonoverlap)
520
521 # prefetch files before pathcopies check
490 # prefetch files before pathcopies check
522 def computeforwardmissing(orig, a, b, match=None):
491 def computeforwardmissing(orig, a, b, match=None):
523 missing = orig(a, b, match=match)
492 missing = orig(a, b, match=match)
@@ -353,26 +353,6 b' def pathcopies(x, y, match=None):'
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
@@ -555,7 +535,14 b' def _fullcopytracing(repo, c1, c2, base)'
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)
@@ -98,12 +98,5 b' pulled'
98 $ clearcache
98 $ clearcache
99 $ hg prefetch -r '. + .^' -I x -I z
99 $ hg prefetch -r '. + .^' -I x -I z
100 4 files fetched over 1 fetches - (4 misses, 0.00% hit ratio) over * (glob)
100 4 files fetched over 1 fetches - (4 misses, 0.00% hit ratio) over * (glob)
101 Originally this was testing that the rebase doesn't fetch pointless
102 blobs. Right now it fails because core's sparse can't load a spec from
103 the working directory. Presumably there's a fix, but I'm not sure what it is.
104 $ hg rebase -d 2 --keep
101 $ hg rebase -d 2 --keep
105 rebasing 1:876b1317060d "x2" (foo)
102 rebasing 1:876b1317060d "x2" (foo)
106 transaction abort!
107 rollback completed
108 abort: cannot parse sparse patterns from working directory
109 [255]
General Comments 0
You need to be logged in to leave comments. Login now