# HG changeset patch # User Sushil khanchi # Date 1575473799 -19800 # Node ID a1cf66165e69273d9b1dd39f12000d225ea3f1a1 # Parent ea3f9e171b9a01a3771463af83a2c97c3e28e21b metaedit: use pre-checking before rewriting csets Changes in test file demonstrate the changed behaviour. diff -r ea3f9e171b9a -r a1cf66165e69 hgext3rd/evolve/cmdrewrite.py --- a/hgext3rd/evolve/cmdrewrite.py Sat Dec 14 13:31:45 2019 +0530 +++ b/hgext3rd/evolve/cmdrewrite.py Wed Dec 04 21:06:39 2019 +0530 @@ -881,20 +881,11 @@ raise error.Abort(_(b'editing multiple revisions without --fold is ' b'not currently supported')) + # pre-check if opts['fold']: root, head, p2 = rewriteutil.foldcheck(repo, revs) else: - if repo.revs(b"%ld and public()", revs): - raise error.Abort(_(b'cannot edit commit information for public ' - b'revisions')) - newunstable = rewriteutil.disallowednewunstable(repo, revs) - if newunstable: - msg = _(b'cannot edit commit information in the middle' - b' of a stack') - hint = _(b'%s will become unstable and new unstable changes' - b' are not allowed') - hint %= repo[newunstable.first()] - raise error.Abort(msg, hint=hint) + rewriteutil.precheck(repo, revs, b'metaedit') root = head = repo[revs.first()] p2 = root.p2() diff -r ea3f9e171b9a -r a1cf66165e69 tests/test-evolve-issue5958.t --- a/tests/test-evolve-issue5958.t Sat Dec 14 13:31:45 2019 +0530 +++ b/tests/test-evolve-issue5958.t Wed Dec 04 21:06:39 2019 +0530 @@ -7,6 +7,8 @@ > [extensions] > rebase = > evolve = + > [experimental] + > evolution.allowdivergence = True > EOF $ hg init issue5958 diff -r ea3f9e171b9a -r a1cf66165e69 tests/test-metaedit.t --- a/tests/test-metaedit.t Sat Dec 14 13:31:45 2019 +0530 +++ b/tests/test-metaedit.t Wed Dec 04 21:06:39 2019 +0530 @@ -64,7 +64,8 @@ $ hg update --clean . 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg metaedit -r 0 - abort: cannot edit commit information for public revisions + abort: cannot metaedit public changesets: ea207398892e + (see 'hg help phases' for details) [255] $ hg metaedit --fold abort: revisions must be specified with --fold @@ -81,8 +82,8 @@ [255] check that metaedit respects allowunstable $ hg metaedit '.^' --config 'experimental.evolution=createmarkers, allnewcommands' - abort: cannot edit commit information in the middle of a stack - (587528abfffe will become unstable and new unstable changes are not allowed) + abort: performing 'metaedit' in the middle of a stack will orphan 587528abfffe + (see 'hg help evolution.instability') [255] $ hg metaedit 'desc(A)::desc(B)' --fold --config 'experimental.evolution=createmarkers, allnewcommands' abort: performing 'fold' in the middle of a stack will orphan 3260958f1169 and its 3 descendants