ó çƒQc@sÞdZddlZddlZddlZddlZddlZddlZddlZddlm Z m Z m Z m Z ddl mZdZd„Zd„Zd„Zd „Zd „Zd d d ddddgZdS(sbrowse command output with an external pager To set the pager that should be used, set the application variable:: [pager] pager = less -FRX If no pager is set, the pager extensions uses the environment variable $PAGER. If neither pager.pager, nor $PAGER is set, no pager is used. You can disable the pager for certain commands by adding them to the pager.ignore list:: [pager] ignore = version, help, update You can also enable the pager only for certain commands using pager.attend. Below is the default list of commands to be paged:: [pager] attend = annotate, cat, diff, export, glog, log, qdiff Setting pager.attend to an empty value will cause all commands to be paged. If pager.attend is present, pager.ignore will be ignored. To ignore global commands like :hg:`version` or :hg:`help`, you have to specify them in your user configuration file. The --pager=... option can also be used to control when the pager is used. Use a boolean value like yes, no, on, off, or use auto for normal behavior. iÿÿÿÿN(tcommandstdispatchtutilt extensions(t_tinternalcCs€tjtdƒsLtj|dƒt_|jtjƒrHtjt_ndStjƒ\}}tj ƒ}|dkrÛtj |ƒtj |tjj ƒƒ|jtjƒrÊtj |tjj ƒƒntj |ƒdStj |tj j ƒƒtj |ƒtj |ƒytjddd|gƒWnNtk r{}|jtjkrutj|ƒ}tj|d|ƒq|‚nXdS(Ntforktwbis/bin/shs-c(Rt safehasattrtostpopentsyststdoutt_isattytstderrtpipeRtclosetdup2tfilenotstdintexecvptOSErrorterrnotENOENTtshlextsplit(tuitptfdintfdouttpidtetargs((s//sys/lib/python2.7/site-packages/hgext/pager.pyt _pagerfork8s0      csêtj|dtdddtjdtjdtjdtjƒ‰t j tjj ƒƒ‰t j tjj ƒƒ‰t j ˆj j ƒtjj ƒƒ|jtjƒrÈt j ˆj j ƒtjj ƒƒntj‡‡‡fd†ƒ}dS( Ntshelltbufsizeiÿÿÿÿt close_fdsRR Rcsxtjtdƒr+tjtjtjƒnˆjjƒtjˆt j j ƒƒtjˆt j j ƒƒˆj ƒdS(NtSIGINT(RRtsignalR%tSIG_IGNRRR RR R RRtwait((tpagerRR (s//sys/lib/python2.7/site-packages/hgext/pager.pyt killpager_s  (t subprocesstPopentTrueRtclosefdstPIPER R RR tdupRRRR tatexittregister(RRR*((R)RR s//sys/lib/python2.7/site-packages/hgext/pager.pyt_pagersubprocessTs"%cCs0tjdkrt||ƒn t||ƒdS(Nii(ii(R t version_infoR3R!(RR((s//sys/lib/python2.7/site-packages/hgext/pager.pyt _runpagerhscCs@dtjks|jƒ r dSd„}tjtd|ƒdS(Ns --debuggerc Ss|jddtjjdƒƒ}|r|jddtƒ}|ddk}tj|dƒ}|s–|r||ks–||jddƒkr| r|jdd|j ƒƒ|jddt ƒtj t d ƒrít j t j t jƒnt||ƒqn|||||ƒS( NR)tPAGERtattendtautotignoreRt formattedt interactivetSIGPIPE(tconfigR tenvirontgett configlisttattendedRt parseboolt setconfigR:tFalseRR&R<tSIG_DFLR5( torigRtoptionstcmdtcmdfuncRR7R8talways((s//sys/lib/python2.7/site-packages/hgext/pager.pytpagecmdus!  t _runcommand(R targvR:Rt wrapfunctionR(RRK((s//sys/lib/python2.7/site-packages/hgext/pager.pytuisetupqs cCs/tjjdddtdƒtdƒfƒdS(NtR)R8s2when to paginate (boolean, always, auto, or never)tTYPE(Rt globaloptstappendR(R((s//sys/lib/python2.7/site-packages/hgext/pager.pytextsetupˆs   tannotatetcattdifftexporttglogtlogtqdiff(t__doc__R1R R R&R+RRt mercurialRRRRtmercurial.i18nRt testedwithR!R3R5RORTRA(((s//sys/lib/python2.7/site-packages/hgext/pager.pyt0sT"