Mercurial > evolve
changeset 4423:144cd06029de stable
split: use ui.configoverride to preserve phase while commiting
As we need to preserve the phase of revision which is going to be
splitted into multiple revision. This patch use ui.configoverrides
to temporarily overwrite the phases.new-commit config option at the
time of committing a new node.
author | Sushil khanchi <sushilkhanchi97@gmail.com> |
---|---|
date | Tue, 05 Mar 2019 20:07:23 +0530 |
parents | a56caab87e37 |
children | d52f14bdb468 |
files | hgext3rd/evolve/cmdrewrite.py |
diffstat | 1 files changed, 12 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/cmdrewrite.py Mon Mar 04 11:54:49 2019 +0100 +++ b/hgext3rd/evolve/cmdrewrite.py Tue Mar 05 20:07:23 2019 +0530 @@ -1181,11 +1181,9 @@ cmdutil.bailifchanged(repo) rewriteutil.precheck(repo, [rev], action='split') tr = repo.transaction('split') + # make sure we respect the phase while splitting + overrides = {('phases', 'new-commit'): ctx.phase()} - # make sure we respect the revision current phase while splitting - phasestr = ctx.phasestr() - if phasestr == 'secret': - opts['secret'] = True if len(ctx.parents()) > 1: raise error.Abort(_("cannot split merge commits")) prev = ctx.p1() @@ -1223,8 +1221,10 @@ if haschanges(matcher): if iselect: - cmdutil.dorecord(ui, repo, commands.commit, 'commit', False, - cmdutil.recordfilter, *pats, **opts) + with repo.ui.configoverride(overrides, 'split'): + cmdutil.dorecord(ui, repo, commands.commit, 'commit', + False, cmdutil.recordfilter, *pats, + **opts) # TODO: Does no seem like the best way to do this # We should make dorecord return the newly created commit newcommits.append(repo['.']) @@ -1233,7 +1233,8 @@ hint = _("do you want --interactive") raise error.Abort(msg, hint=hint) else: - commands.commit(ui, repo, *pats, **opts) + with repo.ui.configoverride(overrides, 'split'): + commands.commit(ui, repo, *pats, **opts) newcommits.append(repo['.']) if pats: # refresh the wctx used for the matcher @@ -1246,7 +1247,8 @@ while nextaction is None: nextaction = ui.prompt('continue splitting? [Ycdq?]', default='y') if nextaction == 'c': - commands.commit(ui, repo, **opts) + with repo.ui.configoverride(overrides, 'split'): + commands.commit(ui, repo, **opts) newcommits.append(repo['.']) break elif nextaction == 'q': @@ -1284,7 +1286,8 @@ if haschanges(): # XXX: Should we show a message for informing the user # that we create another commit with remaining changes? - commands.commit(ui, repo, **opts) + with repo.ui.configoverride(overrides, 'split'): + commands.commit(ui, repo, **opts) newcommits.append(repo['.']) if newcommits: tip = repo[newcommits[-1]]