Skip to content
Snippets Groups Projects

update precheck in evolve to be consistent with precheck in core hg

Merged Anton Shestakov requested to merge topic/default/update-precheck into branch/default
1 file
+ 12
9
Compare changes
  • Side-by-side
  • Inline
@@ -68,8 +68,8 @@
if node.nullrev in revs:
msg = _(b"cannot %s the null revision") % (action)
hint = _(b"no changeset checked out")
raise error.Abort(msg, hint=hint)
raise compat.InputError(msg, hint=hint)
if any(util.safehasattr(r, 'rev') for r in revs):
msg = b"rewriteutil.precheck called with ctx not revs"
repo.ui.develwarn(msg)
revs = (r.rev() for r in revs)
@@ -72,9 +72,12 @@
if any(util.safehasattr(r, 'rev') for r in revs):
msg = b"rewriteutil.precheck called with ctx not revs"
repo.ui.develwarn(msg)
revs = (r.rev() for r in revs)
if len(repo[None].parents()) > 1:
raise compat.StateError(_(b"cannot %s changesets while merging")
% action)
publicrevs = repo.revs(b'%ld and public()', revs)
if publicrevs:
summary = _formatrevs(repo, publicrevs)
msg = _(b"cannot %s public changesets: %s") % (action, summary)
hint = _(b"see 'hg help phases' for details")
@@ -76,8 +79,8 @@
publicrevs = repo.revs(b'%ld and public()', revs)
if publicrevs:
summary = _formatrevs(repo, publicrevs)
msg = _(b"cannot %s public changesets: %s") % (action, summary)
hint = _(b"see 'hg help phases' for details")
raise error.Abort(msg, hint=hint)
raise compat.InputError(msg, hint=hint)
newunstable = disallowednewunstable(repo, revs)
if newunstable:
@@ -82,5 +85,5 @@
newunstable = disallowednewunstable(repo, revs)
if newunstable:
msg = _(b"%s will orphan %i descendants")
msg = _(b"cannot %s changeset, as that will orphan %i descendants")
msg %= (action, len(newunstable))
hint = _(b"see 'hg help evolution.instability'")
@@ -85,6 +88,6 @@
msg %= (action, len(newunstable))
hint = _(b"see 'hg help evolution.instability'")
raise error.Abort(msg, hint=hint)
raise compat.InputError(msg, hint=hint)
allowdivergence = compat.isenabled(repo, compat.allowdivergenceopt)
if allowdivergence:
return
@@ -93,7 +96,7 @@
local, other, common_prec = divergence
localdiv = repo[local]
otherdiv, base = repo[other], repo[common_prec]
msg = _(b"%s of %s creates content-divergence "
msg = _(b"cannot %s %s, as that creates content-divergence "
b"with %s") % (action, localdiv, otherdiv)
if localdiv.rev() != base.rev():
msg += _(b', from %s') % base
@@ -101,5 +104,5 @@
b"'hg help evolution.instability'")
if repo.ui.verbose:
if localdiv.rev() != base.rev():
msg += _(b'\n changeset %s is an evolution of '
msg += _(b'\n changeset %s is a successor of '
b'changeset %s') % (localdiv, base)
@@ -105,6 +108,6 @@
b'changeset %s') % (localdiv, base)
msg += _(b'\n changeset %s already have a successors as '
msg += _(b'\n changeset %s already has a successor in '
b'changeset %s\n'
b' rewriting changeset %s would create '
b'"content-divergence"\n'
b' set experimental.evolution.allowdivergence=True to '
@@ -107,7 +110,7 @@
b'changeset %s\n'
b' rewriting changeset %s would create '
b'"content-divergence"\n'
b' set experimental.evolution.allowdivergence=True to '
b'overwrite this check') % (base, otherdiv, localdiv)
b'skip this check') % (base, otherdiv, localdiv)
hint = _(b"see 'hg help evolution.instability' for details "
b"on content-divergence")
@@ -112,6 +115,6 @@
hint = _(b"see 'hg help evolution.instability' for details "
b"on content-divergence")
raise error.Abort(msg, hint=hint)
raise compat.InputError(msg, hint=hint)
def bookmarksupdater(repo, oldid, tr):
"""Return a callable update(newid) updating the current bookmark
Loading