comparison tests/basic.t @ 37:cf3fe04cd96b

Initial work on testing
author Marcin Kasperski <Marcin.Kasperski@mekk.waw.pl>
date Sat, 24 Sep 2016 15:51:58 +0200
parents
children f371747bb8fc
comparison
equal deleted inserted replaced
36:c27e23a3509c 37:cf3fe04cd96b
1
2 Let's test all_paths operations.
3
4 Some locations used during testing:
5
6 $ WORK_DIR=${WORK_DIR-`pwd`/work}
7 $ rm -rf $WORK_DIR
8
9 $ export BASE=$WORK_DIR/base
10 $ export REP1=$WORK_DIR/rep1
11 $ export REP2=$WORK_DIR/rep2
12 $ export REP3=$WORK_DIR/rep3
13
14 First we need appropriate Mercurial configuration file (and variable
15 which ensures it is used).
16
17 $ export HGRCPATH=$WORK_DIR/hgrc
18 $ mkdir -p $HGRCPATH
19
20 $ cat > $HGRCPATH/basic.rc << EOF
21 > [ui]
22 > username = Andy Default <default@nowhere.net>
23 > [extensions]
24 > all_paths =
25 > EOF
26
27 We need some repositories to test.
28
29 $ hg init "$BASE"
30 $ hg init "$REP1"
31 $ hg init "$REP2"
32 $ hg init "$REP3"
33
34 $ cat > $BASE/.hg/hgrc
35 > [paths]
36 > remote1=$REP1
37 > remote2=$REP2
38 > remote3=$REP3
39 > EOF
40
41 Let's test pushing
42
43 $ echo > $BASE/file.txt
44 > Some text
45 > EOF
46
47 $ hg --cwd $BASE add
48 $ hg --cwd $BASE commit -m 'First'
49
50 $ hg --cwd $BASE pushall
51
52 $ hg --cwd $REP1 log
53
54 $ hg --cwd $REP2 log
55
56 $ hg --cwd $REP3 log
57
58 Let's also test pulling
59
60 $ hg --cwd $REP1 update
61
62 $ echo > $REP1/rep1.txt
63 > Another text
64 > EOF
65
66 $ hg --cwd $REP1 add
67 $ hg --cwd $REP1 commit -m "In repo1"
68
69
70 $ hg --cwd $REP2 update
71
72 $ echo >> $REP2/file.txt
73 > From repo2…
74 > EOF
75
76 $ hg --cwd $REP2 add
77 $ hg --cwd $REP2 commit -m "In repo2"
78
79 $ hg --cwd $BASE incomingall
80
81 $ hg --cwd $BASE pullall
82
83 $ hg --cwd $BASE log
84
85 $ hg --cwd $BASE outgoingall
86
87 Without remotes those commands do nothing
88
89 $ hg --cwd $REP3 pullall
90
91 $ hg --cwd $REP3 pushall
92
93 $ hg --cwd $REP3 incomingall
94
95 $ hg --cwd $REP3 outgoingall
96
97 Finally let's test that push options work
98
99 $ echo > $BASE/br1.txt
100 > Br1 text
101 > EOF
102
103 $ hg --cwd $BASE branch br1
104 $ hg --cwd $BASE add
105 $ hg --cwd $BASE commit -m 'Br1'
106
107 $ hg --cwd $BASE update default
108 $ echo >> $BASE/file.txt
109 > later text
110 > EOF
111 $ hg --cwd $BASE commit -m 'Normal''
112
113 $ hg --cwd $BASE pushall -r default -f
114
115 $ hg --cwd $REP1 log
116
117 $ hg --cwd $REP2 log
118
119 $ hg --cwd $REP3 log
120