diff hgext/rebase.py @ 29552:db26925bdbb0

rebase: remove sortedstate-related confusion The following rebase implementation details are frustrating: - storing a list of sorted revision numbers in a field named sortedstate - having sortedstate be a field of the rebaseruntime class - using sortedstate[-1] as opposed to a more intuitive max(self.state) to compute the latest revision in the state This commit fixes those imperfections.
author Kostia Balytskyi <ikostia@fb.com>
date Thu, 14 Jul 2016 03:12:09 -0700
parents 333dd3ab8fb2
children 754f63671229
line wrap: on
line diff
--- a/hgext/rebase.py	Thu Jul 14 02:59:27 2016 -0700
+++ b/hgext/rebase.py	Thu Jul 14 03:12:09 2016 -0700
@@ -335,10 +335,10 @@
         if self.activebookmark:
             bookmarks.deactivate(repo)
 
-        self.sortedstate = sorted(self.state)
-        total = len(self.sortedstate)
+        sortedrevs = sorted(self.state)
+        total = len(self.state)
         pos = 0
-        for rev in self.sortedstate:
+        for rev in sortedrevs:
             ctx = repo[rev]
             desc = '%d:%s "%s"' % (ctx.rev(), ctx,
                                    ctx.description().split('\n', 1)[0])
@@ -438,7 +438,7 @@
                         commitmsg += '\n* %s' % repo[rebased].description()
                 editopt = True
             editor = cmdutil.getcommiteditor(edit=editopt, editform=editform)
-            revtoreuse = self.sortedstate[-1]
+            revtoreuse = max(self.state)
             newnode = concludenode(repo, revtoreuse, p1, self.external,
                                    commitmsg=commitmsg,
                                    extrafn=_makeextrafn(self.extrafns),