Mercurial > evolve
comparison hgext3rd/topic/stack.py @ 1985:03d6b685c16a
topic: list the number of 'behind' changeset when --verbose is used
Displaying more information in the topic list is useful, we continue with the
number of 'behind' changesets. This 'behind' count the number of new changesets on
the default rebase destination. This will highlight topics that need rebasing.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Sun, 14 Aug 2016 19:57:58 +0200 |
parents | d87fc4f749e6 |
children | 9a5d797d25be |
comparison
equal
deleted
inserted
replaced
1984:2a07df823588 | 1985:03d6b685c16a |
---|---|
2 # | 2 # |
3 # This software may be used and distributed according to the terms of the | 3 # This software may be used and distributed according to the terms of the |
4 # GNU General Public License version 2 or any later version. | 4 # GNU General Public License version 2 or any later version. |
5 from mercurial.i18n import _ | 5 from mercurial.i18n import _ |
6 from mercurial import ( | 6 from mercurial import ( |
7 destutil, | |
7 error, | 8 error, |
8 node, | 9 node, |
9 ) | 10 ) |
10 from .evolvebits import builddependencies, _orderrevs, _singlesuccessor | 11 from .evolvebits import builddependencies, _orderrevs, _singlesuccessor |
11 | 12 |
67 """get various data about a stack | 68 """get various data about a stack |
68 | 69 |
69 :changesetcount: number of non-obsolete changesets in the stack | 70 :changesetcount: number of non-obsolete changesets in the stack |
70 :troubledcount: number on troubled changesets | 71 :troubledcount: number on troubled changesets |
71 :headcount: number of heads on the topic | 72 :headcount: number of heads on the topic |
73 :behindcount: number of changeset on rebase destination | |
72 """ | 74 """ |
73 data = {} | 75 data = {} |
74 revs = repo.revs("topic(%s) - obsolete()", topic) | 76 revs = repo.revs("topic(%s) - obsolete()", topic) |
75 data['changesetcount'] = len(revs) | 77 data['changesetcount'] = len(revs) |
76 data['troubledcount'] = len([r for r in revs if repo[r].troubled()]) | 78 data['troubledcount'] = len([r for r in revs if repo[r].troubled()]) |
77 deps, rdeps = builddependencies(repo, revs) | 79 deps, rdeps = builddependencies(repo, revs) |
78 data['headcount'] = len([r for r in revs if not rdeps[r]]) | 80 data['headcount'] = len([r for r in revs if not rdeps[r]]) |
81 data['behindcount'] = 0 | |
82 if revs: | |
83 minroot = [min(r for r in revs if not deps[r])] | |
84 try: | |
85 dest = destutil.destmerge(repo, action='rebase', | |
86 sourceset=minroot, | |
87 onheadcheck=False) | |
88 data['behindcount'] = len(repo.revs("only(%d, %ld)", dest, | |
89 minroot)) | |
90 except error.NoMergeDestAbort: | |
91 data['behindcount'] = 0 | |
92 except error.ManyMergeDestAbort: | |
93 data['behindcount'] = -1 | |
79 | 94 |
80 return data | 95 return data |
81 | 96 |