From patchwork Wed Jul 24 12:05:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D6679: unshelve: store information about interactive mode in shelvedstate From: phabricator X-Patchwork-Id: 41040 Message-Id: <37870cc3807823a67d34f38774858953@localhost.localdomain> To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Wed, 24 Jul 2019 12:05:22 +0000 navaneeth.suresh updated this revision to Diff 16036. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6679?vs=16021&id=16036 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D6679/new/ REVISION DETAIL https://phab.mercurial-scm.org/D6679 AFFECTED FILES mercurial/shelve.py CHANGE DETAILS To: navaneeth.suresh, #hg-reviewers Cc: pulkit, mercurial-devel diff --git a/mercurial/shelve.py b/mercurial/shelve.py --- a/mercurial/shelve.py +++ b/mercurial/shelve.py @@ -177,6 +177,8 @@ _nokeep = 'nokeep' # colon is essential to differentiate from a real bookmark name _noactivebook = ':no-active-bookmark' + _interactive = 'interactive' + _noninteractive = 'noninteractive' @classmethod def _verifyandtransform(cls, d): @@ -247,6 +249,7 @@ obj.activebookmark = '' if d.get('activebook', '') != cls._noactivebook: obj.activebookmark = d.get('activebook', '') + obj.interactive = d.get('interactive') == cls._interactive except (error.RepoLookupError, KeyError) as err: raise error.CorruptedState(pycompat.bytestr(err)) @@ -254,7 +257,7 @@ @classmethod def save(cls, repo, name, originalwctx, pendingctx, nodestoremove, - branchtorestore, keep=False, activebook=''): + branchtorestore, keep=False, activebook='', interactive=False): info = { "name": name, "originalwctx": nodemod.hex(originalwctx.node()), @@ -265,7 +268,9 @@ for n in nodestoremove]), "branchtorestore": branchtorestore, "keep": cls._keep if keep else cls._nokeep, - "activebook": activebook or cls._noactivebook + "activebook": activebook or cls._noactivebook, + "interactive": (cls._interactive + if interactive else cls._noninteractive) } scmutil.simplekeyvaluefile( repo.vfs, cls._filename).write(info, @@ -698,7 +703,7 @@ """subcommand to continue an in-progress unshelve""" # We're finishing off a merge. First parent is our original # parent, second is the temporary "fake" commit we're unshelving. - interactive = opts.get('interactive') + interactive = state.interactive with repo.lock(): checkparents(repo, state) ms = merge.mergestate.read(repo) @@ -854,7 +859,8 @@ nodestoremove = [repo.changelog.node(rev) for rev in pycompat.xrange(oldtiprev, len(repo))] shelvedstate.save(repo, basename, pctx, tmpwctx, nodestoremove, - branchtorestore, opts.get('keep'), activebookmark) + branchtorestore, opts.get('keep'), activebookmark, + interactive) raise error.InterventionRequired( _("unresolved conflicts (see 'hg resolve', then " "'hg unshelve --continue')"))