Show More
@@ -244,8 +244,6 b' def upgraderepo(' | |||||
244 | def upgrade_share_to_safe(ui, hgvfs, storevfs, current_requirements): |
|
244 | def upgrade_share_to_safe(ui, hgvfs, storevfs, current_requirements): | |
245 | """Upgrades a share to use share-safe mechanism""" |
|
245 | """Upgrades a share to use share-safe mechanism""" | |
246 | wlock = None |
|
246 | wlock = None | |
247 | try: |
|
|||
248 | wlock = lockmod.trylock(ui, hgvfs, b'wlock', 0, 0) |
|
|||
249 |
|
|
247 | store_requirements = localrepo._readrequires(storevfs, False) | |
250 |
|
|
248 | # after upgrade, store requires will be shared, so lets find | |
251 |
|
|
249 | # the requirements which are not present in store and | |
@@ -253,8 +251,10 b' def upgrade_share_to_safe(ui, hgvfs, sto' | |||||
253 |
|
|
251 | diffrequires = current_requirements - store_requirements | |
254 |
|
|
252 | # add share-safe requirement as it will mark the share as share-safe | |
255 |
|
|
253 | diffrequires.add(requirementsmod.SHARESAFE_REQUIREMENT) | |
|
254 | current_requirements.add(requirementsmod.SHARESAFE_REQUIREMENT) | |||
|
255 | try: | |||
|
256 | wlock = lockmod.trylock(ui, hgvfs, b'wlock', 0, 0) | |||
256 | scmutil.writerequires(hgvfs, diffrequires) |
|
257 | scmutil.writerequires(hgvfs, diffrequires) | |
257 | current_requirements.add(requirementsmod.SHARESAFE_REQUIREMENT) |
|
|||
258 | ui.warn(_(b'repository upgraded to use share-safe mode\n')) |
|
258 | ui.warn(_(b'repository upgraded to use share-safe mode\n')) | |
259 | except error.LockError as e: |
|
259 | except error.LockError as e: | |
260 | if ui.configbool(b'experimental', b'sharesafe-auto-upgrade-fail-error'): |
|
260 | if ui.configbool(b'experimental', b'sharesafe-auto-upgrade-fail-error'): | |
@@ -280,8 +280,6 b' def downgrade_share_to_non_safe(' | |||||
280 | ): |
|
280 | ): | |
281 | """Downgrades a share which use share-safe to not use it""" |
|
281 | """Downgrades a share which use share-safe to not use it""" | |
282 | wlock = None |
|
282 | wlock = None | |
283 | try: |
|
|||
284 | wlock = lockmod.trylock(ui, hgvfs, b'wlock', 0, 0) |
|
|||
285 |
|
|
283 | source_requirements = localrepo._readrequires(sharedvfs, True) | |
286 |
|
|
284 | # we cannot be 100% sure on which requirements were present in store when | |
287 |
|
|
285 | # the source supported share-safe. However, we do know that working | |
@@ -289,6 +287,9 b' def downgrade_share_to_non_safe(' | |||||
289 |
|
|
287 | source_requirements -= requirementsmod.WORKING_DIR_REQUIREMENTS | |
290 |
|
|
288 | current_requirements |= source_requirements | |
291 |
|
|
289 | current_requirements.remove(requirementsmod.SHARESAFE_REQUIREMENT) | |
|
290 | ||||
|
291 | try: | |||
|
292 | wlock = lockmod.trylock(ui, hgvfs, b'wlock', 0, 0) | |||
292 | scmutil.writerequires(hgvfs, current_requirements) |
|
293 | scmutil.writerequires(hgvfs, current_requirements) | |
293 | ui.warn(_(b'repository downgraded to not use share-safe mode\n')) |
|
294 | ui.warn(_(b'repository downgraded to not use share-safe mode\n')) | |
294 | except error.LockError as e: |
|
295 | except error.LockError as e: |
General Comments 0
You need to be logged in to leave comments.
Login now