# HG changeset patch # User Jason R. Coombs # Date 1660156768 14400 # Node ID 2064bbf7a1d5146efdb2d3e6e2b2f397c559cb81 # Parent fa00c407d61cacbd39ef0c91f7cc8cc4104bc63e phase-shelve: Implement a 'shelve.store' experimental config Accepts "internal" or "strip", indicating how the shelved changes are stored. Defaults to "internal", retaining compatibility for repos with "internal-phase" already enabled. diff -r fa00c407d61c -r 2064bbf7a1d5 mercurial/configitems.py --- a/mercurial/configitems.py Wed Aug 10 14:16:55 2022 -0400 +++ b/mercurial/configitems.py Wed Aug 10 14:39:28 2022 -0400 @@ -1432,6 +1432,12 @@ experimental=True, ) coreconfigitem( + b'shelve', + b'store', + default='internal', + experimental=True, +) +coreconfigitem( b'fsmonitor', b'warn_when_unused', default=True, diff -r fa00c407d61c -r 2064bbf7a1d5 mercurial/shelve.py --- a/mercurial/shelve.py Wed Aug 10 14:16:55 2022 -0400 +++ b/mercurial/shelve.py Wed Aug 10 14:39:28 2022 -0400 @@ -99,8 +99,15 @@ return sorted(info, reverse=True) +def _use_internal_phase(repo): + return ( + phases.supportinternal(repo) + and repo.ui.config(b'shelve', b'store') == 'internal' + ) + + def _target_phase(repo): - return phases.internal if phases.supportinternal(repo) else phases.secret + return phases.internal if _use_internal_phase(repo) else phases.secret class Shelf: @@ -548,7 +555,7 @@ def _finishshelve(repo, tr): - if phases.supportinternal(repo): + if _use_internal_phase(repo): tr.close() else: _aborttransaction(repo, tr) @@ -789,7 +796,7 @@ if state.activebookmark and state.activebookmark in repo._bookmarks: bookmarks.activate(repo, state.activebookmark) mergefiles(ui, repo, state.wctx, state.pendingctx) - if not phases.supportinternal(repo): + if not _use_internal_phase(repo): repair.strip( ui, repo, state.nodestoremove, backup=False, topic=b'shelve' ) @@ -876,7 +883,7 @@ mergefiles(ui, repo, state.wctx, shelvectx) restorebranch(ui, repo, state.branchtorestore) - if not phases.supportinternal(repo): + if not _use_internal_phase(repo): repair.strip( ui, repo, state.nodestoremove, backup=False, topic=b'shelve' )