Mercurial > hg
annotate tests/test-chg.t @ 46924:ca0049946e9a
split: avoid strip if split is a no-op (identical to original)
Differential Revision: https://phab.mercurial-scm.org/D10389
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Mon, 12 Apr 2021 19:25:34 -0700 |
parents | 6383bb86b700 |
children | ec081d7f0009 |
rev | line source |
---|---|
29274
148a9a5379f0
test-chg: run only with chg
Yuya Nishihara <yuya@tcha.org>
parents:
29088
diff
changeset
|
1 #require chg |
148a9a5379f0
test-chg: run only with chg
Yuya Nishihara <yuya@tcha.org>
parents:
29088
diff
changeset
|
2 |
40827
d23fd01cc115
commandserver: add config knob for various logging options
Yuya Nishihara <yuya@tcha.org>
parents:
40826
diff
changeset
|
3 $ mkdir log |
40999
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
4 $ cp $HGRCPATH $HGRCPATH.unconfigured |
40826
1617aa916d88
commandserver: expand log path for convenience
Yuya Nishihara <yuya@tcha.org>
parents:
40825
diff
changeset
|
5 $ cat <<'EOF' >> $HGRCPATH |
40825
eaabcb689747
commandserver: switch logging facility to ui.log() interface
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
6 > [cmdserver] |
40827
d23fd01cc115
commandserver: add config knob for various logging options
Yuya Nishihara <yuya@tcha.org>
parents:
40826
diff
changeset
|
7 > log = $TESTTMP/log/server.log |
d23fd01cc115
commandserver: add config knob for various logging options
Yuya Nishihara <yuya@tcha.org>
parents:
40826
diff
changeset
|
8 > max-log-files = 1 |
d23fd01cc115
commandserver: add config knob for various logging options
Yuya Nishihara <yuya@tcha.org>
parents:
40826
diff
changeset
|
9 > max-log-size = 10 kB |
40825
eaabcb689747
commandserver: switch logging facility to ui.log() interface
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
10 > EOF |
29275
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
11 $ cp $HGRCPATH $HGRCPATH.orig |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
12 |
40825
eaabcb689747
commandserver: switch logging facility to ui.log() interface
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
13 $ filterlog () { |
eaabcb689747
commandserver: switch logging facility to ui.log() interface
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
14 > sed -e 's!^[0-9/]* [0-9:]* ([0-9]*)>!YYYY/MM/DD HH:MM:SS (PID)>!' \ |
eaabcb689747
commandserver: switch logging facility to ui.log() interface
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
15 > -e 's!\(setprocname\|received fds\|setenv\): .*!\1: ...!' \ |
eaabcb689747
commandserver: switch logging facility to ui.log() interface
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
16 > -e 's!\(confighash\|mtimehash\) = [0-9a-f]*!\1 = ...!g' \ |
40999
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
17 > -e 's!\(in \)[0-9.]*s\b!\1 ...s!g' \ |
40825
eaabcb689747
commandserver: switch logging facility to ui.log() interface
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
18 > -e 's!\(pid\)=[0-9]*!\1=...!g' \ |
eaabcb689747
commandserver: switch logging facility to ui.log() interface
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
19 > -e 's!\(/server-\)[0-9a-f]*!\1...!g' |
eaabcb689747
commandserver: switch logging facility to ui.log() interface
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
20 > } |
eaabcb689747
commandserver: switch logging facility to ui.log() interface
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
21 |
28516
3bf2892f685f
chgserver: handle ParseError during validate
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
22 init repo |
3bf2892f685f
chgserver: handle ParseError during validate
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
23 |
29274
148a9a5379f0
test-chg: run only with chg
Yuya Nishihara <yuya@tcha.org>
parents:
29088
diff
changeset
|
24 $ chg init foo |
28516
3bf2892f685f
chgserver: handle ParseError during validate
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
25 $ cd foo |
3bf2892f685f
chgserver: handle ParseError during validate
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
26 |
3bf2892f685f
chgserver: handle ParseError during validate
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
27 ill-formed config |
3bf2892f685f
chgserver: handle ParseError during validate
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
28 |
29274
148a9a5379f0
test-chg: run only with chg
Yuya Nishihara <yuya@tcha.org>
parents:
29088
diff
changeset
|
29 $ chg status |
28516
3bf2892f685f
chgserver: handle ParseError during validate
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
30 $ echo '=brokenconfig' >> $HGRCPATH |
29274
148a9a5379f0
test-chg: run only with chg
Yuya Nishihara <yuya@tcha.org>
parents:
29088
diff
changeset
|
31 $ chg status |
45988
c6da62004c0f
tests: update test-chg.t with output change
Pulkit Goyal <7895pulkit@gmail.com>
parents:
45520
diff
changeset
|
32 config error at * =brokenconfig (glob) |
46145
6383bb86b700
chgserver: respect detailed exit code in case of ConfigError
Pulkit Goyal <7895pulkit@gmail.com>
parents:
45988
diff
changeset
|
33 [30] |
29088 | 34 |
29275
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
35 $ cp $HGRCPATH.orig $HGRCPATH |
30677 | 36 |
37 long socket path | |
38 | |
39 $ sockpath=$TESTTMP/this/path/should/be/longer/than/one-hundred-and-seven/characters/where/107/is/the/typical/size/limit/of/unix-domain-socket | |
40 $ mkdir -p $sockpath | |
41 $ bakchgsockname=$CHGSOCKNAME | |
42 $ CHGSOCKNAME=$sockpath/server | |
43 $ export CHGSOCKNAME | |
44 $ chg root | |
45 $TESTTMP/foo | |
46 $ rm -rf $sockpath | |
47 $ CHGSOCKNAME=$bakchgsockname | |
48 $ export CHGSOCKNAME | |
49 | |
29275
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
50 $ cd .. |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
51 |
31107
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
52 editor |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
53 ------ |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
54 |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
55 $ cat >> pushbuffer.py <<EOF |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
56 > def reposetup(ui, repo): |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
57 > repo.ui.pushbuffer(subproc=True) |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
58 > EOF |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
59 |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
60 $ chg init editor |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
61 $ cd editor |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
62 |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
63 by default, system() should be redirected to the client: |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
64 |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
65 $ touch foo |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
66 $ CHGDEBUG= HGEDITOR=cat chg ci -Am channeled --edit 2>&1 \ |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
67 > | egrep "HG:|run 'cat" |
34309
b94db1780365
chg: show timestamp with debug messages
Jun Wu <quark@fb.com>
parents:
33949
diff
changeset
|
68 chg: debug: * run 'cat "*"' at '$TESTTMP/editor' (glob) |
31107
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
69 HG: Enter commit message. Lines beginning with 'HG:' are removed. |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
70 HG: Leave message empty to abort commit. |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
71 HG: -- |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
72 HG: user: test |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
73 HG: branch 'default' |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
74 HG: added foo |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
75 |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
76 but no redirection should be made if output is captured: |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
77 |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
78 $ touch bar |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
79 $ CHGDEBUG= HGEDITOR=cat chg ci -Am bufferred --edit \ |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
80 > --config extensions.pushbuffer="$TESTTMP/pushbuffer.py" 2>&1 \ |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
81 > | egrep "HG:|run 'cat" |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
82 [1] |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
83 |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
84 check that commit commands succeeded: |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
85 |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
86 $ hg log -T '{rev}:{desc}\n' |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
87 1:bufferred |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
88 0:channeled |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
89 |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
90 $ cd .. |
fbce78c58f1e
chg: refactor ui.system() to be partly overridden
Yuya Nishihara <yuya@tcha.org>
parents:
30847
diff
changeset
|
91 |
30847
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
92 pager |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
93 ----- |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
94 |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
95 $ cat >> fakepager.py <<EOF |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
96 > import sys |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
97 > for line in sys.stdin: |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
98 > sys.stdout.write('paged! %r\n' % line) |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
99 > EOF |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
100 |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
101 enable pager extension globally, but spawns the master server with no tty: |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
102 |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
103 $ chg init pager |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
104 $ cd pager |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
105 $ cat >> $HGRCPATH <<EOF |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
106 > [extensions] |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
107 > pager = |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
108 > [pager] |
39707
5abc47d4ca6b
tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents:
34309
diff
changeset
|
109 > pager = "$PYTHON" $TESTTMP/fakepager.py |
30847
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
110 > EOF |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
111 $ chg version > /dev/null |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
112 $ touch foo |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
113 $ chg ci -qAm foo |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
114 |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
115 pager should be enabled if the attached client has a tty: |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
116 |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
117 $ chg log -l1 -q --config ui.formatted=True |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
118 paged! '0:1f7b0de80e11\n' |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
119 $ chg log -l1 -q --config ui.formatted=False |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
120 0:1f7b0de80e11 |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
121 |
31890 | 122 chg waits for pager if runcommand raises |
123 | |
124 $ cat > $TESTTMP/crash.py <<EOF | |
32337
46ba2cdda476
registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents:
31890
diff
changeset
|
125 > from mercurial import registrar |
31890 | 126 > cmdtable = {} |
32337
46ba2cdda476
registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents:
31890
diff
changeset
|
127 > command = registrar.command(cmdtable) |
33097
fce4ed2912bb
py3: make sure commands name are bytes in tests
Pulkit Goyal <7895pulkit@gmail.com>
parents:
32940
diff
changeset
|
128 > @command(b'crash') |
31890 | 129 > def pagercrash(ui, repo, *pats, **opts): |
43154
f05d10ef42e3
py3: add a missing b'' prefix in test extension for chg
Martin von Zweigbergk <martinvonz@google.com>
parents:
40999
diff
changeset
|
130 > ui.write(b'going to crash\n') |
31890 | 131 > raise Exception('.') |
132 > EOF | |
133 | |
134 $ cat > $TESTTMP/fakepager.py <<EOF | |
33949
0d0cec9602c3
tests: update test-chg to pass our import checker
Augie Fackler <raf@durin42.com>
parents:
33097
diff
changeset
|
135 > from __future__ import absolute_import |
0d0cec9602c3
tests: update test-chg to pass our import checker
Augie Fackler <raf@durin42.com>
parents:
33097
diff
changeset
|
136 > import sys |
0d0cec9602c3
tests: update test-chg to pass our import checker
Augie Fackler <raf@durin42.com>
parents:
33097
diff
changeset
|
137 > import time |
31890 | 138 > for line in iter(sys.stdin.readline, ''): |
139 > if 'crash' in line: # only interested in lines containing 'crash' | |
140 > # if chg exits when pager is sleeping (incorrectly), the output | |
141 > # will be captured by the next test case | |
142 > time.sleep(1) | |
143 > sys.stdout.write('crash-pager: %s' % line) | |
144 > EOF | |
145 | |
146 $ cat >> .hg/hgrc <<EOF | |
147 > [extensions] | |
148 > crash = $TESTTMP/crash.py | |
149 > EOF | |
150 | |
151 $ chg crash --pager=on --config ui.formatted=True 2>/dev/null | |
152 crash-pager: going to crash | |
153 [255] | |
154 | |
45185
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
155 no stdout data should be printed after pager quits, and the buffered data |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
156 should never persist (issue6207) |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
157 |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
158 "killed!" may be printed if terminated by SIGPIPE, which isn't important |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
159 in this test. |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
160 |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
161 $ cat > $TESTTMP/bulkwrite.py <<'EOF' |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
162 > import time |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
163 > from mercurial import error, registrar |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
164 > cmdtable = {} |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
165 > command = registrar.command(cmdtable) |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
166 > @command(b'bulkwrite') |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
167 > def bulkwrite(ui, repo, *pats, **opts): |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
168 > ui.write(b'going to write massive data\n') |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
169 > ui.flush() |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
170 > t = time.time() |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
171 > while time.time() - t < 2: |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
172 > ui.write(b'x' * 1023 + b'\n') # will be interrupted by SIGPIPE |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
173 > raise error.Abort(b"write() doesn't block") |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
174 > EOF |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
175 |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
176 $ cat > $TESTTMP/fakepager.py <<'EOF' |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
177 > import sys |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
178 > import time |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
179 > sys.stdout.write('paged! %r\n' % sys.stdin.readline()) |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
180 > time.sleep(1) # new data will be written |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
181 > EOF |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
182 |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
183 $ cat >> .hg/hgrc <<EOF |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
184 > [extensions] |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
185 > bulkwrite = $TESTTMP/bulkwrite.py |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
186 > EOF |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
187 |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
188 $ chg bulkwrite --pager=on --color no --config ui.formatted=True |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
189 paged! 'going to write massive data\n' |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
190 killed! (?) |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
191 [255] |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
192 |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
193 $ chg bulkwrite --pager=on --color no --config ui.formatted=True |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
194 paged! 'going to write massive data\n' |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
195 killed! (?) |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
196 [255] |
a17454a189d1
chgserver: discard buffered output before restoring fds (issue6207)
Yuya Nishihara <yuya@tcha.org>
parents:
44990
diff
changeset
|
197 |
30847
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
198 $ cd .. |
e12553cfd0a4
pager: wrap _runcommand() no matter if stdout is redirected
Yuya Nishihara <yuya@tcha.org>
parents:
30677
diff
changeset
|
199 |
45520
5eee6f4f3d0d
chg: fallback to original hg if stdio fds are missing
Jun Wu <quark@fb.com>
parents:
45188
diff
changeset
|
200 missing stdio |
5eee6f4f3d0d
chg: fallback to original hg if stdio fds are missing
Jun Wu <quark@fb.com>
parents:
45188
diff
changeset
|
201 ------------- |
5eee6f4f3d0d
chg: fallback to original hg if stdio fds are missing
Jun Wu <quark@fb.com>
parents:
45188
diff
changeset
|
202 |
5eee6f4f3d0d
chg: fallback to original hg if stdio fds are missing
Jun Wu <quark@fb.com>
parents:
45188
diff
changeset
|
203 $ CHGDEBUG=1 chg version -q 0<&- |
5eee6f4f3d0d
chg: fallback to original hg if stdio fds are missing
Jun Wu <quark@fb.com>
parents:
45188
diff
changeset
|
204 chg: debug: * stdio fds are missing (glob) |
5eee6f4f3d0d
chg: fallback to original hg if stdio fds are missing
Jun Wu <quark@fb.com>
parents:
45188
diff
changeset
|
205 chg: debug: * execute original hg (glob) |
5eee6f4f3d0d
chg: fallback to original hg if stdio fds are missing
Jun Wu <quark@fb.com>
parents:
45188
diff
changeset
|
206 Mercurial Distributed SCM * (glob) |
5eee6f4f3d0d
chg: fallback to original hg if stdio fds are missing
Jun Wu <quark@fb.com>
parents:
45188
diff
changeset
|
207 |
29275
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
208 server lifecycle |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
209 ---------------- |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
210 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
211 chg server should be restarted on code change, and old server will shut down |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
212 automatically. In this test, we use the following time parameters: |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
213 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
214 - "sleep 1" to make mtime different |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
215 - "sleep 2" to notice mtime change (polling interval is 1 sec) |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
216 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
217 set up repository with an extension: |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
218 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
219 $ chg init extreload |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
220 $ cd extreload |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
221 $ touch dummyext.py |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
222 $ cat <<EOF >> .hg/hgrc |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
223 > [extensions] |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
224 > dummyext = dummyext.py |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
225 > EOF |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
226 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
227 isolate socket directory for stable result: |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
228 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
229 $ OLDCHGSOCKNAME=$CHGSOCKNAME |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
230 $ mkdir chgsock |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
231 $ CHGSOCKNAME=`pwd`/chgsock/server |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
232 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
233 warm up server: |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
234 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
235 $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start' |
34309
b94db1780365
chg: show timestamp with debug messages
Jun Wu <quark@fb.com>
parents:
33949
diff
changeset
|
236 chg: debug: * start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob) |
29275
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
237 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
238 new server should be started if extension modified: |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
239 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
240 $ sleep 1 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
241 $ touch dummyext.py |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
242 $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start' |
34309
b94db1780365
chg: show timestamp with debug messages
Jun Wu <quark@fb.com>
parents:
33949
diff
changeset
|
243 chg: debug: * instruction: unlink $TESTTMP/extreload/chgsock/server-* (glob) |
b94db1780365
chg: show timestamp with debug messages
Jun Wu <quark@fb.com>
parents:
33949
diff
changeset
|
244 chg: debug: * instruction: reconnect (glob) |
b94db1780365
chg: show timestamp with debug messages
Jun Wu <quark@fb.com>
parents:
33949
diff
changeset
|
245 chg: debug: * start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob) |
29275
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
246 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
247 old server will shut down, while new server should still be reachable: |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
248 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
249 $ sleep 2 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
250 $ CHGDEBUG= chg log 2>&1 | (egrep 'instruction|start' || true) |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
251 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
252 socket file should never be unlinked by old server: |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
253 (simulates unowned socket by updating mtime, which makes sure server exits |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
254 at polling cycle) |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
255 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
256 $ ls chgsock/server-* |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
257 chgsock/server-* (glob) |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
258 $ touch chgsock/server-* |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
259 $ sleep 2 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
260 $ ls chgsock/server-* |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
261 chgsock/server-* (glob) |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
262 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
263 since no server is reachable from socket file, new server should be started: |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
264 (this test makes sure that old server shut down automatically) |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
265 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
266 $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start' |
34309
b94db1780365
chg: show timestamp with debug messages
Jun Wu <quark@fb.com>
parents:
33949
diff
changeset
|
267 chg: debug: * start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob) |
29275
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
268 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
269 shut down servers and restore environment: |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
270 |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
271 $ rm -R chgsock |
40825
eaabcb689747
commandserver: switch logging facility to ui.log() interface
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
272 $ sleep 2 |
29275
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
273 $ CHGSOCKNAME=$OLDCHGSOCKNAME |
e53f961ac75f
test-chg: add basic tests for server lifecycle
Yuya Nishihara <yuya@tcha.org>
parents:
29274
diff
changeset
|
274 $ cd .. |
40825
eaabcb689747
commandserver: switch logging facility to ui.log() interface
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
275 |
eaabcb689747
commandserver: switch logging facility to ui.log() interface
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
276 check that server events are recorded: |
eaabcb689747
commandserver: switch logging facility to ui.log() interface
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
277 |
40827
d23fd01cc115
commandserver: add config knob for various logging options
Yuya Nishihara <yuya@tcha.org>
parents:
40826
diff
changeset
|
278 $ ls log |
d23fd01cc115
commandserver: add config knob for various logging options
Yuya Nishihara <yuya@tcha.org>
parents:
40826
diff
changeset
|
279 server.log |
d23fd01cc115
commandserver: add config knob for various logging options
Yuya Nishihara <yuya@tcha.org>
parents:
40826
diff
changeset
|
280 server.log.1 |
d23fd01cc115
commandserver: add config knob for various logging options
Yuya Nishihara <yuya@tcha.org>
parents:
40826
diff
changeset
|
281 |
d23fd01cc115
commandserver: add config knob for various logging options
Yuya Nishihara <yuya@tcha.org>
parents:
40826
diff
changeset
|
282 print only the last 10 lines, since we aren't sure how many records are |
44990
62bdb288c449
tests: add hghave rule 'setprocname' to check if osutil.setprocname and use it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
44359
diff
changeset
|
283 preserved (since setprocname isn't available on py3 and pure version, |
62bdb288c449
tests: add hghave rule 'setprocname' to check if osutil.setprocname and use it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
44359
diff
changeset
|
284 the 10th-most-recent line is different when using py3): |
40827
d23fd01cc115
commandserver: add config knob for various logging options
Yuya Nishihara <yuya@tcha.org>
parents:
40826
diff
changeset
|
285 |
d23fd01cc115
commandserver: add config knob for various logging options
Yuya Nishihara <yuya@tcha.org>
parents:
40826
diff
changeset
|
286 $ cat log/server.log.1 log/server.log | tail -10 | filterlog |
44990
62bdb288c449
tests: add hghave rule 'setprocname' to check if osutil.setprocname and use it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
44359
diff
changeset
|
287 YYYY/MM/DD HH:MM:SS (PID)> confighash = ... mtimehash = ... (no-setprocname !) |
40999
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
288 YYYY/MM/DD HH:MM:SS (PID)> forked worker process (pid=...) |
44990
62bdb288c449
tests: add hghave rule 'setprocname' to check if osutil.setprocname and use it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
44359
diff
changeset
|
289 YYYY/MM/DD HH:MM:SS (PID)> setprocname: ... (setprocname !) |
40825
eaabcb689747
commandserver: switch logging facility to ui.log() interface
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
290 YYYY/MM/DD HH:MM:SS (PID)> received fds: ... |
eaabcb689747
commandserver: switch logging facility to ui.log() interface
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
291 YYYY/MM/DD HH:MM:SS (PID)> chdir to '$TESTTMP/extreload' |
eaabcb689747
commandserver: switch logging facility to ui.log() interface
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
292 YYYY/MM/DD HH:MM:SS (PID)> setumask 18 |
eaabcb689747
commandserver: switch logging facility to ui.log() interface
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
293 YYYY/MM/DD HH:MM:SS (PID)> setenv: ... |
eaabcb689747
commandserver: switch logging facility to ui.log() interface
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
294 YYYY/MM/DD HH:MM:SS (PID)> confighash = ... mtimehash = ... |
eaabcb689747
commandserver: switch logging facility to ui.log() interface
Yuya Nishihara <yuya@tcha.org>
parents:
39707
diff
changeset
|
295 YYYY/MM/DD HH:MM:SS (PID)> validate: [] |
40828
25e9089c7686
commandserver: turn server debug messages into logs
Yuya Nishihara <yuya@tcha.org>
parents:
40827
diff
changeset
|
296 YYYY/MM/DD HH:MM:SS (PID)> worker process exited (pid=...) |
25e9089c7686
commandserver: turn server debug messages into logs
Yuya Nishihara <yuya@tcha.org>
parents:
40827
diff
changeset
|
297 YYYY/MM/DD HH:MM:SS (PID)> $TESTTMP/extreload/chgsock/server-... is not owned, exiting. |
40999
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
298 |
44325
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
299 global data mutated by schems |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
300 ----------------------------- |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
301 |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
302 $ hg init schemes |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
303 $ cd schemes |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
304 |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
305 initial state |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
306 |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
307 $ cat > .hg/hgrc <<'EOF' |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
308 > [extensions] |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
309 > schemes = |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
310 > [schemes] |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
311 > foo = https://foo.example.org/ |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
312 > EOF |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
313 $ hg debugexpandscheme foo://expanded |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
314 https://foo.example.org/expanded |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
315 $ hg debugexpandscheme bar://unexpanded |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
316 bar://unexpanded |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
317 |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
318 add bar |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
319 |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
320 $ cat > .hg/hgrc <<'EOF' |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
321 > [extensions] |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
322 > schemes = |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
323 > [schemes] |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
324 > foo = https://foo.example.org/ |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
325 > bar = https://bar.example.org/ |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
326 > EOF |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
327 $ hg debugexpandscheme foo://expanded |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
328 https://foo.example.org/expanded |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
329 $ hg debugexpandscheme bar://expanded |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
330 https://bar.example.org/expanded |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
331 |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
332 remove foo |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
333 |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
334 $ cat > .hg/hgrc <<'EOF' |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
335 > [extensions] |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
336 > schemes = |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
337 > [schemes] |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
338 > bar = https://bar.example.org/ |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
339 > EOF |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
340 $ hg debugexpandscheme foo://unexpanded |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
341 foo://unexpanded |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
342 $ hg debugexpandscheme bar://expanded |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
343 https://bar.example.org/expanded |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
344 |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
345 $ cd .. |
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
346 |
40999
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
347 repository cache |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
348 ---------------- |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
349 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
350 $ rm log/server.log* |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
351 $ cp $HGRCPATH.unconfigured $HGRCPATH |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
352 $ cat <<'EOF' >> $HGRCPATH |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
353 > [cmdserver] |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
354 > log = $TESTTMP/log/server.log |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
355 > max-repo-cache = 1 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
356 > track-log = command, repocache |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
357 > EOF |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
358 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
359 isolate socket directory for stable result: |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
360 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
361 $ OLDCHGSOCKNAME=$CHGSOCKNAME |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
362 $ mkdir chgsock |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
363 $ CHGSOCKNAME=`pwd`/chgsock/server |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
364 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
365 create empty repo and cache it: |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
366 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
367 $ hg init cached |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
368 $ hg id -R cached |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
369 000000000000 tip |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
370 $ sleep 1 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
371 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
372 modify repo (and cache will be invalidated): |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
373 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
374 $ touch cached/a |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
375 $ hg ci -R cached -Am 'add a' |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
376 adding a |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
377 $ sleep 1 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
378 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
379 read cached repo: |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
380 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
381 $ hg log -R cached |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
382 changeset: 0:ac82d8b1f7c4 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
383 tag: tip |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
384 user: test |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
385 date: Thu Jan 01 00:00:00 1970 +0000 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
386 summary: add a |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
387 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
388 $ sleep 1 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
389 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
390 discard cached from LRU cache: |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
391 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
392 $ hg clone cached cached2 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
393 updating to branch default |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
394 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
395 $ hg id -R cached2 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
396 ac82d8b1f7c4 tip |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
397 $ sleep 1 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
398 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
399 read uncached repo: |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
400 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
401 $ hg log -R cached |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
402 changeset: 0:ac82d8b1f7c4 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
403 tag: tip |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
404 user: test |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
405 date: Thu Jan 01 00:00:00 1970 +0000 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
406 summary: add a |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
407 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
408 $ sleep 1 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
409 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
410 shut down servers and restore environment: |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
411 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
412 $ rm -R chgsock |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
413 $ sleep 2 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
414 $ CHGSOCKNAME=$OLDCHGSOCKNAME |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
415 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
416 check server log: |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
417 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
418 $ cat log/server.log | filterlog |
44325
5cd2d91eeebd
chgserver: spawn new process if schemes change
Yuya Nishihara <yuya@tcha.org>
parents:
43860
diff
changeset
|
419 YYYY/MM/DD HH:MM:SS (PID)> worker process exited (pid=...) |
45188
837840018306
tests: make one of 'worker process exited' line option in test-chg.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
45185
diff
changeset
|
420 YYYY/MM/DD HH:MM:SS (PID)> worker process exited (pid=...) (?) |
40999
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
421 YYYY/MM/DD HH:MM:SS (PID)> init cached |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
422 YYYY/MM/DD HH:MM:SS (PID)> id -R cached |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
423 YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in ...s) |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
424 YYYY/MM/DD HH:MM:SS (PID)> repo from cache: $TESTTMP/cached |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
425 YYYY/MM/DD HH:MM:SS (PID)> ci -R cached -Am 'add a' |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
426 YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in ...s) |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
427 YYYY/MM/DD HH:MM:SS (PID)> repo from cache: $TESTTMP/cached |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
428 YYYY/MM/DD HH:MM:SS (PID)> log -R cached |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
429 YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in ...s) |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
430 YYYY/MM/DD HH:MM:SS (PID)> clone cached cached2 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
431 YYYY/MM/DD HH:MM:SS (PID)> id -R cached2 |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
432 YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached2 (in ...s) |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
433 YYYY/MM/DD HH:MM:SS (PID)> log -R cached |
dcac24ec935b
commandserver: preload repository in master server and reuse its file cache
Yuya Nishihara <yuya@tcha.org>
parents:
40998
diff
changeset
|
434 YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in ...s) |
43860
5e0f6451e2d2
chg: fix chg to work with py3.7+ "coercing" the locale
Kyle Lippincott <spectral@google.com>
parents:
43800
diff
changeset
|
435 |
44261
04a3ae7aba14
chg: force-set LC_CTYPE on server start to actual value from the environment
Kyle Lippincott <spectral@google.com>
parents:
43860
diff
changeset
|
436 Test that chg works (sets to the user's actual LC_CTYPE) even when python |
04a3ae7aba14
chg: force-set LC_CTYPE on server start to actual value from the environment
Kyle Lippincott <spectral@google.com>
parents:
43860
diff
changeset
|
437 "coerces" the locale (py3.7+) |
43860
5e0f6451e2d2
chg: fix chg to work with py3.7+ "coercing" the locale
Kyle Lippincott <spectral@google.com>
parents:
43800
diff
changeset
|
438 |
5e0f6451e2d2
chg: fix chg to work with py3.7+ "coercing" the locale
Kyle Lippincott <spectral@google.com>
parents:
43800
diff
changeset
|
439 $ cat > $TESTTMP/debugenv.py <<EOF |
5e0f6451e2d2
chg: fix chg to work with py3.7+ "coercing" the locale
Kyle Lippincott <spectral@google.com>
parents:
43800
diff
changeset
|
440 > from mercurial import encoding |
5e0f6451e2d2
chg: fix chg to work with py3.7+ "coercing" the locale
Kyle Lippincott <spectral@google.com>
parents:
43800
diff
changeset
|
441 > from mercurial import registrar |
5e0f6451e2d2
chg: fix chg to work with py3.7+ "coercing" the locale
Kyle Lippincott <spectral@google.com>
parents:
43800
diff
changeset
|
442 > cmdtable = {} |
5e0f6451e2d2
chg: fix chg to work with py3.7+ "coercing" the locale
Kyle Lippincott <spectral@google.com>
parents:
43800
diff
changeset
|
443 > command = registrar.command(cmdtable) |
5e0f6451e2d2
chg: fix chg to work with py3.7+ "coercing" the locale
Kyle Lippincott <spectral@google.com>
parents:
43800
diff
changeset
|
444 > @command(b'debugenv', [], b'', norepo=True) |
5e0f6451e2d2
chg: fix chg to work with py3.7+ "coercing" the locale
Kyle Lippincott <spectral@google.com>
parents:
43800
diff
changeset
|
445 > def debugenv(ui): |
5e0f6451e2d2
chg: fix chg to work with py3.7+ "coercing" the locale
Kyle Lippincott <spectral@google.com>
parents:
43800
diff
changeset
|
446 > for k in [b'LC_ALL', b'LC_CTYPE', b'LANG']: |
5e0f6451e2d2
chg: fix chg to work with py3.7+ "coercing" the locale
Kyle Lippincott <spectral@google.com>
parents:
43800
diff
changeset
|
447 > v = encoding.environ.get(k) |
5e0f6451e2d2
chg: fix chg to work with py3.7+ "coercing" the locale
Kyle Lippincott <spectral@google.com>
parents:
43800
diff
changeset
|
448 > if v is not None: |
5e0f6451e2d2
chg: fix chg to work with py3.7+ "coercing" the locale
Kyle Lippincott <spectral@google.com>
parents:
43800
diff
changeset
|
449 > ui.write(b'%s=%s\n' % (k, encoding.environ[k])) |
5e0f6451e2d2
chg: fix chg to work with py3.7+ "coercing" the locale
Kyle Lippincott <spectral@google.com>
parents:
43800
diff
changeset
|
450 > EOF |
44261
04a3ae7aba14
chg: force-set LC_CTYPE on server start to actual value from the environment
Kyle Lippincott <spectral@google.com>
parents:
43860
diff
changeset
|
451 (hg keeps python's modified LC_CTYPE, chg doesn't) |
04a3ae7aba14
chg: force-set LC_CTYPE on server start to actual value from the environment
Kyle Lippincott <spectral@google.com>
parents:
43860
diff
changeset
|
452 $ (unset LC_ALL; unset LANG; LC_CTYPE= "$CHGHG" \ |
04a3ae7aba14
chg: force-set LC_CTYPE on server start to actual value from the environment
Kyle Lippincott <spectral@google.com>
parents:
43860
diff
changeset
|
453 > --config extensions.debugenv=$TESTTMP/debugenv.py debugenv) |
04a3ae7aba14
chg: force-set LC_CTYPE on server start to actual value from the environment
Kyle Lippincott <spectral@google.com>
parents:
43860
diff
changeset
|
454 LC_CTYPE=C.UTF-8 (py37 !) |
04a3ae7aba14
chg: force-set LC_CTYPE on server start to actual value from the environment
Kyle Lippincott <spectral@google.com>
parents:
43860
diff
changeset
|
455 LC_CTYPE= (no-py37 !) |
04a3ae7aba14
chg: force-set LC_CTYPE on server start to actual value from the environment
Kyle Lippincott <spectral@google.com>
parents:
43860
diff
changeset
|
456 $ (unset LC_ALL; unset LANG; LC_CTYPE= chg \ |
04a3ae7aba14
chg: force-set LC_CTYPE on server start to actual value from the environment
Kyle Lippincott <spectral@google.com>
parents:
43860
diff
changeset
|
457 > --config extensions.debugenv=$TESTTMP/debugenv.py debugenv) |
04a3ae7aba14
chg: force-set LC_CTYPE on server start to actual value from the environment
Kyle Lippincott <spectral@google.com>
parents:
43860
diff
changeset
|
458 LC_CTYPE= |
04a3ae7aba14
chg: force-set LC_CTYPE on server start to actual value from the environment
Kyle Lippincott <spectral@google.com>
parents:
43860
diff
changeset
|
459 $ (unset LC_ALL; unset LANG; LC_CTYPE=unsupported_value chg \ |
04a3ae7aba14
chg: force-set LC_CTYPE on server start to actual value from the environment
Kyle Lippincott <spectral@google.com>
parents:
43860
diff
changeset
|
460 > --config extensions.debugenv=$TESTTMP/debugenv.py debugenv) |
04a3ae7aba14
chg: force-set LC_CTYPE on server start to actual value from the environment
Kyle Lippincott <spectral@google.com>
parents:
43860
diff
changeset
|
461 LC_CTYPE=unsupported_value |
04a3ae7aba14
chg: force-set LC_CTYPE on server start to actual value from the environment
Kyle Lippincott <spectral@google.com>
parents:
43860
diff
changeset
|
462 $ (unset LC_ALL; unset LANG; LC_CTYPE= chg \ |
04a3ae7aba14
chg: force-set LC_CTYPE on server start to actual value from the environment
Kyle Lippincott <spectral@google.com>
parents:
43860
diff
changeset
|
463 > --config extensions.debugenv=$TESTTMP/debugenv.py debugenv) |
04a3ae7aba14
chg: force-set LC_CTYPE on server start to actual value from the environment
Kyle Lippincott <spectral@google.com>
parents:
43860
diff
changeset
|
464 LC_CTYPE= |
43860
5e0f6451e2d2
chg: fix chg to work with py3.7+ "coercing" the locale
Kyle Lippincott <spectral@google.com>
parents:
43800
diff
changeset
|
465 $ LANG= LC_ALL= LC_CTYPE= chg \ |
5e0f6451e2d2
chg: fix chg to work with py3.7+ "coercing" the locale
Kyle Lippincott <spectral@google.com>
parents:
43800
diff
changeset
|
466 > --config extensions.debugenv=$TESTTMP/debugenv.py debugenv |
5e0f6451e2d2
chg: fix chg to work with py3.7+ "coercing" the locale
Kyle Lippincott <spectral@google.com>
parents:
43800
diff
changeset
|
467 LC_ALL= |
44261
04a3ae7aba14
chg: force-set LC_CTYPE on server start to actual value from the environment
Kyle Lippincott <spectral@google.com>
parents:
43860
diff
changeset
|
468 LC_CTYPE= |
43860
5e0f6451e2d2
chg: fix chg to work with py3.7+ "coercing" the locale
Kyle Lippincott <spectral@google.com>
parents:
43800
diff
changeset
|
469 LANG= |