rebase: properly calculate total commits to rebase (issue5347)
authortimeless <timeless@mozdev.org>
Fri, 26 Aug 2016 00:16:51 +0000
changeset 29872 58db005d870e
parent 29871 90af59b40d8a
child 29873 80ba176bad62
rebase: properly calculate total commits to rebase (issue5347) Before this, predecessor commits were being included in the count
hgext/rebase.py
--- a/hgext/rebase.py	Sun Aug 28 17:51:32 2016 -0700
+++ b/hgext/rebase.py	Fri Aug 26 00:16:51 2016 +0000
@@ -336,7 +336,8 @@
             bookmarks.deactivate(repo)
 
         sortedrevs = sorted(self.state)
-        total = len(self.state)
+        cands = [k for k, v in self.state.iteritems() if v == revtodo]
+        total = len(cands)
         pos = 0
         for rev in sortedrevs:
             ctx = repo[rev]
@@ -345,8 +346,8 @@
             names = repo.nodetags(ctx.node()) + repo.nodebookmarks(ctx.node())
             if names:
                 desc += ' (%s)' % ' '.join(names)
-            pos += 1
             if self.state[rev] == revtodo:
+                pos += 1
                 ui.status(_('rebasing %s\n') % desc)
                 ui.progress(_("rebasing"), pos, ("%d:%s" % (rev, ctx)),
                             _('changesets'), total)