comparison tests/facing_problems.t @ 43:a1fb32ff4532

Further work on tests
author Marcin Kasperski <Marcin.Kasperski@mekk.waw.pl>
date Sat, 24 Sep 2016 23:31:49 +0200
parents cf3fe04cd96b
children 2d6c7e0c1b2f
comparison
equal deleted inserted replaced
42:7b4bc975644c 43:a1fb32ff4532
1 1
2 TODO: test when some repo raises errors (is missing, unrelated etc) 2 Let's test behaviour when there are problems - some repo is missing,
3 another is unrelated.
4
5 Some locations used during testing:
6
7 $ WORK_DIR=${WORK_DIR-`pwd`/work}
8 $ rm -rf $WORK_DIR
9
10 $ export BASE=$WORK_DIR/base
11 $ export GOOD1=$WORK_DIR/good1
12 $ export UNREL=$WORK_DIR/unrelated
13 $ export MISSING=$WORK_DIR/missing
14 $ export GOOD2=$WORK_DIR/good2
15
16 First we need appropriate Mercurial configuration file (and variable
17 which ensures it is used).
18
19 $ export HGRCPATH=$WORK_DIR/hgrc
20 $ mkdir -p $HGRCPATH
21
22 $ cat > $HGRCPATH/basic.rc << EOF
23 > [ui]
24 > username = Andy Default <default@nowhere.net>
25 > [extensions]
26 > mercurial_all_paths =
27 > EOF
28
29 We need some repositories to test.
30
31 $ hg init "$BASE"
32 $ hg init "$GOOD1"
33 $ hg init "$UNREL"
34 $ hg init "$GOOD2"
35
36 $ cat > $BASE/.hg/hgrc << EOF
37 > [paths]
38 > good1=$GOOD1
39 > unrel=$UNREL
40 > missing=$MISSING
41 > good2=$GOOD2
42 > EOF
43
44 $ cat > $UNREL/something.txt << EOF
45 > This gonnna be unrelated.
46 > EOF
47 $ hg --cwd $UNREL add
48 adding something.txt
49 $ hg --cwd $UNREL commit -m "Unrelated"
50
51 Let's test pushing
52
53 $ cat > $BASE/file.txt << EOF
54 > Some text
55 > EOF
56 $ hg --cwd $BASE add
57 adding file.txt
58 $ hg --cwd $BASE commit -m 'First'
59
60 $ hg --cwd $BASE pushall
61 pushing to */good1 (glob)
62 searching for changes
63 adding changesets
64 adding manifests
65 adding file changes
66 added 1 changesets with 1 changes to 1 files
67 pushing to */unrelated (glob)
68 searching for changes
69 abort: repository is unrelated
70 [255]
71
72 $ hg --cwd $GOOD1 log -T '{rev}: {desc}\n'
73 0: First
74
75 $ hg --cwd $GOOD2 log -T '{rev}: {desc}\n'
76 0: First
77
78 $ hg --cwd $UNREL log -T '{rev}: {desc}\n'
79 0: Unrelated
80
81 Let's also test pulling
82
83 $ hg --cwd $GOOD1 update
84 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
85 $ cat > $GOOD1/rep1.txt << EOF
86 > Another text
87 > EOF
88 $ hg --cwd $GOOD1 add
89 adding rep1.txt
90 $ hg --cwd $GOOD1 commit -m "In repo1"
91
92 $ hg --cwd $UNREL update
93 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
94 $ cat > $UNREL/unr.txt << EOF
95 > Another text
96 > EOF
97 $ hg --cwd $UNREL add
98 adding unr.txt
99 $ hg --cwd $UNREL commit -m "In unrel"
100
101 $ hg --cwd $GOOD2 update
102 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
103 $ cat > $GOOD2/rep1.txt << EOF
104 > Another text
105 > EOF
106 $ hg --cwd $GOOD2 add
107 adding rep1.txt
108 $ hg --cwd $GOOD2 commit -m "In good2"
109
110 $ hg --cwd $BASE incomingall
111 comparing with */rep1 (glob)
112 searching for changes
113 changeset: 1:* (glob)
114 tag: tip
115 user: Andy Default <default@nowhere.net>
116 date: .* (re)
117 summary: In repo1
118
119 comparing with */rep2 (glob)
120 searching for changes
121 changeset: 1:* (glob)
122 tag: tip
123 user: Andy Default <default@nowhere.net>
124 date: .* (re)
125 summary: In repo2
126
127 $ hg --cwd $BASE pullall
128
129 $ hg --cwd $BASE log -T '{rev}: {desc}\n'