Mercurial > evolve
diff hgext3rd/topic/stack.py @ 2939:7759d040d48d
topic: provide more information when behind count cannot be computed
The behind count has been confusing for various user and the associated error
message is even worth. We try to clarify it to see if that helps.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 17 Sep 2017 19:59:25 +0200 |
parents | 9872526fc39f |
children | a61634f52742 |
line wrap: on
line diff
--- 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