rewriteutil: adapt "cannot %s while merging" to work with "change branch of"
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 28 Apr 2021 08:48:10 -0700
changeset 47019 c4dbbaecaad3
parent 47018 7a90fddb13b0
child 47020 ba6881c6a178
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
mercurial/rewriteutil.py
tests/test-commit-amend.t
tests/test-uncommit.t
--- a/mercurial/rewriteutil.py	Thu Feb 11 15:11:10 2021 -0800
+++ b/mercurial/rewriteutil.py	Wed Apr 28 08:48:10 2021 -0700
@@ -44,7 +44,7 @@
         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:
--- a/tests/test-commit-amend.t	Thu Feb 11 15:11:10 2021 -0800
+++ b/tests/test-commit-amend.t	Wed Apr 28 08:48:10 2021 -0700
@@ -406,7 +406,7 @@
   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'
 
--- a/tests/test-uncommit.t	Thu Feb 11 15:11:10 2021 -0800
+++ b/tests/test-uncommit.t	Wed Apr 28 08:48:10 2021 -0700
@@ -410,7 +410,7 @@
   [20]
 
   $ hg uncommit --config experimental.uncommitondirtywdir=True
-  abort: cannot uncommit while merging
+  abort: cannot uncommit changesets while merging
   [20]
 
   $ hg status