Mercurial > hg
comparison hgext/shelve.py @ 39744:52dfa1eb0ad4
shelve: no longer strip internal commit when using internal phase
When the internal phase is used, the internal commits we create during shelve
will be automatically hidden, and we don't need to strip them. Avoiding strips
gives much better performances and is less traumatic for caches.
Test changes are all related to revision numbers increasing more quickly since
we avoid stripping.
At the end of `test-shelve.t` we now need manually strip the shelve-commit in
addition to the x.shelve file deletion. This emulates a preexisting shelve
after a repository upgrade.
Note:
The hidden internal commits confuses rebase a bit as shown by a new test
added. This will happen when the user have shelve commits on top of a
changeset to be rebased.
We'll fix this in the next commit. As we still use a backup bundle, rebase
can just strip the internal changesets and be fine.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Wed, 06 Jun 2018 02:31:46 +0200 |
parents | 84d6e9a2b104 |
children | 42a6b228dd2e |
comparison
equal
deleted
inserted
replaced
39743:f803bcb902ad | 39744:52dfa1eb0ad4 |
---|---|
432 if s.unknown: | 432 if s.unknown: |
433 extra['shelve_unknown'] = '\0'.join(s.unknown) | 433 extra['shelve_unknown'] = '\0'.join(s.unknown) |
434 repo[None].add(s.unknown) | 434 repo[None].add(s.unknown) |
435 | 435 |
436 def _finishshelve(repo): | 436 def _finishshelve(repo): |
437 _aborttransaction(repo) | 437 if phases.supportinternal(repo): |
438 backupname = 'dirstate.shelve' | |
439 tr = repo.currenttransaction() | |
440 repo.dirstate.savebackup(tr, backupname) | |
441 tr.close() | |
442 repo.dirstate.restorebackup(None, backupname) | |
443 else: | |
444 _aborttransaction(repo) | |
438 | 445 |
439 def createcmd(ui, repo, pats, opts): | 446 def createcmd(ui, repo, pats, opts): |
440 """subcommand that creates a new shelve""" | 447 """subcommand that creates a new shelve""" |
441 with repo.wlock(): | 448 with repo.wlock(): |
442 cmdutil.checkunfinished(repo) | 449 cmdutil.checkunfinished(repo) |
650 if repo.vfs.exists('unshelverebasestate'): | 657 if repo.vfs.exists('unshelverebasestate'): |
651 repo.vfs.rename('unshelverebasestate', 'rebasestate') | 658 repo.vfs.rename('unshelverebasestate', 'rebasestate') |
652 rebase.clearstatus(repo) | 659 rebase.clearstatus(repo) |
653 | 660 |
654 mergefiles(ui, repo, state.wctx, state.pendingctx) | 661 mergefiles(ui, repo, state.wctx, state.pendingctx) |
655 repair.strip(ui, repo, state.nodestoremove, backup=False, | 662 if not phases.supportinternal(repo): |
656 topic='shelve') | 663 repair.strip(ui, repo, state.nodestoremove, backup=False, |
664 topic='shelve') | |
657 finally: | 665 finally: |
658 shelvedstate.clear(repo) | 666 shelvedstate.clear(repo) |
659 ui.warn(_("unshelve of '%s' aborted\n") % state.name) | 667 ui.warn(_("unshelve of '%s' aborted\n") % state.name) |
660 | 668 |
661 def mergefiles(ui, repo, wctx, shelvectx): | 669 def mergefiles(ui, repo, wctx, shelvectx): |
744 rebase.clearstatus(repo) | 752 rebase.clearstatus(repo) |
745 | 753 |
746 mergefiles(ui, repo, state.wctx, shelvectx) | 754 mergefiles(ui, repo, state.wctx, shelvectx) |
747 restorebranch(ui, repo, state.branchtorestore) | 755 restorebranch(ui, repo, state.branchtorestore) |
748 | 756 |
749 repair.strip(ui, repo, state.nodestoremove, backup=False, | 757 if not phases.supportinternal(repo): |
750 topic='shelve') | 758 repair.strip(ui, repo, state.nodestoremove, backup=False, |
759 topic='shelve') | |
751 _restoreactivebookmark(repo, state.activebookmark) | 760 _restoreactivebookmark(repo, state.activebookmark) |
752 shelvedstate.clear(repo) | 761 shelvedstate.clear(repo) |
753 unshelvecleanup(ui, repo, state.name, opts) | 762 unshelvecleanup(ui, repo, state.name, opts) |
754 ui.status(_("unshelve of '%s' complete\n") % state.name) | 763 ui.status(_("unshelve of '%s' complete\n") % state.name) |
755 | 764 |