Debian Codegraph @

tests/test-narrow-clone-non-narrow-server.t

raw
1 Test attempting a narrow clone against a server that doesn't support narrowhg.
2
3 $ . "$TESTDIR/narrow-library.sh"
4
5 $ hg init master
6 $ cd master
7
8 $ for x in `$TESTDIR/seq.py 10`; do
9 > echo $x > "f$x"
10 > hg add "f$x"
11 > hg commit -m "Add $x"
12 > done
13
14 $ hg serve -a localhost -p $HGPORT1 --config extensions.narrow=! -d \
15 > --pid-file=hg.pid
16 $ cat hg.pid >> "$DAEMON_PIDS"
17 $ hg serve -a localhost -p $HGPORT2 -d --pid-file=hg.pid
18 $ cat hg.pid >> "$DAEMON_PIDS"
19
20 Verify that narrow is advertised in the bundle2 capabilities:
21
22 $ cat >> unquote.py <<EOF
23 > import sys
24 > if sys.version[0] == '3':
25 > import urllib.parse as up
26 > unquote = up.unquote_plus
27 > else:
28 > import urllib
29 > unquote = urllib.unquote_plus
30 > print(unquote(list(sys.stdin)[1]))
31 > EOF
32 $ echo hello | hg -R . serve --stdio | \
33 > "$PYTHON" unquote.py | tr ' ' '\n' | grep narrow
34 exp-narrow-1
35
36 $ cd ..
37
38 $ hg clone --narrow --include f1 http://localhost:$HGPORT1/ narrowclone
39 requesting all changes
40 abort: server does not support narrow clones
41 [255]
42
43 Make a narrow clone (via HGPORT2), then try to narrow and widen
44 into it (from HGPORT1) to prove that narrowing is fine and widening fails
45 gracefully:
46 $ hg clone -r 0 --narrow --include f1 http://localhost:$HGPORT2/ narrowclone
47 adding changesets
48 adding manifests
49 adding file changes
50 added 1 changesets with 1 changes to 1 files
51 new changesets * (glob)
52 updating to branch default
53 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
54 $ cd narrowclone
55 $ hg tracked --addexclude f2 http://localhost:$HGPORT1/
56 comparing with http://localhost:$HGPORT1/
57 searching for changes
58 looking for local changes to affected paths
59 deleting unwanted files from working copy
60
61 $ hg tracked --addinclude f1 http://localhost:$HGPORT1/
62 nothing to widen or narrow
63
64 $ hg tracked --addinclude f9 http://localhost:$HGPORT1/
65 comparing with http://localhost:$HGPORT1/
66 abort: server does not support narrow clones
67 [255]