Mercurial > hg
annotate tests/test-http-branchmap.t @ 42415:c767e655ffda
narrow: use narrow_widen wireproto command to widen in case of ellipses
Few releases ago, we introduce narrow_widen wireproto command to be used to widen
narrow repositories. Before this patch, that was used in non-ellipses cases
only. In ellipses cases, we still do exchange.pull() which can pull more data
than required.
After this patch, the client will first check whether server supports doing
ellipses widening using wireproto command or not by checking server's wireproto
capability. If the server is upto date and support latest ellipses capability,
we call the wireproto command. Otherwise we fallback to exchange.pull() like
before.
The compat code make sure that things works even if one of the client or server
is old. The initial version of this patch does not had this compat code. It's
added to help Google release things smoothly internally. I plan to drop the
compat code before the upcoming major release.
Due to change to wireproto command, the code looks a bit dirty, next patches
will clean that up.
Differential Revision: https://phab.mercurial-scm.org/D6436
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 22 May 2019 02:59:48 +0530 |
parents | 37ef6ee87488 |
children |
rev | line source |
---|---|
12447
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
1 $ hgserve() { |
17467
448d0c452140
test-http-branchmap: enable on Windows
Patrick Mezard <patrick@mezard.eu>
parents:
15623
diff
changeset
|
2 > hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid \ |
448d0c452140
test-http-branchmap: enable on Windows
Patrick Mezard <patrick@mezard.eu>
parents:
15623
diff
changeset
|
3 > -E errors.log -v $@ > startup.log |
448d0c452140
test-http-branchmap: enable on Windows
Patrick Mezard <patrick@mezard.eu>
parents:
15623
diff
changeset
|
4 > # Grepping hg serve stdout would hang on Windows |
448d0c452140
test-http-branchmap: enable on Windows
Patrick Mezard <patrick@mezard.eu>
parents:
15623
diff
changeset
|
5 > grep -v 'listening at' startup.log |
12447
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
6 > cat hg.pid >> "$DAEMON_PIDS" |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
7 > } |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
8 $ hg init a |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
9 $ hg --encoding utf-8 -R a branch æ |
12942
05fffd665170
tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents:
12700
diff
changeset
|
10 marked working directory as branch \xc3\xa6 (esc) |
15615 | 11 (branches are permanent and global, did you want a bookmark?) |
12447
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
12 $ echo foo > a/foo |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
13 $ hg -R a ci -Am foo |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
14 adding foo |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
15 $ hgserve -R a --config web.push_ssl=False --config web.allow_push=* --encoding latin1 |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
16 $ hg --encoding utf-8 clone http://localhost:$HGPORT1 b |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
17 requesting all changes |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
18 adding changesets |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
19 adding manifests |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
20 adding file changes |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
21 added 1 changesets with 1 changes to 1 files |
34661
eb586ed5d8ce
transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
33335
diff
changeset
|
22 new changesets 867c11ce77b8 |
12942
05fffd665170
tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents:
12700
diff
changeset
|
23 updating to branch \xc3\xa6 (esc) |
12447
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
24 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
25 $ hg --encoding utf-8 -R b log |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
26 changeset: 0:867c11ce77b8 |
12942
05fffd665170
tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents:
12700
diff
changeset
|
27 branch: \xc3\xa6 (esc) |
12447
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
28 tag: tip |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
29 user: test |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
30 date: Thu Jan 01 00:00:00 1970 +0000 |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
31 summary: foo |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
32 |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
33 $ echo bar >> b/foo |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
34 $ hg -R b ci -m bar |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
35 $ hg --encoding utf-8 -R b push |
13815
d066d8d652c8
url: add trailing slashes to URLs with hostnames that don't have one
Brodie Rao <brodie@bitheap.org>
parents:
12942
diff
changeset
|
36 pushing to http://localhost:$HGPORT1/ |
12447
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
37 searching for changes |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
38 remote: adding changesets |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
39 remote: adding manifests |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
40 remote: adding file changes |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
41 remote: added 1 changesets with 1 changes to 1 files |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
42 $ hg -R a --encoding utf-8 log |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
43 changeset: 1:58e7c90d67cb |
12942
05fffd665170
tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents:
12700
diff
changeset
|
44 branch: \xc3\xa6 (esc) |
12447
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
45 tag: tip |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
46 user: test |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
47 date: Thu Jan 01 00:00:00 1970 +0000 |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
48 summary: bar |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
49 |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
50 changeset: 0:867c11ce77b8 |
12942
05fffd665170
tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents:
12700
diff
changeset
|
51 branch: \xc3\xa6 (esc) |
12447
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
52 user: test |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
53 date: Thu Jan 01 00:00:00 1970 +0000 |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
54 summary: foo |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
55 |
25472
4d2b9b304ad0
tests: drop explicit $TESTDIR from executables
Matt Mackall <mpm@selenic.com>
parents:
22046
diff
changeset
|
56 $ killdaemons.py hg.pid |
9879
7bb004fc14ec
Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents:
9789
diff
changeset
|
57 |
12447
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
58 verify 7e7d56fe4833 (encoding fallback in branchmap to maintain compatibility with 1.3.x) |
9879
7bb004fc14ec
Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents:
9789
diff
changeset
|
59 |
12447
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
60 $ cat <<EOF > oldhg |
38030
69779a222d5e
test-http-branchmap: fix encoding test to wrap the server stream
Yuya Nishihara <yuya@tcha.org>
parents:
37845
diff
changeset
|
61 > import threading |
38031
37ef6ee87488
test-http-branchmap: fix stdio mode on Windows
Yuya Nishihara <yuya@tcha.org>
parents:
38030
diff
changeset
|
62 > from mercurial import dispatch, hg, ui, wireprotoserver |
12447
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
63 > |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
64 > class StdoutWrapper(object): |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
65 > def __init__(self, stdout): |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
66 > self._file = stdout |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
67 > |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
68 > def write(self, data): |
36279
1e0c9f9f6f36
tests: port inline Python in test-http-branchmap.t to Python 3
Augie Fackler <augie@google.com>
parents:
34661
diff
changeset
|
69 > if data == b'47\n': |
12447
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
70 > # latin1 encoding is one %xx (3 bytes) shorter |
36279
1e0c9f9f6f36
tests: port inline Python in test-http-branchmap.t to Python 3
Augie Fackler <augie@google.com>
parents:
34661
diff
changeset
|
71 > data = b'44\n' |
1e0c9f9f6f36
tests: port inline Python in test-http-branchmap.t to Python 3
Augie Fackler <augie@google.com>
parents:
34661
diff
changeset
|
72 > elif data.startswith(b'%C3%A6 '): |
12447
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
73 > # translate to latin1 encoding |
36279
1e0c9f9f6f36
tests: port inline Python in test-http-branchmap.t to Python 3
Augie Fackler <augie@google.com>
parents:
34661
diff
changeset
|
74 > data = b'%%E6 %s' % data[7:] |
12447
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
75 > self._file.write(data) |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
76 > |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
77 > def __getattr__(self, name): |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
78 > return getattr(self._file, name) |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
79 > |
38031
37ef6ee87488
test-http-branchmap: fix stdio mode on Windows
Yuya Nishihara <yuya@tcha.org>
parents:
38030
diff
changeset
|
80 > dispatch.initstdio() |
30559
d83ca854fa21
ui: factor out ui.load() to create a ui without loading configs (API)
Yuya Nishihara <yuya@tcha.org>
parents:
25472
diff
changeset
|
81 > myui = ui.ui.load() |
38030
69779a222d5e
test-http-branchmap: fix encoding test to wrap the server stream
Yuya Nishihara <yuya@tcha.org>
parents:
37845
diff
changeset
|
82 > fout = StdoutWrapper(myui.fout) |
69779a222d5e
test-http-branchmap: fix encoding test to wrap the server stream
Yuya Nishihara <yuya@tcha.org>
parents:
37845
diff
changeset
|
83 > myui.fout = myui.ferr |
36279
1e0c9f9f6f36
tests: port inline Python in test-http-branchmap.t to Python 3
Augie Fackler <augie@google.com>
parents:
34661
diff
changeset
|
84 > repo = hg.repository(myui, b'a') |
38030
69779a222d5e
test-http-branchmap: fix encoding test to wrap the server stream
Yuya Nishihara <yuya@tcha.org>
parents:
37845
diff
changeset
|
85 > wireprotoserver._runsshserver(myui, repo, myui.fin, fout, threading.Event()) |
12447
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
86 > EOF |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
87 $ echo baz >> b/foo |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
88 $ hg -R b ci -m baz |
33335
72f051f9a7d8
tests: quote $PYTHON for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
33286
diff
changeset
|
89 $ hg push -R b -e "\"$PYTHON\" oldhg" ssh://dummy/ --encoding latin1 |
12447
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
90 pushing to ssh://dummy/ |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
91 searching for changes |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
92 remote: adding changesets |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
93 remote: adding manifests |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
94 remote: adding file changes |
f5f90d3808e2
tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents:
11617
diff
changeset
|
95 remote: added 1 changesets with 1 changes to 1 files |