# HG changeset patch # User Jun Wu <qu...@fb.com> # Date 1484002743 -28800 # Tue Jan 10 06:59:03 2017 +0800 # Node ID 97e3f81b69bc7bc670459c62056f706c2b6ff941 # Parent 603c1d614690ab594f240f4daf198f34c1714f62 # Available At https://bitbucket.org/quark-zju/hg-draft # hg pull https://bitbucket.org/quark-zju/hg-draft -r 97e3f81b69bc chg: handle pager request client-side
This patch implements the simple S-channel pager handling at chg client-side. Note: It does not deal with environ and cwd currently for simplicity, which will be fixed later. diff --git a/contrib/chg/Makefile b/contrib/chg/Makefile --- a/contrib/chg/Makefile +++ b/contrib/chg/Makefile @@ -26,5 +26,5 @@ all: $(TARGET) chg.o: hgclient.h procutil.h util.h -hgclient.o: hgclient.h util.h +hgclient.o: hgclient.h procutil.h util.h procutil.o: procutil.h util.h util.o: util.h diff --git a/contrib/chg/hgclient.c b/contrib/chg/hgclient.c --- a/contrib/chg/hgclient.c +++ b/contrib/chg/hgclient.c @@ -24,4 +24,5 @@ #include "hgclient.h" +#include "procutil.h" #include "util.h" @@ -72,4 +73,6 @@ struct hgclient_tag_ { static const size_t defaultdatasize = 4096; +static void attachio(hgclient_t *hgc); + static void initcontext(context_t *ctx) { @@ -249,4 +252,11 @@ static void handlesystemrequest(hgclient ctx->datasize = sizeof(r_n); writeblock(hgc); + } else if (strcmp(args[0], "pager") == 0) { + setuppager(args[1]); + if (hgc->capflags & CAP_ATTACHIO) + attachio(hgc); + /* unblock the server */ + static const char emptycmd[] = "\n"; + sendall(hgc->sockfd, emptycmd, sizeof(emptycmd) - 1); } else { abortmsg("unknown type in system request: %s", args[0]); _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel