# HG changeset patch # User Yuya Nishihara # Date 1508560963 -32400 # Node ID 27481162780894fb82e4b2f679f967a3a86cbc3b # Parent ee9243715c59c62c9a2619d7957f2dc159d1373b 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. diff -r ee9243715c59 -r 274811627808 hgext/mq.py --- 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) diff -r ee9243715c59 -r 274811627808 tests/test-pager-legacy.t --- a/tests/test-pager-legacy.t Sat Oct 21 13:13:20 2017 +0900 +++ b/tests/test-pager-legacy.t Sat Oct 21 13:42:43 2017 +0900 @@ -194,6 +194,36 @@ $ hg --config pager.attend-echoa=yes echoa paged! 'a\n' +Pager attributes should be copied to mq repo. Otherwise pager would be started +twice and color mode would be lost. + + $ cat >> $HGRCPATH < [extensions] + > mq = + > EOF + $ hg init --mq + $ hg qnew foo.patch + $ hg qpop + popping foo.patch + patch queue now empty + $ hg ci --mq -m 'commit patches' + $ hg log --mq --debug + starting pager for command 'extension-via-attend-log' + paged! '\x1b[0;33mchangeset: 0:6cc2ded15503e368aaf76b6cc3d12f320c9e3b87\x1b[0m\n' + paged! 'tag: tip\n' + paged! 'phase: draft\n' + paged! 'parent: -1:0000000000000000000000000000000000000000\n' + paged! 'parent: -1:0000000000000000000000000000000000000000\n' + paged! 'manifest: 0:4980de1ae1b612014d5bcfa9507da84ce8891daa\n' + paged! 'user: test\n' + paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n' + paged! 'files+: .hgignore foo.patch series\n' + paged! 'extra: branch=default\n' + paged! 'description:\n' + paged! 'commit patches\n' + paged! '\n' + paged! '\n' + Pager works with hg aliases including environment variables. $ cat >> $HGRCPATH <<'EOF'