comparison tests/test-narrow-clone-non-narrow-server.t @ 36079:a2a6e724d61a

narrow: import experimental extension from narrowhg revision cb51d673e9c5 Adjustments: * renamed src to hgext/narrow * marked extension experimental * added correct copyright header where it was missing * updated hgrc extension enable line in library.sh * renamed library.sh to narrow-library.sh * dropped all files from repo root as they're not interesting * dropped test-pyflakes.t, test-check-code.t and test-check-py3-compat.t * renamed remaining tests to all be test-narrow-* when they didn't already * fixed test-narrow-expanddirstate.t to refer to narrow and not narrowhg * fixed tests that wanted `update -C .` instead of `merge --abort` * corrected a two-space indent in narrowspec.py * added a missing _() in narrowcommands.py * fixed imports to pass the import checker * narrow only adds its --include and --exclude to clone if sparse isn't enabled to avoid breaking test-duplicateoptions.py. This is a kludge, and we'll need to come up with a better solution in the future. These were more or less the minimum to import something that would pass tests and not create a bunch of files we'll never use. Changes I intend to make as followups: * rework the test-narrow-*-tree.t tests to use the new testcases functionality in run-tests.py * remove lots of monkeypatches of core things Differential Revision: https://phab.mercurial-scm.org/D1974
author Augie Fackler <augie@google.com>
date Mon, 29 Jan 2018 16:19:33 -0500
parents
children 54e2abc73686
comparison
equal deleted inserted replaced
36078:7f68235f23ff 36079:a2a6e724d61a
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 $ echo capabilities | hg -R . serve --stdio | \
22 > python -c "import sys, urllib; print urllib.unquote_plus(list(sys.stdin)[1])" | grep narrow
23 narrow=v0
24
25 $ cd ..
26
27 $ hg clone --narrow --include f1 http://localhost:$HGPORT1/ narrowclone
28 requesting all changes
29 abort: server doesn't support narrow clones
30 [255]
31
32 Make a narrow clone (via HGPORT2), then try to narrow and widen
33 into it (from HGPORT1) to prove that narrowing is fine and widening fails
34 gracefully:
35 $ hg clone -r 0 --narrow --include f1 http://localhost:$HGPORT2/ narrowclone
36 adding changesets
37 adding manifests
38 adding file changes
39 added 1 changesets with 1 changes to 1 files
40 new changesets * (glob)
41 updating to branch default
42 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 $ cd narrowclone
44 $ hg tracked --addexclude f2 http://localhost:$HGPORT1/
45 comparing with http://localhost:$HGPORT1/
46 searching for changes
47 looking for local changes to affected paths
48 $ hg tracked --addinclude f1 http://localhost:$HGPORT1/
49 comparing with http://localhost:$HGPORT1/
50 searching for changes
51 no changes found
52 abort: server doesn't support narrow clones
53 [255]