# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1507992445 -19800 # Node ID 7a1a4d1f09583563f2579ac4a7c3e4a3ed56f6c8 # Parent 6f87042766cb9c04c56c6825b4e69495f7db64d1 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. diff -r 6f87042766cb -r 7a1a4d1f0958 hgext3rd/evolve/compat.py --- 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) diff -r 6f87042766cb -r 7a1a4d1f0958 hgext3rd/topic/compat.py --- 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