diff hgext/mq.py @ 34918:274811627808 stable

mq: copy pager attributes back to qrepo.ui If the legacy pager extension is enabled, a pager is started through repo.ui at dispatch._runcommand(). After that, mqcommand() creates a qrepo with a fresh repo.baseui, at which point pager information was lost and another pager would be spawned by the modern pager interface. This is a minimal workaround for the problem.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 21 Oct 2017 13:42:43 +0900
parents c2d2e18f9700
children 25c543944bc0
line wrap: on
line diff
--- a/hgext/mq.py	Sat Oct 21 13:13:20 2017 +0900
+++ b/hgext/mq.py	Sat Oct 21 13:42:43 2017 +0900
@@ -1963,6 +1963,14 @@
 
     def qrepo(self, create=False):
         ui = self.baseui.copy()
+        # copy back attributes set by ui.pager()
+        if self.ui.pageractive and not ui.pageractive:
+            ui.pageractive = self.ui.pageractive
+            # internal config: ui.formatted
+            ui.setconfig('ui', 'formatted',
+                         self.ui.config('ui', 'formatted'), 'mqpager')
+            ui.setconfig('ui', 'interactive',
+                         self.ui.config('ui', 'interactive'), 'mqpager')
         if create or os.path.isdir(self.join(".hg")):
             return hg.repository(ui, path=self.path, create=create)