stack: clarify s# error message in case of branch
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 03 Sep 2018 16:41:32 +0200
changeset 4066 1aa5f851d2c0
parent 4065 fbc51e98cf13
child 4067 fb4801478d5d
stack: clarify s# error message in case of branch A branch might have a lots of changeset, with all of them public.
hgext3rd/topic/__init__.py
tests/test-stack-branch.t
tests/test-topic-stack.t
--- a/hgext3rd/topic/__init__.py	Mon Sep 03 16:29:02 2018 +0200
+++ b/hgext3rd/topic/__init__.py	Mon Sep 03 16:41:32 2018 +0200
@@ -288,7 +288,10 @@
         try:
             r = revs[idx]
         except IndexError:
-            msg = _('cannot resolve "%s": %s "%s" has only %d changesets')
+            if ttype == 'topic':
+                msg = _('cannot resolve "%s": %s "%s" has only %d changesets')
+            elif ttype == 'branch':
+                msg = _('cannot resolve "%s": %s "%s" has only %d non-public changesets')
             raise error.Abort(msg % (name, ttype, tname, len(revs) - 1))
         # b0 or t0 can be None
         if r == -1 and idx == 0:
--- a/tests/test-stack-branch.t	Mon Sep 03 16:29:02 2018 +0200
+++ b/tests/test-stack-branch.t	Mon Sep 03 16:41:32 2018 +0200
@@ -92,7 +92,7 @@
   $ hg up foo
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg up b42
-  abort: cannot resolve "b42": branch "foo" has only 4 changesets
+  abort: cannot resolve "b42": branch "foo" has only 4 non-public changesets
   [255]
   $ hg up b2
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
--- a/tests/test-topic-stack.t	Mon Sep 03 16:29:02 2018 +0200
+++ b/tests/test-topic-stack.t	Mon Sep 03 16:41:32 2018 +0200
@@ -242,7 +242,7 @@
 
 
   $ hg up s2
-  abort: cannot resolve "s2": branch "default" has only 0 changesets
+  abort: cannot resolve "s2": branch "default" has only 0 non-public changesets
   [255]
   $ hg topic foo
   marked working directory as topic: foo