Show More
@@ -432,10 +432,26 b' def _restoreactivebookmark(repo, mark):' | |||||
432 |
|
432 | |||
433 | def _aborttransaction(repo, tr): |
|
433 | def _aborttransaction(repo, tr): | |
434 | """Abort current transaction for shelve/unshelve, but keep dirstate""" |
|
434 | """Abort current transaction for shelve/unshelve, but keep dirstate""" | |
435 | dirstatebackupname = b'dirstate.shelve' |
|
435 | # disable the transaction invalidation of the dirstate, to preserve the | |
436 | repo.dirstate.savebackup(None, dirstatebackupname) |
|
436 | # current change in memory. | |
437 | tr.abort() |
|
437 | ds = repo.dirstate | |
438 | repo.dirstate.restorebackup(None, dirstatebackupname) |
|
438 | # The assert below check that nobody else did such wrapping. | |
|
439 | # | |||
|
440 | # These is not such other wrapping currently, but if someone try to | |||
|
441 | # implement one in the future, this will explicitly break here instead of | |||
|
442 | # misbehaving in subtle ways. | |||
|
443 | assert 'invalidate' not in vars(ds) | |||
|
444 | try: | |||
|
445 | # note : we could simply disable the transaction abort callback, but | |||
|
446 | # other code also tries to rollback and invalidate this. | |||
|
447 | ds.invalidate = lambda: None | |||
|
448 | tr.abort() | |||
|
449 | finally: | |||
|
450 | del ds.invalidate | |||
|
451 | # manually write the change in memory since we can no longer rely on the | |||
|
452 | # transaction to do so. | |||
|
453 | assert repo.currenttransaction() is None | |||
|
454 | repo.dirstate.write(None) | |||
439 |
|
455 | |||
440 |
|
456 | |||
441 | def getshelvename(repo, parent, opts): |
|
457 | def getshelvename(repo, parent, opts): |
General Comments 0
You need to be logged in to leave comments.
Login now