# HG changeset patch # User Jun Wu # Date 2016-12-26 00:25:44 # Node ID 117e15c30e6cd15df5a59d100e4e6270b1e23a9c # Parent 4ab19763d71c2bb9a239dff523b18ed860e34563 pager: wrap ui._runpager As discussed at [1], ui._runpager will be the new low-level API accepting a pager command to actually run the pager. And ui.pager is the high-level API which reads config directly from self. This change is necessary for chgserver to override _runpager cleanly. [1]: www.mercurial-scm.org/pipermail/mercurial-devel/2016-December/091656.html diff --git a/hgext/pager.py b/hgext/pager.py --- a/hgext/pager.py +++ b/hgext/pager.py @@ -118,6 +118,12 @@ def uisetup(ui): if '--debugger' in sys.argv or not ui.formatted(): return + class pagerui(ui.__class__): + def _runpager(self, pagercmd): + _runpager(self, pagercmd) + + ui.__class__ = pagerui + # chg has its own pager implementation argv = sys.argv[:] if 'chgunix' in dispatch._earlygetopt(['--cmdserver'], argv): @@ -157,7 +163,7 @@ def uisetup(ui): ui.setconfig('ui', 'interactive', False, 'pager') if util.safehasattr(signal, "SIGPIPE"): signal.signal(signal.SIGPIPE, signal.SIG_DFL) - _runpager(ui, p) + ui._runpager(p) return orig(ui, options, cmd, cmdfunc) # Wrap dispatch._runcommand after color is loaded so color can see