4301 repoview.filtertable[b'__perf_branchmap_update_target'] = targetfilter |
4301 repoview.filtertable[b'__perf_branchmap_update_target'] = targetfilter |
4302 |
4302 |
4303 baserepo = repo.filtered(b'__perf_branchmap_update_base') |
4303 baserepo = repo.filtered(b'__perf_branchmap_update_base') |
4304 targetrepo = repo.filtered(b'__perf_branchmap_update_target') |
4304 targetrepo = repo.filtered(b'__perf_branchmap_update_target') |
4305 |
4305 |
|
4306 copy_base_kwargs = copy_base_kwargs = {} |
|
4307 if 'repo' in getargspec(repo.branchmap().copy).args: |
|
4308 copy_base_kwargs = {"repo": baserepo} |
|
4309 copy_target_kwargs = {"repo": targetrepo} |
|
4310 |
4306 # try to find an existing branchmap to reuse |
4311 # try to find an existing branchmap to reuse |
4307 subsettable = getbranchmapsubsettable() |
4312 subsettable = getbranchmapsubsettable() |
4308 candidatefilter = subsettable.get(None) |
4313 candidatefilter = subsettable.get(None) |
4309 while candidatefilter is not None: |
4314 while candidatefilter is not None: |
4310 candidatebm = repo.filtered(candidatefilter).branchmap() |
4315 candidatebm = repo.filtered(candidatefilter).branchmap() |
4311 if candidatebm.validfor(baserepo): |
4316 if candidatebm.validfor(baserepo): |
4312 filtered = repoview.filterrevs(repo, candidatefilter) |
4317 filtered = repoview.filterrevs(repo, candidatefilter) |
4313 missing = [r for r in allbaserevs if r in filtered] |
4318 missing = [r for r in allbaserevs if r in filtered] |
4314 base = candidatebm.copy() |
4319 base = candidatebm.copy(**copy_base_kwargs) |
4315 base.update(baserepo, missing) |
4320 base.update(baserepo, missing) |
4316 break |
4321 break |
4317 candidatefilter = subsettable.get(candidatefilter) |
4322 candidatefilter = subsettable.get(candidatefilter) |
4318 else: |
4323 else: |
4319 # no suitable subset where found |
4324 # no suitable subset where found |
4320 base = branchmap.branchcache() |
4325 base = branchmap.branchcache() |
4321 base.update(baserepo, allbaserevs) |
4326 base.update(baserepo, allbaserevs) |
4322 |
4327 |
4323 def setup(): |
4328 def setup(): |
4324 x[0] = base.copy() |
4329 x[0] = base.copy(**copy_target_kwargs) |
4325 if clearcaches: |
4330 if clearcaches: |
4326 unfi._revbranchcache = None |
4331 unfi._revbranchcache = None |
4327 clearchangelog(repo) |
4332 clearchangelog(repo) |
4328 |
4333 |
4329 def bench(): |
4334 def bench(): |