diff --git a/contrib/chg/chg.c b/contrib/chg/chg.c --- a/contrib/chg/chg.c +++ b/contrib/chg/chg.c @@ -429,10 +429,6 @@ int main(int argc, const char *argv[], c } setupsignalhandler(hgc_peerpid(hgc), hgc_peerpgid(hgc)); - const char *pagercmd = hgc_getpager(hgc, argv + 1, argc - 1); - pid_t pagerpid = setuppager(pagercmd); - if (pagerpid) - hgc_attachio(hgc); /* reattach to pager */ int exitcode = hgc_runcommand(hgc, argv + 1, argc - 1); restoresignalhandler(); hgc_close(hgc); diff --git a/contrib/chg/hgclient.c b/contrib/chg/hgclient.c --- a/contrib/chg/hgclient.c +++ b/contrib/chg/hgclient.c @@ -32,7 +32,6 @@ enum { /* cHg extension: */ CAP_ATTACHIO = 0x0100, CAP_CHDIR = 0x0200, - CAP_GETPAGER = 0x0400, CAP_SETENV = 0x0800, CAP_SETUMASK = 0x1000, CAP_VALIDATE = 0x2000, @@ -48,7 +47,6 @@ static const cappair_t captable[] = { {"runcommand", CAP_RUNCOMMAND}, {"attachio", CAP_ATTACHIO}, {"chdir", CAP_CHDIR}, - {"getpager", CAP_GETPAGER}, {"setenv", CAP_SETENV}, {"setumask", CAP_SETUMASK}, {"validate", CAP_VALIDATE}, @@ -593,31 +591,6 @@ void hgc_attachio(hgclient_t *hgc) } /*! - * Get pager command for the given Mercurial command args - * - * If no pager enabled, returns NULL. The return value becomes invalid - * once you run another request to hgc. - */ -const char *hgc_getpager(hgclient_t *hgc, const char *const args[], - size_t argsize) -{ - assert(hgc); - - if (!(hgc->capflags & CAP_GETPAGER)) - return NULL; - - packcmdargs(&hgc->ctx, args, argsize); - writeblockrequest(hgc, "getpager"); - handleresponse(hgc); - - if (hgc->ctx.datasize < 1 || hgc->ctx.data[0] == '\0') - return NULL; - enlargecontext(&hgc->ctx, hgc->ctx.datasize + 1); - hgc->ctx.data[hgc->ctx.datasize] = '\0'; - return hgc->ctx.data; -} - -/*! * Update server's environment variables * * @param envp list of environment variables in "NAME=VALUE" format, diff --git a/contrib/chg/hgclient.h b/contrib/chg/hgclient.h --- a/contrib/chg/hgclient.h +++ b/contrib/chg/hgclient.h @@ -25,8 +25,6 @@ const char **hgc_validate(hgclient_t *hg size_t argsize); int hgc_runcommand(hgclient_t *hgc, const char *const args[], size_t argsize); void hgc_attachio(hgclient_t *hgc); -const char *hgc_getpager(hgclient_t *hgc, const char *const args[], - size_t argsize); void hgc_setenv(hgclient_t *hgc, const char *const envp[]); #endif /* HGCLIENT_H_ */ diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py --- a/mercurial/chgserver.py +++ b/mercurial/chgserver.py @@ -16,9 +16,6 @@ 'chdir' command change current directory -'getpager' command - checks if pager is enabled and which pager should be executed - 'setenv' command replace os.environ completely @@ -45,14 +42,12 @@ import hashlib import inspect import os import re -import signal import struct import time from .i18n import _ from . import ( - cmdutil, commandserver, encoding, error, @@ -172,45 +167,6 @@ class hashstate(object): _log('confighash = %s mtimehash = %s\n' % (confighash, mtimehash)) return hashstate(confighash, mtimehash, mtimepaths) -# copied from hgext/pager.py:uisetup() -def _setuppagercmd(ui, options, cmd): - from . import commands # avoid cycle - - if not ui.formatted(): - return - - p = ui.config("pager", "pager", encoding.environ.get("PAGER")) - usepager = False - always = util.parsebool(options['pager']) - auto = options['pager'] == 'auto' - - if not p: - pass - elif always: - usepager = True - elif not auto: - usepager = False - else: - attended = ['annotate', 'cat', 'diff', 'export', 'glog', 'log', 'qdiff'] - attend = ui.configlist('pager', 'attend', attended) - ignore = ui.configlist('pager', 'ignore') - cmds, _ = cmdutil.findcmd(cmd, commands.table) - - for cmd in cmds: - var = 'attend-%s' % cmd - if ui.config('pager', var): - usepager = ui.configbool('pager', var) - break - if (cmd in attend or - (cmd not in ignore and not attend)): - usepager = True - break - - if usepager: - ui.setconfig('ui', 'formatted', ui.formatted(), 'pager') - ui.setconfig('ui', 'interactive', False, 'pager') - return p - def _newchgui(srcui, csystem, attachio): class chgui(srcui.__class__): def __init__(self, src=None): @@ -484,37 +440,6 @@ class chgcmdserver(commandserver.server) _log('setumask %r\n' % mask) os.umask(mask) - def getpager(self): - """Read cmdargs and write pager command to r-channel if enabled - - If pager isn't enabled, this writes '\0' because channeledoutput - does not allow to write empty data. - """ - from . import dispatch # avoid cycle - - args = self._readlist() - try: - cmd, _func, args, options, _cmdoptions = dispatch._parse(self.ui, - args) - except (error.Abort, error.AmbiguousCommand, error.CommandError, - error.UnknownCommand): - cmd = None - options = {} - if not cmd or 'pager' not in options: - self.cresult.write('\0') - return - - pagercmd = _setuppagercmd(self.ui, options, cmd) - if pagercmd: - # Python's SIGPIPE is SIG_IGN by default. change to SIG_DFL so - # we can exit if the pipe to the pager is closed - if util.safehasattr(signal, 'SIGPIPE') and \ - signal.getsignal(signal.SIGPIPE) == signal.SIG_IGN: - signal.signal(signal.SIGPIPE, signal.SIG_DFL) - self.cresult.write(pagercmd) - else: - self.cresult.write('\0') - def runcommand(self): return super(chgcmdserver, self).runcommand() @@ -535,7 +460,6 @@ class chgcmdserver(commandserver.server) capabilities = commandserver.server.capabilities.copy() capabilities.update({'attachio': attachio, 'chdir': chdir, - 'getpager': getpager, 'runcommand': runcommand, 'setenv': setenv, 'setumask': setumask})