##// END OF EJS Templates
tests: move a test about update in test-pull-update.t...
marmoute -
r47493:ce42fe36 default
parent child Browse files
Show More
@@ -1,248 +1,270 b''
1 1 $ hg init t
2 2 $ cd t
3 3 $ echo 1 > foo
4 4 $ hg ci -Am m
5 5 adding foo
6 6
7 7 $ cd ..
8 8 $ hg clone t tt
9 9 updating to branch default
10 10 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
11 11 $ cd tt
12 12 $ echo 1.1 > foo
13 13 $ hg ci -Am m
14 14
15 15 $ cd ../t
16 16 $ echo 1.2 > foo
17 17 $ hg ci -Am m
18 18
19 19 Should respect config to disable dirty update
20 20 $ hg co -qC 0
21 21 $ echo 2 > foo
22 22 $ hg --config commands.update.check=abort pull -u ../tt
23 23 pulling from ../tt
24 24 searching for changes
25 25 adding changesets
26 26 adding manifests
27 27 adding file changes
28 28 added 1 changesets with 1 changes to 1 files (+1 heads)
29 29 new changesets 107cefe13e42
30 30 1 local changesets published
31 31 abort: uncommitted changes
32 32 [20]
33 33 $ hg --config extensions.strip= strip --no-backup tip
34 34 $ hg co -qC tip
35 35
36 36 Should not update to the other topological branch:
37 37
38 38 $ hg pull -u ../tt
39 39 pulling from ../tt
40 40 searching for changes
41 41 adding changesets
42 42 adding manifests
43 43 adding file changes
44 44 added 1 changesets with 1 changes to 1 files (+1 heads)
45 45 new changesets 107cefe13e42
46 46 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
47 47 updated to "800c91d5bfc1: m"
48 48 1 other heads for branch "default"
49 49
50 50 $ cd ../tt
51 51
52 52 Should not update to the other branch:
53 53
54 54 $ hg pull -u ../t
55 55 pulling from ../t
56 56 searching for changes
57 57 adding changesets
58 58 adding manifests
59 59 adding file changes
60 60 added 1 changesets with 1 changes to 1 files (+1 heads)
61 61 new changesets 800c91d5bfc1
62 62 1 local changesets published
63 63 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
64 64 updated to "107cefe13e42: m"
65 65 1 other heads for branch "default"
66 66
67 67 $ HGMERGE=true hg merge
68 68 merging foo
69 69 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
70 70 (branch merge, don't forget to commit)
71 71 $ hg ci -mm
72 72
73 73 $ cd ../t
74 74
75 75 Should work:
76 76
77 77 $ hg pull -u ../tt
78 78 pulling from ../tt
79 79 searching for changes
80 80 adding changesets
81 81 adding manifests
82 82 adding file changes
83 83 added 1 changesets with 1 changes to 1 files (-1 heads)
84 84 new changesets 483b76ad4309
85 85 1 local changesets published
86 86 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
87 87
88 88 Similarity between "hg update" and "hg pull -u" in handling bookmark
89 89 ====================================================================
90 90
91 91 Test that updating activates the bookmark, which matches with the
92 92 explicit destination of the update.
93 93
94 94 $ echo 4 >> foo
95 95 $ hg commit -m "#4"
96 96 $ hg bookmark active-after-pull
97 97 $ cd ../tt
98 98
99 99 (1) activating by --rev BOOKMARK
100 100
101 101 $ hg bookmark -f active-before-pull
102 102 $ hg bookmarks
103 103 * active-before-pull 3:483b76ad4309
104 104
105 105 $ hg pull -u -r active-after-pull
106 106 pulling from $TESTTMP/t
107 107 searching for changes
108 108 adding changesets
109 109 adding manifests
110 110 adding file changes
111 111 adding remote bookmark active-after-pull
112 112 added 1 changesets with 1 changes to 1 files
113 113 new changesets f815b3da6163
114 114 1 local changesets published
115 115 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
116 116 (activating bookmark active-after-pull)
117 117
118 118 $ hg parents -q
119 119 4:f815b3da6163
120 120 $ hg bookmarks
121 121 * active-after-pull 4:f815b3da6163
122 122 active-before-pull 3:483b76ad4309
123 123
124 124 (discard pulled changes)
125 125
126 126 $ hg update -q 483b76ad4309
127 127 $ hg rollback -q
128 128
129 129 (2) activating by URL#BOOKMARK
130 130
131 131 $ hg bookmark -f active-before-pull
132 132 $ hg bookmarks
133 133 * active-before-pull 3:483b76ad4309
134 134
135 135 $ hg pull -u $TESTTMP/t#active-after-pull
136 136 pulling from $TESTTMP/t
137 137 searching for changes
138 138 adding changesets
139 139 adding manifests
140 140 adding file changes
141 141 adding remote bookmark active-after-pull
142 142 added 1 changesets with 1 changes to 1 files
143 143 new changesets f815b3da6163
144 144 1 local changesets published
145 145 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
146 146 (activating bookmark active-after-pull)
147 147
148 148 $ hg parents -q
149 149 4:f815b3da6163
150 150 $ hg bookmarks
151 151 * active-after-pull 4:f815b3da6163
152 152 active-before-pull 3:483b76ad4309
153 153
154 154 (discard pulled changes)
155 155
156 156 $ hg update -q 483b76ad4309
157 157 $ hg rollback -q
158 158
159 159 Test that updating deactivates current active bookmark, if the
160 160 destination of the update is explicitly specified, and it doesn't
161 161 match with the name of any existing bookmarks.
162 162
163 163 $ cd ../t
164 164 $ hg bookmark -d active-after-pull
165 165 $ hg branch bar -q
166 166 $ hg commit -m "#5 (bar #1)"
167 167 $ cd ../tt
168 168
169 169 (1) deactivating by --rev REV
170 170
171 171 $ hg bookmark -f active-before-pull
172 172 $ hg bookmarks
173 173 * active-before-pull 3:483b76ad4309
174 174
175 175 $ hg pull -u -r b5e4babfaaa7
176 176 pulling from $TESTTMP/t
177 177 searching for changes
178 178 adding changesets
179 179 adding manifests
180 180 adding file changes
181 181 added 2 changesets with 1 changes to 1 files
182 182 new changesets f815b3da6163:b5e4babfaaa7
183 183 1 local changesets published
184 184 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
185 185 (leaving bookmark active-before-pull)
186 186
187 187 $ hg parents -q
188 188 5:b5e4babfaaa7
189 189 $ hg bookmarks
190 190 active-before-pull 3:483b76ad4309
191 191
192 192 (discard pulled changes)
193 193
194 194 $ hg update -q 483b76ad4309
195 195 $ hg rollback -q
196 196
197 197 (2) deactivating by --branch BRANCH
198 198
199 199 $ hg bookmark -f active-before-pull
200 200 $ hg bookmarks
201 201 * active-before-pull 3:483b76ad4309
202 202
203 203 $ hg pull -u -b bar
204 204 pulling from $TESTTMP/t
205 205 searching for changes
206 206 adding changesets
207 207 adding manifests
208 208 adding file changes
209 209 added 2 changesets with 1 changes to 1 files
210 210 new changesets f815b3da6163:b5e4babfaaa7
211 211 1 local changesets published
212 212 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
213 213 (leaving bookmark active-before-pull)
214 214
215 215 $ hg parents -q
216 216 5:b5e4babfaaa7
217 217 $ hg bookmarks
218 218 active-before-pull 3:483b76ad4309
219 219
220 220 (discard pulled changes)
221 221
222 222 $ hg update -q 483b76ad4309
223 223 $ hg rollback -q
224 224
225 225 (3) deactivating by URL#ANOTHER-BRANCH
226 226
227 227 $ hg bookmark -f active-before-pull
228 228 $ hg bookmarks
229 229 * active-before-pull 3:483b76ad4309
230 230
231 231 $ hg pull -u $TESTTMP/t#bar
232 232 pulling from $TESTTMP/t
233 233 searching for changes
234 234 adding changesets
235 235 adding manifests
236 236 adding file changes
237 237 added 2 changesets with 1 changes to 1 files
238 238 new changesets f815b3da6163:b5e4babfaaa7
239 239 1 local changesets published
240 240 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
241 241 (leaving bookmark active-before-pull)
242 242
243 243 $ hg parents -q
244 244 5:b5e4babfaaa7
245 245 $ hg bookmarks
246 246 active-before-pull 3:483b76ad4309
247 247
248 248 $ cd ..
249
250 Issue622: hg init && hg pull -u URL doesn't checkout default branch
251
252 $ hg init test
253 $ cd test
254 $ echo foo>foo
255 $ hg addremove
256 adding foo
257 $ hg commit -m 1
258 $ cd ..
259
260 $ hg init empty
261 $ cd empty
262 $ hg pull -u ../test
263 pulling from ../test
264 requesting all changes
265 adding changesets
266 adding manifests
267 adding file changes
268 added 1 changesets with 1 changes to 1 files
269 new changesets 340e38bdcde4
270 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -1,152 +1,137 b''
1 1 #require serve
2 2
3 3 #testcases sshv1 sshv2
4 4
5 5 #if sshv2
6 6 $ cat >> $HGRCPATH << EOF
7 7 > [experimental]
8 8 > sshpeer.advertise-v2 = true
9 9 > sshserver.support-v2 = true
10 10 > EOF
11 11 #endif
12 12
13 13 $ hg init test
14 14 $ cd test
15 15
16 16 $ echo foo>foo
17 17 $ hg addremove
18 18 adding foo
19 19 $ hg commit -m 1
20 20
21 21 $ hg verify
22 22 checking changesets
23 23 checking manifests
24 24 crosschecking files in changesets and manifests
25 25 checking files
26 26 checked 1 changesets with 1 changes to 1 files
27 27
28 28 $ hg serve -p $HGPORT -d --pid-file=hg.pid
29 29 $ cat hg.pid >> $DAEMON_PIDS
30 30 $ cd ..
31 31
32 32 $ hg clone --pull http://foo:bar@localhost:$HGPORT/ copy
33 33 requesting all changes
34 34 adding changesets
35 35 adding manifests
36 36 adding file changes
37 37 added 1 changesets with 1 changes to 1 files
38 38 new changesets 340e38bdcde4
39 39 updating to branch default
40 40 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
41 41
42 42 $ cd copy
43 43 $ hg verify
44 44 checking changesets
45 45 checking manifests
46 46 crosschecking files in changesets and manifests
47 47 checking files
48 48 checked 1 changesets with 1 changes to 1 files
49 49
50 50 $ hg co
51 51 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
52 52 $ cat foo
53 53 foo
54 54
55 55 $ hg manifest --debug
56 56 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 foo
57 57
58 58 $ hg pull
59 59 pulling from http://foo@localhost:$HGPORT/
60 60 searching for changes
61 61 no changes found
62 62
63 63 $ hg rollback --dry-run --verbose
64 64 repository tip rolled back to revision -1 (undo pull: http://foo:***@localhost:$HGPORT/)
65 65
66 66 Test pull of non-existing 20 character revision specification, making sure plain ascii identifiers
67 67 not are encoded like a node:
68 68
69 69 $ hg pull -r 'xxxxxxxxxxxxxxxxxxxy'
70 70 pulling from http://foo@localhost:$HGPORT/
71 71 abort: unknown revision 'xxxxxxxxxxxxxxxxxxxy'
72 72 [255]
73 73 $ hg pull -r 'xxxxxxxxxxxxxxxxxx y'
74 74 pulling from http://foo@localhost:$HGPORT/
75 75 abort: unknown revision 'xxxxxxxxxxxxxxxxxx y'
76 76 [255]
77 77
78 78 Test pull of working copy revision
79 79 $ hg pull -r 'ffffffffffff'
80 80 pulling from http://foo@localhost:$HGPORT/
81 81 abort: unknown revision 'ffffffffffff'
82 82 [255]
83 83
84 Issue622: hg init && hg pull -u URL doesn't checkout default branch
85
86 $ cd ..
87 $ hg init empty
88 $ cd empty
89 $ hg pull -u ../test
90 pulling from ../test
91 requesting all changes
92 adding changesets
93 adding manifests
94 adding file changes
95 added 1 changesets with 1 changes to 1 files
96 new changesets 340e38bdcde4
97 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
98
99 84 Test 'file:' uri handling:
100 85
101 86 $ hg pull -q file://../test-does-not-exist
102 87 abort: file:// URLs can only refer to localhost
103 88 [255]
104 89
105 90 $ hg pull -q file://../test
106 91 abort: file:// URLs can only refer to localhost
107 92 [255]
108 93
109 94 MSYS changes 'file:' into 'file;'
110 95
111 96 #if no-msys
112 97 $ hg pull -q file:../test # no-msys
113 98 #endif
114 99
115 100 It's tricky to make file:// URLs working on every platform with
116 101 regular shell commands.
117 102
118 103 $ URL=`"$PYTHON" -c "from __future__ import print_function; import os; print('file://foobar' + ('/' + os.getcwd().replace(os.sep, '/')).replace('//', '/') + '/../test')"`
119 104 $ hg pull -q "$URL"
120 105 abort: file:// URLs can only refer to localhost
121 106 [255]
122 107
123 108 $ URL=`"$PYTHON" -c "from __future__ import print_function; import os; print('file://localhost' + ('/' + os.getcwd().replace(os.sep, '/')).replace('//', '/') + '/../test')"`
124 109 $ hg pull -q "$URL"
125 110
126 111 SEC: check for unsafe ssh url
127 112
128 113 $ cat >> $HGRCPATH << EOF
129 114 > [ui]
130 115 > ssh = sh -c "read l; read l; read l"
131 116 > EOF
132 117
133 118 $ hg pull 'ssh://-oProxyCommand=touch${IFS}owned/path'
134 119 pulling from ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path
135 120 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
136 121 [255]
137 122 $ hg pull 'ssh://%2DoProxyCommand=touch${IFS}owned/path'
138 123 pulling from ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path
139 124 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
140 125 [255]
141 126 $ hg pull 'ssh://fakehost|touch${IFS}owned/path'
142 127 pulling from ssh://fakehost%7Ctouch%24%7BIFS%7Downed/path
143 128 abort: no suitable response from remote hg
144 129 [255]
145 130 $ hg --config ui.timestamp-output=true pull 'ssh://fakehost%7Ctouch%20owned/path'
146 131 \[20[2-9][0-9]-[01][0-9]-[0-3][0-9]T[0-5][0-9]:[0-5][0-9]:[0-5][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9]\] pulling from ssh://fakehost%7Ctouch%20owned/path (re)
147 132 \[20[2-9][0-9]-[01][0-9]-[0-3][0-9]T[0-5][0-9]:[0-5][0-9]:[0-5][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9]\] abort: no suitable response from remote hg (re)
148 133 [255]
149 134
150 135 $ [ ! -f owned ] || echo 'you got owned'
151 136
152 137 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now