comparison hgext/pager.py @ 34495:6d1b0970f80c

configitems: register the 'pager.attend' config
author Boris Feld <boris.feld@octobus.net>
date Fri, 30 Jun 2017 03:43:33 +0200
parents e83302d43748
children 03f7db5f8e71
comparison
equal deleted inserted replaced
34494:bbb5687e5140 34495:6d1b0970f80c
26 from mercurial import ( 26 from mercurial import (
27 cmdutil, 27 cmdutil,
28 commands, 28 commands,
29 dispatch, 29 dispatch,
30 extensions, 30 extensions,
31 registrar,
31 ) 32 )
32 33
33 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for 34 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
34 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should 35 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
35 # be specifying the version(s) of Mercurial they are tested with, or 36 # be specifying the version(s) of Mercurial they are tested with, or
36 # leave the attribute unspecified. 37 # leave the attribute unspecified.
37 testedwith = 'ships-with-hg-core' 38 testedwith = 'ships-with-hg-core'
38 39
40 configtable = {}
41 configitem = registrar.configitem(configtable)
42
43 configitem('pager', 'attend',
44 default=lambda: attended,
45 )
46
39 def uisetup(ui): 47 def uisetup(ui):
40 48
41 def pagecmd(orig, ui, options, cmd, cmdfunc): 49 def pagecmd(orig, ui, options, cmd, cmdfunc):
42 auto = options['pager'] == 'auto' 50 auto = options['pager'] == 'auto'
43 if auto and not ui.pageractive: 51 if auto and not ui.pageractive:
44 usepager = False 52 usepager = False
45 attend = ui.configlist('pager', 'attend', attended) 53 attend = ui.configlist('pager', 'attend')
46 ignore = ui.configlist('pager', 'ignore') 54 ignore = ui.configlist('pager', 'ignore')
47 cmds, _ = cmdutil.findcmd(cmd, commands.table) 55 cmds, _ = cmdutil.findcmd(cmd, commands.table)
48 56
49 for cmd in cmds: 57 for cmd in cmds:
50 var = 'attend-%s' % cmd 58 var = 'attend-%s' % cmd