# HG changeset patch # User Martin von Zweigbergk # Date 2021-04-28 15:48:10 # Node ID c4dbbaecaad34b2818a39a9f3c8a24ea0bdbe016 # Parent 7a90fddb13b0cb2930b983d93af01078f60e1e1a rewriteutil: adapt "cannot %s while merging" to work with "change branch of" `rewriteutil.precheck()` creates error messages by inserting a given verb into a sentence. The `hg branch -r` command passes in "change branch of" as the verb. That doesn't work well with "cannot %s while merging" (making it "cannot change branch of while merging"). Let's insert a "changeset" there to make it work better. Building sentences like this seems obviously bad for i18n, but fixing that is out of scope for this series, IMO. Differential Revision: https://phab.mercurial-scm.org/D10530 diff --git a/mercurial/rewriteutil.py b/mercurial/rewriteutil.py --- a/mercurial/rewriteutil.py +++ b/mercurial/rewriteutil.py @@ -44,7 +44,7 @@ def precheck(repo, revs, action=b'rewrit revs = (r.rev() for r in revs) if len(repo[None].parents()) > 1: - raise error.StateError(_(b"cannot %s while merging") % action) + raise error.StateError(_(b"cannot %s changesets while merging") % action) publicrevs = repo.revs(b'%ld and public()', revs) if publicrevs: diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t --- a/tests/test-commit-amend.t +++ b/tests/test-commit-amend.t @@ -406,7 +406,7 @@ Refuse to amend during a merge: 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg ci --amend - abort: cannot amend while merging + abort: cannot amend changesets while merging [20] $ hg ci -m 'merge' diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t --- a/tests/test-uncommit.t +++ b/tests/test-uncommit.t @@ -410,7 +410,7 @@ Add and expect uncommit to fail on both [20] $ hg uncommit --config experimental.uncommitondirtywdir=True - abort: cannot uncommit while merging + abort: cannot uncommit changesets while merging [20] $ hg status