annotate tests/test-evolve-serveronly-legacy.t @ 5917:94aed9c7ce69 stable

next: refactor two if blocks into an if-elif block We already checked the value of `needevolve and opts['evolve']` in the first if block above. In the first one it need to be True, in the second it needs to be False for the statements to execute. Since not(a or b) = not a and not b, we can join the second if block to the first one with an elif while dropping the explicit check. For me, this works better, because we're doing the same thing in both of these blocks (checking if working copy is dirty or not).
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 15 May 2021 20:40:19 +0800
parents a1dad44fe3da
children fd039a7f0c3c b1a2cfde69d3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2046
994d81caec68 test: update test to check for various way to import the serveronly things
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1838
diff changeset
1
994d81caec68 test: update test to check for various way to import the serveronly things
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1838
diff changeset
2 $ . ${TESTDIR}/testlib/pythonpath.sh
881
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
3
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
4 $ cat >> $HGRCPATH <<EOF
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
5 > [web]
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
6 > push_ssl = false
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
7 > allow_push = *
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
8 > [phases]
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
9 > publish = False
1356
aff6bc2a6b2d test: adapt to change in mercurial core
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1248
diff changeset
10 > [experimental]
1721
d3429d25e0cb test: also use 'devel.legacy.exchange=bundle1' in test
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1522
diff changeset
11 > bundle2-exp=False # < Mercurial-4.0
d3429d25e0cb test: also use 'devel.legacy.exchange=bundle1' in test
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1522
diff changeset
12 > [devel]
d3429d25e0cb test: also use 'devel.legacy.exchange=bundle1' in test
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1522
diff changeset
13 > legacy.exchange=bundle1
881
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
14 > [extensions]
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
15 > EOF
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
16
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
17 $ mkcommit() {
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
18 > echo "$1" > "$1"
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
19 > hg add "$1"
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
20 > hg ci -m "add $1"
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
21 > }
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
22
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
23
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
24 $ hg init server
2046
994d81caec68 test: update test to check for various way to import the serveronly things
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1838
diff changeset
25
994d81caec68 test: update test to check for various way to import the serveronly things
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1838
diff changeset
26 Try the multiple ways to setup the extension
994d81caec68 test: update test to check for various way to import the serveronly things
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1838
diff changeset
27
994d81caec68 test: update test to check for various way to import the serveronly things
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1838
diff changeset
28 $ hg -R server log --config 'extensions.evolve.serveronly='
994d81caec68 test: update test to check for various way to import the serveronly things
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1838
diff changeset
29 $ hg -R server log --config "extensions.evolve.serveronly=${SRCDIR}/hgext3rd/evolve/serveronly.py"
994d81caec68 test: update test to check for various way to import the serveronly things
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1838
diff changeset
30 $ PYTHONPATH=$HGTEST_ORIG_PYTHONPATH hg -R server log --config "extensions.evolve.serveronly=${SRCDIR}/hgext3rd/evolve/serveronly.py"
994d81caec68 test: update test to check for various way to import the serveronly things
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1838
diff changeset
31
994d81caec68 test: update test to check for various way to import the serveronly things
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1838
diff changeset
32 setup repo
994d81caec68 test: update test to check for various way to import the serveronly things
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1838
diff changeset
33
881
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
34 $ echo "[extensions]" >> ./server/.hg/hgrc
2046
994d81caec68 test: update test to check for various way to import the serveronly things
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1838
diff changeset
35 $ echo "evolve.serveronly=" >> ./server/.hg/hgrc
994d81caec68 test: update test to check for various way to import the serveronly things
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1838
diff changeset
36 $ hg serve -R server -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log --traceback
881
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
37 $ cat hg.pid >> $DAEMON_PIDS
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
38
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
39 $ hg clone http://localhost:$HGPORT/ client
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
40 no changes found
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
41 updating to branch default
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
42 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1087
82873af0cf10 test-simple4server: add error output for http
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1042
diff changeset
43 $ cat ./errors.log
881
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
44 $ echo "[extensions]" >> ./client/.hg/hgrc
2046
994d81caec68 test: update test to check for various way to import the serveronly things
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1838
diff changeset
45 $ echo "evolve=" >> ./client/.hg/hgrc
881
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
46 $ cp -r client other
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
47
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
48 Smoke testing
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
49 ===============
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
50
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
51 $ cd client
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
52 $ mkcommit 0
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
53 $ mkcommit a
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
54 $ hg push
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
55 pushing to http://localhost:$HGPORT/
380aa41a53a5 export: add test for simple4server
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
56 searching for changes
3149
79a926b557f1 compat: drop support for older exchange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3075
diff changeset
57 abort: remote error:
79a926b557f1 compat: drop support for older exchange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3075
diff changeset
58 incompatible Mercurial client; bundle2 required
79a926b557f1 compat: drop support for older exchange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3075
diff changeset
59 (see https://www.mercurial-scm.org/wiki/IncompatibleClient)
5666
e5d91fd1f319 tests: update with more detailed exit codes
Martin von Zweigbergk <martinvonz@google.com>
parents: 3149
diff changeset
60 [100]
1087
82873af0cf10 test-simple4server: add error output for http
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1042
diff changeset
61 $ cat ../errors.log