diff hgext3rd/topic/compat.py @ 3064:7a1a4d1f0958 stable

pager: add a function in compats to start pager This will help us enabling pager when ui.pager API exists. Also we can try plugging in the old pager API in this function and we won't have to change anything.
author Pulkit Goyal <7895pulkit@gmail.com>
date Sat, 14 Oct 2017 20:17:25 +0530
parents 66357d4d03b2
children e11e018e8338
line wrap: on
line diff
--- a/hgext3rd/topic/compat.py	Fri Oct 13 20:28:21 2017 +0200
+++ b/hgext3rd/topic/compat.py	Sat Oct 14 20:17:25 2017 +0530
@@ -22,3 +22,10 @@
     getmarkers = obsolete.getmarkers
 if successorssets is None:
     successorssets = obsolete.successorssets
+
+def startpager(ui, cmd):
+    """function to start a pager in case ui.pager() exists"""
+    try:
+        ui.pager(cmd)
+    except AttributeError:
+        pass