Debian Codegraph @

tests/test-pull-http.t

raw
1 #if no-windows
2 For debugging: this is a pretty simple test that is a good candidate
3 for tracking down network-related bugs. Sometimes a command in this
4 hangs, so having showstack pre-loaded is sometimes helpful. This also
5 gives us a test that at least proves showstack can be loaded.
6 $ cat >> $HGRCPATH <<EOF
7 > [extensions]
8 > showstack = $TESTDIR/../contrib/showstack.py
9 > EOF
10 #endif
11
12 $ hg init test
13 $ cd test
14 $ echo a > a
15 $ hg ci -Ama
16 adding a
17 $ cd ..
18 $ hg clone test test2
19 updating to branch default
20 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
21 $ cd test2
22 $ echo a >> a
23 $ hg ci -mb
24
25 Cloning with a password in the URL should not save the password in .hg/hgrc:
26
27 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
28 $ cat hg.pid >> $DAEMON_PIDS
29 $ hg clone http://foo:xyzzy@localhost:$HGPORT/ test3
30 requesting all changes
31 adding changesets
32 adding manifests
33 adding file changes
34 added 2 changesets with 2 changes to 1 files
35 new changesets cb9a9f314b8b:ba677d0156c1
36 updating to branch default
37 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 $ cat test3/.hg/hgrc
39 # example repository config (see 'hg help config' for more info)
40 [paths]
41 default = http://foo@localhost:$HGPORT/
42
43 # path aliases to other clones of this repo in URLs or filesystem paths
44 # (see 'hg help config.paths' for more info)
45 #
46 # default:pushurl = ssh://[email protected]/hg/jdoes-fork
47 # my-fork = ssh://[email protected]/hg/jdoes-fork
48 # my-clone = /home/jdoe/jdoes-clone
49
50 [ui]
51 # name and email (local to this repository, optional), e.g.
52 # username = Jane Doe <[email protected]>
53 $ killdaemons.py
54
55 expect error, cloning not allowed
56
57 $ echo '[web]' > .hg/hgrc
58 $ echo 'allowpull = false' >> .hg/hgrc
59 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
60 $ cat hg.pid >> $DAEMON_PIDS
61 $ hg clone http://localhost:$HGPORT/ test4 # bundle2+
62 abort: authorization failed
63 [255]
64 $ hg clone http://localhost:$HGPORT/ test4 --config devel.legacy.exchange=bundle1
65 abort: authorization failed
66 [255]
67 $ killdaemons.py
68
69 serve errors
70
71 $ cat errors.log
72 $ req() {
73 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
74 > cat hg.pid >> $DAEMON_PIDS
75 > hg --cwd ../test pull http://localhost:$HGPORT/
76 > killdaemons.py hg.pid
77 > echo % serve errors
78 > cat errors.log
79 > }
80
81 expect error, pulling not allowed
82
83 $ req
84 pulling from http://localhost:$HGPORT/
85 abort: authorization failed
86 % serve errors
87
88 $ cd ..