Debian Codegraph @

tests/test-pull-r.t

raw
1 $ cat <<EOF >> $HGRCPATH
2 > [ui]
3 > interactive = true
4 > EOF
5
6
7 $ hg init repo
8 $ cd repo
9 $ echo foo > foo
10 $ hg ci -qAm 'add foo'
11 $ echo >> foo
12 $ hg ci -m 'change foo'
13 $ hg up -qC 0
14 $ echo bar > bar
15 $ hg ci -qAm 'add bar'
16
17 $ hg log
18 changeset: 2:effea6de0384
19 tag: tip
20 parent: 0:bbd179dfa0a7
21 user: test
22 date: Thu Jan 01 00:00:00 1970 +0000
23 summary: add bar
24
25 changeset: 1:ed1b79f46b9a
26 user: test
27 date: Thu Jan 01 00:00:00 1970 +0000
28 summary: change foo
29
30 changeset: 0:bbd179dfa0a7
31 user: test
32 date: Thu Jan 01 00:00:00 1970 +0000
33 summary: add foo
34
35 $ cd ..
36
37 don't show "(+1 heads)" message when pulling closed head
38
39 $ hg clone -q repo repo2
40 $ hg clone -q repo2 repo3
41 $ cd repo2
42 $ hg up -q 0
43 $ echo hello >> foo
44 $ hg ci -mx1
45 created new head
46 $ hg ci -mx2 --close-branch
47 $ cd ../repo3
48 $ hg heads -q --closed
49 2:effea6de0384
50 1:ed1b79f46b9a
51 $ hg pull --confirm << EOF
52 > n
53 > EOF
54 pulling from $TESTTMP/repo2
55 searching for changes
56 adding changesets
57 adding manifests
58 adding file changes
59 adding 2 changesets with 1 changes to 1 files
60 new changesets 8c900227dd5d:00cfe9073916
61 accept incoming changes (yn)? n
62 transaction abort!
63 rollback completed
64 abort: user aborted
65 [255]
66 $ hg pull --config pull.confirm=true << EOF
67 > n
68 > EOF
69 pulling from $TESTTMP/repo2
70 searching for changes
71 adding changesets
72 adding manifests
73 adding file changes
74 adding 2 changesets with 1 changes to 1 files
75 new changesets 8c900227dd5d:00cfe9073916
76 accept incoming changes (yn)? n
77 transaction abort!
78 rollback completed
79 abort: user aborted
80 [255]
81 $ hg pull --confirm << EOF
82 > y
83 > EOF
84 pulling from $TESTTMP/repo2
85 searching for changes
86 adding changesets
87 adding manifests
88 adding file changes
89 adding 2 changesets with 1 changes to 1 files
90 new changesets 8c900227dd5d:00cfe9073916
91 accept incoming changes (yn)? y
92 added 2 changesets with 1 changes to 1 files
93 new changesets 8c900227dd5d:00cfe9073916
94 (run 'hg update' to get a working copy)
95 $ hg heads -q --closed
96 4:00cfe9073916
97 2:effea6de0384
98 1:ed1b79f46b9a
99
100 pull--confirm config option should be ignored if HGPLAIN is set
101 $ HGPLAIN=1 hg pull --config pull.confirm=True
102 pulling from $TESTTMP/repo2
103 searching for changes
104 no changes found
105
106 $ cd ..
107
108 $ hg init copy
109 $ cd copy
110
111 Pull a missing revision:
112
113 $ hg pull -qr missing ../repo
114 abort: unknown revision 'missing'
115 [10]
116
117 Pull multiple revisions with update:
118
119 $ hg pull -qu -r 0 -r 1 ../repo
120 $ hg -q parents
121 0:bbd179dfa0a7
122 $ hg rollback
123 repository tip rolled back to revision -1 (undo pull)
124 working directory now based on revision -1
125
126 $ hg pull -qr 0 ../repo
127 $ hg log
128 changeset: 0:bbd179dfa0a7
129 tag: tip
130 user: test
131 date: Thu Jan 01 00:00:00 1970 +0000
132 summary: add foo
133
134 $ hg pull -qr 1 ../repo
135 $ hg log
136 changeset: 1:ed1b79f46b9a
137 tag: tip
138 user: test
139 date: Thu Jan 01 00:00:00 1970 +0000
140 summary: change foo
141
142 changeset: 0:bbd179dfa0a7
143 user: test
144 date: Thu Jan 01 00:00:00 1970 +0000
145 summary: add foo
146
147
148 This used to abort: received changelog group is empty:
149
150 $ hg pull -qr 1 ../repo
151
152 Test race condition with -r and -U (issue4707)
153
154 We pull '-U -r <name>' and the name change right after/during the changegroup emission.
155 We use http because http is better is our racy-est option.
156
157
158 $ echo babar > ../repo/jungle
159 $ cat <<EOF > ../repo/.hg/hgrc
160 > [hooks]
161 > outgoing.makecommit = hg ci -Am 'racy commit'; echo committed in pull-race
162 > EOF
163 $ hg serve -R ../repo -p $HGPORT2 -d --pid-file=../repo.pid
164 $ cat ../repo.pid >> $DAEMON_PIDS
165 $ hg pull --rev default --update http://localhost:$HGPORT2/
166 pulling from http://localhost:$HGPORT2/
167 searching for changes
168 adding changesets
169 adding manifests
170 adding file changes
171 added 1 changesets with 1 changes to 1 files (+1 heads)
172 new changesets effea6de0384
173 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
174 $ hg log -G
175 @ changeset: 2:effea6de0384
176 | tag: tip
177 | parent: 0:bbd179dfa0a7
178 | user: test
179 | date: Thu Jan 01 00:00:00 1970 +0000
180 | summary: add bar
181 |
182 | o changeset: 1:ed1b79f46b9a
183 |/ user: test
184 | date: Thu Jan 01 00:00:00 1970 +0000
185 | summary: change foo
186 |
187 o changeset: 0:bbd179dfa0a7
188 user: test
189 date: Thu Jan 01 00:00:00 1970 +0000
190 summary: add foo
191
192
193 $ cd ..
194 $ killdaemons.py