Mercurial > public > mercurial-scm > hg
comparison mercurial/upgrade.py @ 51799:45c467d8422c
localrepo: remove _readrequires function in favor of scmutil.readrequires
author | Arseniy Alekseyev <aalekseyev@janestreet.com> |
---|---|
date | Thu, 15 Aug 2024 14:56:50 +0100 |
parents | ca7bde5dbafb |
children | f4733654f144 |
comparison
equal
deleted
inserted
replaced
51798:eb952b2d224c | 51799:45c467d8422c |
---|---|
306 mismatch_warn, | 306 mismatch_warn, |
307 mismatch_verbose_upgrade, | 307 mismatch_verbose_upgrade, |
308 ): | 308 ): |
309 """Upgrades a share to use share-safe mechanism""" | 309 """Upgrades a share to use share-safe mechanism""" |
310 wlock = None | 310 wlock = None |
311 store_requirements = localrepo._readrequires(storevfs, False) | 311 store_requirements = scmutil.readrequires(storevfs, False) |
312 original_crequirements = current_requirements.copy() | 312 original_crequirements = current_requirements.copy() |
313 # after upgrade, store requires will be shared, so lets find | 313 # after upgrade, store requires will be shared, so lets find |
314 # the requirements which are not present in store and | 314 # the requirements which are not present in store and |
315 # write them to share's .hg/requires | 315 # write them to share's .hg/requires |
316 diffrequires = current_requirements - store_requirements | 316 diffrequires = current_requirements - store_requirements |
323 return | 323 return |
324 try: | 324 try: |
325 wlock = lockmod.trylock(ui, hgvfs, b'wlock', 0, 0) | 325 wlock = lockmod.trylock(ui, hgvfs, b'wlock', 0, 0) |
326 # some process might change the requirement in between, re-read | 326 # some process might change the requirement in between, re-read |
327 # and update current_requirements | 327 # and update current_requirements |
328 locked_requirements = localrepo._readrequires(hgvfs, True) | 328 locked_requirements = scmutil.readrequires(hgvfs, True) |
329 if locked_requirements != original_crequirements: | 329 if locked_requirements != original_crequirements: |
330 removed = current_requirements - locked_requirements | 330 removed = current_requirements - locked_requirements |
331 # update current_requirements in place because it's passed | 331 # update current_requirements in place because it's passed |
332 # as reference | 332 # as reference |
333 current_requirements -= removed | 333 current_requirements -= removed |
369 mismatch_warn, | 369 mismatch_warn, |
370 mismatch_verbose_upgrade, | 370 mismatch_verbose_upgrade, |
371 ): | 371 ): |
372 """Downgrades a share which use share-safe to not use it""" | 372 """Downgrades a share which use share-safe to not use it""" |
373 wlock = None | 373 wlock = None |
374 source_requirements = localrepo._readrequires(sharedvfs, True) | 374 source_requirements = scmutil.readrequires(sharedvfs, True) |
375 original_crequirements = current_requirements.copy() | 375 original_crequirements = current_requirements.copy() |
376 # we cannot be 100% sure on which requirements were present in store when | 376 # we cannot be 100% sure on which requirements were present in store when |
377 # the source supported share-safe. However, we do know that working | 377 # the source supported share-safe. However, we do know that working |
378 # directory requirements were not there. Hence we remove them | 378 # directory requirements were not there. Hence we remove them |
379 source_requirements -= requirementsmod.WORKING_DIR_REQUIREMENTS | 379 source_requirements -= requirementsmod.WORKING_DIR_REQUIREMENTS |
384 | 384 |
385 try: | 385 try: |
386 wlock = lockmod.trylock(ui, hgvfs, b'wlock', 0, 0) | 386 wlock = lockmod.trylock(ui, hgvfs, b'wlock', 0, 0) |
387 # some process might change the requirement in between, re-read | 387 # some process might change the requirement in between, re-read |
388 # and update current_requirements | 388 # and update current_requirements |
389 locked_requirements = localrepo._readrequires(hgvfs, True) | 389 locked_requirements = scmutil.readrequires(hgvfs, True) |
390 if locked_requirements != original_crequirements: | 390 if locked_requirements != original_crequirements: |
391 removed = current_requirements - locked_requirements | 391 removed = current_requirements - locked_requirements |
392 # update current_requirements in place because it's passed | 392 # update current_requirements in place because it's passed |
393 # as reference | 393 # as reference |
394 current_requirements -= removed | 394 current_requirements -= removed |