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.
--- a/hgext3rd/evolve/compat.py Fri Oct 13 20:28:21 2017 +0200
+++ b/hgext3rd/evolve/compat.py Sat Oct 14 20:17:25 2017 +0530
@@ -172,3 +172,8 @@
if not util.safehasattr(obsolete, '_computephasedivergentset'):
obsolete._computephasedivergentset = obsolete.cachefor('phasedivergent')(obsolete._computebumpedset)
+
+def startpager(ui, cmd):
+ """function to start a pager in case ui.pager() exists"""
+ if util.safehasattr(ui, 'pager'):
+ ui.pager(cmd)
--- 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