hgext3rd/topic/stack.py
changeset 2939 7759d040d48d
parent 2938 9872526fc39f
child 2997 a61634f52742
--- a/hgext3rd/topic/stack.py	Fri Sep 15 23:25:38 2017 +0530
+++ b/hgext3rd/topic/stack.py	Sun Sep 17 19:59:25 2017 +0200
@@ -30,6 +30,7 @@
         self._repo = repo
         self.branch = branch
         self.topic = topic
+        self.behinderror = None
         if topic is not None and branch is not None:
             raise error.ProgrammingError('both branch and topic specified (not defined yet)')
         elif topic is not None:
@@ -166,7 +167,9 @@
                 return len(self._repo.revs("only(%d, %ld)", dest, minroot))
             except error.NoMergeDestAbort:
                 return 0
-            except error.ManyMergeDestAbort:
+            except error.ManyMergeDestAbort as exc:
+                # XXX we should make it easier for upstream to provide the information
+                self.behinderror = str(exc).split('-', 1)[0].rstrip()
                 return -1
         return 0
 
@@ -236,7 +239,8 @@
     else:
         if data['behindcount'] == -1:
             fm.plain(', ')
-            fm.plain('ambigious rebase destination', label='topic.stack.summary.behinderror')
+            fm.plain('ambigious rebase destination - %s' % data['behinderror'],
+                     label='topic.stack.summary.behinderror')
         elif data['behindcount']:
             fm.plain(', ')
             fm.plain('%d behind' % data['behindcount'], label='topic.stack.summary.behindcount')
@@ -331,5 +335,6 @@
     data['troubledcount'] = current.troubledcount
     data['headcount'] = len(current.heads)
     data['behindcount'] = current.behindcount
+    data['behinderror'] = current.behinderror
     data['branches'] = current.branches
     return data