Mercurial > evolve
changeset 5136:bbf33d5f32ef
touch: allow divergence with -A even if allowdivergence=no
This is a phase-divergent update to 731b5a89a784.
1f92a6aa40d6 (evolve: add pre-check logic for content-divergence in
rewriteutil.precheck(), 2019-11-04) taught `rewriteutil.precheck()` to
check for divergence. It also set allowdivergence=yes in test-touch.t
to silence the error. However, if one does *not* have that set, it is
no longer possible to allow divergence with `hg touch -A`. This patch
fixes that.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 04 Feb 2020 16:22:40 -0800 |
parents | 731b5a89a784 |
children | 19b8ffd23795 |
files | hgext3rd/evolve/cmdrewrite.py hgext3rd/evolve/rewriteutil.py |
diffstat | 2 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/cmdrewrite.py Tue Feb 04 16:22:40 2020 -0800 +++ b/hgext3rd/evolve/cmdrewrite.py Tue Feb 04 16:22:40 2020 -0800 @@ -1389,8 +1389,11 @@ duplicate = opts['duplicate'] if not duplicate: - # allowdivergence=True because we'll do our own checking later instead - rewriteutil.precheck(repo, revs, b'touch', allowdivergence=True) + # Override allowdivergence=true because we'll do our own checking later + # instead + overrides = {(b'experimental', b'evolution.allowdivergence'): b"true"} + with ui.configoverride(overrides, b'touch'): + rewriteutil.precheck(repo, revs, b'touch') tmpl = utility.shorttemplate displayer = compat.changesetdisplayer(ui, repo, {b'template': tmpl}) with repo.wlock(), repo.lock(), repo.transaction(b'touch'):
--- a/hgext3rd/evolve/rewriteutil.py Tue Feb 04 16:22:40 2020 -0800 +++ b/hgext3rd/evolve/rewriteutil.py Tue Feb 04 16:22:40 2020 -0800 @@ -51,7 +51,7 @@ summary %= (node.short(tonode(first)), numrevs - 1) return summary -def precheck(repo, revs, action=b'rewrite', allowdivergence=None): +def precheck(repo, revs, action=b'rewrite'): """check if <revs> can be rewritten <action> can be used to control the commit message. @@ -77,9 +77,8 @@ hint = _(b"see 'hg help evolution.instability'") raise error.Abort(msg, hint=hint) divrisk = revs_hascontentdivrisk(repo, revs) - if allowdivergence is None: - allowdivergence = repo.ui.configbool(b'experimental', - b'evolution.allowdivergence') + allowdivergence = repo.ui.configbool(b'experimental', + b'evolution.allowdivergence') if divrisk and not allowdivergence: localdiv = repo[divrisk[0]] otherdiv, base = repo[divrisk[1][0]], repo[divrisk[1][1]]