changeset 29551:333dd3ab8fb2

rebase: replace extrafn field with _makeextrafn invocations As per Yuya's advice, we would like to slightly reduce the amount of state which is stored in rebaseruntime class. In this case, we don't need to store extrafn field, as we can produce the necessary value by calling _makeextrafn and the perf overhead is negligible.
author Kostia Balytskyi <ikostia@fb.com>
date Thu, 14 Jul 2016 02:59:27 -0700
parents 1c22400db72d
children db26925bdbb0
files hgext/rebase.py
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Mon Jul 04 11:18:03 2016 -0700
+++ b/hgext/rebase.py	Thu Jul 14 02:59:27 2016 -0700
@@ -148,7 +148,6 @@
         self.extrafns = [_savegraft]
         if e:
             self.extrafns = [e]
-        self.extrafn = None
 
         self.keepf = opts.get('keep', False)
         self.keepbranchesf = opts.get('keepbranches', False)
@@ -336,8 +335,6 @@
         if self.activebookmark:
             bookmarks.deactivate(repo)
 
-        self.extrafn = _makeextrafn(self.extrafns)
-
         self.sortedstate = sorted(self.state)
         total = len(self.sortedstate)
         pos = 0
@@ -381,7 +378,7 @@
                     editform = cmdutil.mergeeditform(merging, 'rebase')
                     editor = cmdutil.getcommiteditor(editform=editform, **opts)
                     newnode = concludenode(repo, rev, p1, p2,
-                                           extrafn=self.extrafn,
+                                           extrafn=_makeextrafn(self.extrafns),
                                            editor=editor,
                                            keepbranches=self.keepbranchesf,
                                            date=self.date)
@@ -444,7 +441,8 @@
             revtoreuse = self.sortedstate[-1]
             newnode = concludenode(repo, revtoreuse, p1, self.external,
                                    commitmsg=commitmsg,
-                                   extrafn=self.extrafn, editor=editor,
+                                   extrafn=_makeextrafn(self.extrafns),
+                                   editor=editor,
                                    keepbranches=self.keepbranchesf,
                                    date=self.date)
             if newnode is None: