[PATCH] rebase: properly calculate total commits to rebase (issue5347)

timeless timeless at fmr.im
Fri Aug 26 01:56:56 UTC 2016


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1472170611 0
#      Fri Aug 26 00:16:51 2016 +0000
# Node ID 03c3c35e28913d762df382607cdc29d2c4e6524d
# Parent  b1809f5d7630a3fff0fa715bbd30dba0f07672a8
# Available At https://bitbucket.org/timeless/mercurial-crew
#              hg pull https://bitbucket.org/timeless/mercurial-crew -r 03c3c35e2891
rebase: properly calculate total commits to rebase (issue5347)

Before this, predecessor commits were being included in the count

diff -r b1809f5d7630 -r 03c3c35e2891 hgext/rebase.py
--- a/hgext/rebase.py	Mon Aug 15 20:39:33 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)


More information about the Mercurial-devel mailing list