Patchwork rebase: properly calculate total commits to rebase (issue5347)

login
register
mail settings
Submitter timeless
Date Aug. 26, 2016, 1:56 a.m.
Message ID <03c3c35e28913d762df3.1472176616@gcc2-power8.osuosl.org>
Download mbox | patch
Permalink /patch/16442/
State Accepted
Headers show

Comments

timeless - Aug. 26, 2016, 1:56 a.m.
# HG changeset patch
# User timeless <timeless@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
Yuya Nishihara - Aug. 30, 2016, 12:11 p.m.
On Fri, 26 Aug 2016 01:56:56 +0000, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@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)

Looks good. Queued, thanks.

Patch

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)