changeset 4066:1aa5f851d2c0

stack: clarify s# error message in case of branch A branch might have a lots of changeset, with all of them public.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 03 Sep 2018 16:41:32 +0200
parents fbc51e98cf13
children fb4801478d5d
files hgext3rd/topic/__init__.py tests/test-stack-branch.t tests/test-topic-stack.t
diffstat 3 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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