Patchwork [2,of,4,V2] pager: set an attribute on ui indicating that a pager is active

login
register
mail settings
Submitter Gregory Szorc
Date Feb. 6, 2015, 8:11 p.m.
Message ID <b46b4078fbecbfacaecc.1423253462@gps-mbp.local>
Download mbox | patch
Permalink /patch/7722/
State Accepted
Commit afdf5f6ab37ae47611f6b24433de22b6e3b42980
Headers show

Comments

Gregory Szorc - Feb. 6, 2015, 8:11 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1423253276 28800
#      Fri Feb 06 12:07:56 2015 -0800
# Node ID b46b4078fbecbfacaecc3ca4bf71c90b74908467
# Parent  c6e2f3414f33e46ecbc1788e38be9c79a1ce6e50
pager: set an attribute on ui indicating that a pager is active

A subsequent patch will teach the color extension to do different things
depending on whether a pager is active. This patch leaves a breadcrumb
on the ui instance to allow it do that that.

Patch

diff --git a/hgext/pager.py b/hgext/pager.py
--- a/hgext/pager.py
+++ b/hgext/pager.py
@@ -148,8 +148,10 @@  def uisetup(ui):
                      (cmd not in ignore and not attend)):
                     usepager = True
                     break
 
+        setattr(ui, 'pageractive', usepager)
+
         if usepager:
             ui.setconfig('ui', 'formatted', ui.formatted(), 'pager')
             ui.setconfig('ui', 'interactive', False, 'pager')
             if util.safehasattr(signal, "SIGPIPE"):