changeset 24067:0baf41e02a4d

pager: ensure wrapped dispatch._runcommand runs before color's An upcoming patch will teach color to potentially act differently if the pager is active. Since both extensions wrap the same function (dispatch._runcommand) to change behavior, we must guarantee that pager's wrapped function runs before color's so color may read the breadcrumb left by pager.
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 06 Feb 2015 12:09:09 -0800
parents afdf5f6ab37a
children 4e02418b4236
files hgext/pager.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/pager.py	Fri Feb 06 12:07:56 2015 -0800
+++ b/hgext/pager.py	Fri Feb 06 12:09:09 2015 -0800
@@ -159,7 +159,12 @@
             _runpager(ui, p)
         return orig(ui, options, cmd, cmdfunc)
 
-    extensions.wrapfunction(dispatch, '_runcommand', pagecmd)
+    # Wrap dispatch._runcommand after color is loaded so color can see
+    # ui.pageractive. Otherwise, if we loaded first, color's wrapped
+    # dispatch._runcommand would run without having access to ui.pageractive.
+    def afterloaded(loaded):
+        extensions.wrapfunction(dispatch, '_runcommand', pagecmd)
+    extensions.afterloaded('color', afterloaded)
 
 def extsetup(ui):
     commands.globalopts.append(