changeset 35342:8dba17546016

rebase: extract _assignworkingcopy Slightly cleaner, and makes it easier to hook this in an extension. Differential Revision: https://phab.mercurial-scm.org/D1617
author Phil Cohen <phillco@fb.com>
date Fri, 08 Dec 2017 12:44:27 -0800
parents 03bec089e105
children 85f866bf9362
files hgext/rebase.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Fri Dec 08 15:27:58 2017 -0800
+++ b/hgext/rebase.py	Fri Dec 08 12:44:27 2017 -0800
@@ -382,14 +382,16 @@
 
         self.prepared = True
 
-    def _performrebase(self, tr):
-        repo, ui = self.repo, self.ui
-        # Assign a working copy object.
+    def _assignworkingcopy(self):
         if self.inmemory:
             from mercurial.context import overlayworkingctx
             self.wctx = overlayworkingctx(self.repo)
         else:
             self.wctx = self.repo[None]
+
+    def _performrebase(self, tr):
+        self._assignworkingcopy()
+        repo, ui = self.repo, self.ui
         if self.keepbranchesf:
             # insert _savebranch at the start of extrafns so if
             # there's a user-provided extrafn it can clobber branch if