##// END OF EJS Templates
tests: remove pid file by default...
Gregory Szorc -
r37865:89793289 default
parent child Browse files
Show More
@@ -1,127 +1,127 b''
1 1 #!/usr/bin/env python
2 2
3 3 from __future__ import absolute_import
4 4 import errno
5 5 import os
6 6 import signal
7 7 import sys
8 8 import time
9 9
10 10 if os.name =='nt':
11 11 import ctypes
12 12
13 13 _BOOL = ctypes.c_long
14 14 _DWORD = ctypes.c_ulong
15 15 _UINT = ctypes.c_uint
16 16 _HANDLE = ctypes.c_void_p
17 17
18 18 ctypes.windll.kernel32.CloseHandle.argtypes = [_HANDLE]
19 19 ctypes.windll.kernel32.CloseHandle.restype = _BOOL
20 20
21 21 ctypes.windll.kernel32.GetLastError.argtypes = []
22 22 ctypes.windll.kernel32.GetLastError.restype = _DWORD
23 23
24 24 ctypes.windll.kernel32.OpenProcess.argtypes = [_DWORD, _BOOL, _DWORD]
25 25 ctypes.windll.kernel32.OpenProcess.restype = _HANDLE
26 26
27 27 ctypes.windll.kernel32.TerminateProcess.argtypes = [_HANDLE, _UINT]
28 28 ctypes.windll.kernel32.TerminateProcess.restype = _BOOL
29 29
30 30 ctypes.windll.kernel32.WaitForSingleObject.argtypes = [_HANDLE, _DWORD]
31 31 ctypes.windll.kernel32.WaitForSingleObject.restype = _DWORD
32 32
33 33 def _check(ret, expectederr=None):
34 34 if ret == 0:
35 35 winerrno = ctypes.GetLastError()
36 36 if winerrno == expectederr:
37 37 return True
38 38 raise ctypes.WinError(winerrno)
39 39
40 40 def kill(pid, logfn, tryhard=True):
41 41 logfn('# Killing daemon process %d' % pid)
42 42 PROCESS_TERMINATE = 1
43 43 PROCESS_QUERY_INFORMATION = 0x400
44 44 SYNCHRONIZE = 0x00100000
45 45 WAIT_OBJECT_0 = 0
46 46 WAIT_TIMEOUT = 258
47 47 WAIT_FAILED = _DWORD(0xFFFFFFFF).value
48 48 handle = ctypes.windll.kernel32.OpenProcess(
49 49 PROCESS_TERMINATE|SYNCHRONIZE|PROCESS_QUERY_INFORMATION,
50 50 False, pid)
51 51 if handle is None:
52 52 _check(0, 87) # err 87 when process not found
53 53 return # process not found, already finished
54 54 try:
55 55 r = ctypes.windll.kernel32.WaitForSingleObject(handle, 100)
56 56 if r == WAIT_OBJECT_0:
57 57 pass # terminated, but process handle still available
58 58 elif r == WAIT_TIMEOUT:
59 59 _check(ctypes.windll.kernel32.TerminateProcess(handle, -1))
60 60 elif r == WAIT_FAILED:
61 61 _check(0) # err stored in GetLastError()
62 62
63 63 # TODO?: forcefully kill when timeout
64 64 # and ?shorter waiting time? when tryhard==True
65 65 r = ctypes.windll.kernel32.WaitForSingleObject(handle, 100)
66 66 # timeout = 100 ms
67 67 if r == WAIT_OBJECT_0:
68 68 pass # process is terminated
69 69 elif r == WAIT_TIMEOUT:
70 70 logfn('# Daemon process %d is stuck')
71 71 elif r == WAIT_FAILED:
72 72 _check(0) # err stored in GetLastError()
73 73 except: #re-raises
74 74 ctypes.windll.kernel32.CloseHandle(handle) # no _check, keep error
75 75 raise
76 76 _check(ctypes.windll.kernel32.CloseHandle(handle))
77 77
78 78 else:
79 79 def kill(pid, logfn, tryhard=True):
80 80 try:
81 81 os.kill(pid, 0)
82 82 logfn('# Killing daemon process %d' % pid)
83 83 os.kill(pid, signal.SIGTERM)
84 84 if tryhard:
85 85 for i in range(10):
86 86 time.sleep(0.05)
87 87 os.kill(pid, 0)
88 88 else:
89 89 time.sleep(0.1)
90 90 os.kill(pid, 0)
91 91 logfn('# Daemon process %d is stuck - really killing it' % pid)
92 92 os.kill(pid, signal.SIGKILL)
93 93 except OSError as err:
94 94 if err.errno != errno.ESRCH:
95 95 raise
96 96
97 97 def killdaemons(pidfile, tryhard=True, remove=False, logfn=None):
98 98 if not logfn:
99 99 logfn = lambda s: s
100 100 # Kill off any leftover daemon processes
101 101 try:
102 102 pids = []
103 103 with open(pidfile) as fp:
104 104 for line in fp:
105 105 try:
106 106 pid = int(line)
107 107 if pid <= 0:
108 108 raise ValueError
109 109 except ValueError:
110 110 logfn('# Not killing daemon process %s - invalid pid'
111 111 % line.rstrip())
112 112 continue
113 113 pids.append(pid)
114 114 for pid in pids:
115 115 kill(pid, logfn, tryhard)
116 116 if remove:
117 117 os.unlink(pidfile)
118 118 except IOError:
119 119 pass
120 120
121 121 if __name__ == '__main__':
122 122 if len(sys.argv) > 1:
123 123 path, = sys.argv[1:]
124 124 else:
125 125 path = os.environ["DAEMON_PIDS"]
126 126
127 killdaemons(path)
127 killdaemons(path, remove=True)
@@ -1,942 +1,941 b''
1 1 #require no-reposimplestore
2 2 #testcases git-server hg-server
3 3
4 4 #if git-server
5 5 #require lfs-test-server
6 6 #else
7 7 #require serve
8 8 #endif
9 9
10 10 #if git-server
11 11 $ LFS_LISTEN="tcp://:$HGPORT"
12 12 $ LFS_HOST="localhost:$HGPORT"
13 13 $ LFS_PUBLIC=1
14 14 $ export LFS_LISTEN LFS_HOST LFS_PUBLIC
15 15 #else
16 16 $ LFS_HOST="localhost:$HGPORT/.git/info/lfs"
17 17 #endif
18 18
19 19 #if no-windows git-server
20 20 $ lfs-test-server &> lfs-server.log &
21 21 $ echo $! >> $DAEMON_PIDS
22 22 #endif
23 23
24 24 #if windows git-server
25 25 $ cat >> $TESTTMP/spawn.py <<EOF
26 26 > import os
27 27 > import subprocess
28 28 > import sys
29 29 >
30 30 > for path in os.environ["PATH"].split(os.pathsep):
31 31 > exe = os.path.join(path, 'lfs-test-server.exe')
32 32 > if os.path.exists(exe):
33 33 > with open('lfs-server.log', 'wb') as out:
34 34 > p = subprocess.Popen(exe, stdout=out, stderr=out)
35 35 > sys.stdout.write('%s\n' % p.pid)
36 36 > sys.exit(0)
37 37 > sys.exit(1)
38 38 > EOF
39 39 $ $PYTHON $TESTTMP/spawn.py >> $DAEMON_PIDS
40 40 #endif
41 41
42 42 $ cat >> $HGRCPATH <<EOF
43 43 > [extensions]
44 44 > lfs=
45 45 > [lfs]
46 46 > url=http://foo:bar@$LFS_HOST
47 47 > track=all()
48 48 > [web]
49 49 > push_ssl = False
50 50 > allow-push = *
51 51 > EOF
52 52
53 53 Use a separate usercache, otherwise the server sees what the client commits, and
54 54 never requests a transfer.
55 55
56 56 #if hg-server
57 57 $ hg init server
58 58 $ hg --config "lfs.usercache=$TESTTMP/servercache" -R server serve -d \
59 59 > -p $HGPORT --pid-file=hg.pid -A $TESTTMP/access.log -E $TESTTMP/errors.log
60 60 $ cat hg.pid >> $DAEMON_PIDS
61 61 #endif
62 62
63 63 $ hg init repo1
64 64 $ cd repo1
65 65 $ echo THIS-IS-LFS > a
66 66 $ hg commit -m a -A a
67 67
68 68 A push can be serviced directly from the usercache if it isn't in the local
69 69 store.
70 70
71 71 $ hg init ../repo2
72 72 $ mv .hg/store/lfs .hg/store/lfs_
73 73 $ hg push ../repo2 --debug
74 74 http auth: user foo, password ***
75 75 pushing to ../repo2
76 76 http auth: user foo, password ***
77 77 http auth: user foo, password ***
78 78 query 1; heads
79 79 searching for changes
80 80 1 total queries in *s (glob)
81 81 listing keys for "phases"
82 82 checking for updated bookmarks
83 83 listing keys for "bookmarks"
84 84 lfs: computing set of blobs to upload
85 85 Status: 200
86 86 Content-Length: 309 (git-server !)
87 87 Content-Length: 350 (hg-server !)
88 88 Content-Type: application/vnd.git-lfs+json
89 89 Date: $HTTP_DATE$
90 90 Server: testing stub value (hg-server !)
91 91 {
92 92 "objects": [
93 93 {
94 94 "actions": {
95 95 "upload": {
96 96 "expires_at": "$ISO_8601_DATE_TIME$"
97 97 "header": {
98 98 "Accept": "application/vnd.git-lfs"
99 99 }
100 100 "href": "http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b" (git-server !)
101 101 "href": "http://localhost:$HGPORT/.hg/lfs/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b" (hg-server !)
102 102 }
103 103 }
104 104 "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
105 105 "size": 12
106 106 }
107 107 ]
108 108 "transfer": "basic" (hg-server !)
109 109 }
110 110 lfs: uploading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
111 111 Status: 200 (git-server !)
112 112 Status: 201 (hg-server !)
113 113 Content-Length: 0
114 114 Content-Type: text/plain; charset=utf-8
115 115 Date: $HTTP_DATE$
116 116 Server: testing stub value (hg-server !)
117 117 lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b
118 118 lfs: uploaded 1 files (12 bytes)
119 119 1 changesets found
120 120 list of changesets:
121 121 99a7098854a3984a5c9eab0fc7a2906697b7cb5c
122 122 bundle2-output-bundle: "HG20", 4 parts total
123 123 bundle2-output-part: "replycaps" * bytes payload (glob)
124 124 bundle2-output-part: "check:heads" streamed payload
125 125 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
126 126 bundle2-output-part: "phase-heads" 24 bytes payload
127 127 bundle2-input-bundle: with-transaction
128 128 bundle2-input-part: "replycaps" supported
129 129 bundle2-input-part: total payload size * (glob)
130 130 bundle2-input-part: "check:heads" supported
131 131 bundle2-input-part: total payload size 20
132 132 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
133 133 adding changesets
134 134 add changeset 99a7098854a3
135 135 adding manifests
136 136 adding file changes
137 137 adding a revisions
138 138 added 1 changesets with 1 changes to 1 files
139 139 calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs
140 140 bundle2-input-part: total payload size 617
141 141 bundle2-input-part: "phase-heads" supported
142 142 bundle2-input-part: total payload size 24
143 143 bundle2-input-bundle: 3 parts total
144 144 updating the branch cache
145 145 bundle2-output-bundle: "HG20", 1 parts total
146 146 bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) empty payload
147 147 bundle2-input-bundle: no-transaction
148 148 bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported
149 149 bundle2-input-bundle: 0 parts total
150 150 listing keys for "phases"
151 151 $ mv .hg/store/lfs_ .hg/store/lfs
152 152
153 153 Clear the cache to force a download
154 154 $ rm -rf `hg config lfs.usercache`
155 155 $ cd ../repo2
156 156 $ hg update tip --debug
157 157 http auth: user foo, password ***
158 158 resolving manifests
159 159 branchmerge: False, force: False, partial: False
160 160 ancestor: 000000000000, local: 000000000000+, remote: 99a7098854a3
161 161 http auth: user foo, password ***
162 162 Status: 200
163 163 Content-Length: 311 (git-server !)
164 164 Content-Length: 352 (hg-server !)
165 165 Content-Type: application/vnd.git-lfs+json
166 166 Date: $HTTP_DATE$
167 167 Server: testing stub value (hg-server !)
168 168 {
169 169 "objects": [
170 170 {
171 171 "actions": {
172 172 "download": {
173 173 "expires_at": "$ISO_8601_DATE_TIME$"
174 174 "header": {
175 175 "Accept": "application/vnd.git-lfs"
176 176 }
177 177 "href": "http://localhost:$HGPORT/*/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b" (glob)
178 178 }
179 179 }
180 180 "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
181 181 "size": 12
182 182 }
183 183 ]
184 184 "transfer": "basic" (hg-server !)
185 185 }
186 186 lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
187 187 Status: 200
188 188 Content-Length: 12
189 189 Content-Type: text/plain; charset=utf-8 (git-server !)
190 190 Content-Type: application/octet-stream (hg-server !)
191 191 Date: $HTTP_DATE$
192 192 Server: testing stub value (hg-server !)
193 193 lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache
194 194 lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b
195 195 lfs: downloaded 1 files (12 bytes)
196 196 a: remote created -> g
197 197 getting a
198 198 lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
199 199 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
200 200
201 201 When the server has some blobs already. `hg serve` doesn't offer to upload
202 202 blobs that it already knows about. Note that lfs-test-server is simply
203 203 toggling the action to 'download'. The Batch API spec says it should omit the
204 204 actions property completely.
205 205
206 206 $ hg mv a b
207 207 $ echo ANOTHER-LARGE-FILE > c
208 208 $ echo ANOTHER-LARGE-FILE2 > d
209 209 $ hg commit -m b-and-c -A b c d
210 210 $ hg push ../repo1 --debug
211 211 http auth: user foo, password ***
212 212 pushing to ../repo1
213 213 http auth: user foo, password ***
214 214 http auth: user foo, password ***
215 215 query 1; heads
216 216 searching for changes
217 217 all remote heads known locally
218 218 listing keys for "phases"
219 219 checking for updated bookmarks
220 220 listing keys for "bookmarks"
221 221 listing keys for "bookmarks"
222 222 lfs: computing set of blobs to upload
223 223 Status: 200
224 224 Content-Length: 901 (git-server !)
225 225 Content-Length: 755 (hg-server !)
226 226 Content-Type: application/vnd.git-lfs+json
227 227 Date: $HTTP_DATE$
228 228 Server: testing stub value (hg-server !)
229 229 {
230 230 "objects": [
231 231 {
232 232 "actions": { (git-server !)
233 233 "download": { (git-server !)
234 234 "expires_at": "$ISO_8601_DATE_TIME$" (git-server !)
235 235 "header": { (git-server !)
236 236 "Accept": "application/vnd.git-lfs" (git-server !)
237 237 } (git-server !)
238 238 "href": "http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b" (git-server !)
239 239 } (git-server !)
240 240 } (git-server !)
241 241 "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
242 242 "size": 12
243 243 }
244 244 {
245 245 "actions": {
246 246 "upload": {
247 247 "expires_at": "$ISO_8601_DATE_TIME$"
248 248 "header": {
249 249 "Accept": "application/vnd.git-lfs"
250 250 }
251 251 "href": "http://localhost:$HGPORT/*/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19" (glob)
252 252 }
253 253 }
254 254 "oid": "37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19"
255 255 "size": 20
256 256 }
257 257 {
258 258 "actions": {
259 259 "upload": {
260 260 "expires_at": "$ISO_8601_DATE_TIME$"
261 261 "header": {
262 262 "Accept": "application/vnd.git-lfs"
263 263 }
264 264 "href": "http://localhost:$HGPORT/*/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998" (glob)
265 265 }
266 266 }
267 267 "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
268 268 "size": 19
269 269 }
270 270 ]
271 271 "transfer": "basic" (hg-server !)
272 272 }
273 273 lfs: need to transfer 2 objects (39 bytes)
274 274 lfs: uploading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes)
275 275 Status: 200 (git-server !)
276 276 Status: 201 (hg-server !)
277 277 Content-Length: 0
278 278 Content-Type: text/plain; charset=utf-8
279 279 Date: $HTTP_DATE$
280 280 Server: testing stub value (hg-server !)
281 281 lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19
282 282 lfs: uploading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
283 283 Status: 200 (git-server !)
284 284 Status: 201 (hg-server !)
285 285 Content-Length: 0
286 286 Content-Type: text/plain; charset=utf-8
287 287 Date: $HTTP_DATE$
288 288 Server: testing stub value (hg-server !)
289 289 lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
290 290 lfs: uploaded 2 files (39 bytes)
291 291 1 changesets found
292 292 list of changesets:
293 293 dfca2c9e2ef24996aa61ba2abd99277d884b3d63
294 294 bundle2-output-bundle: "HG20", 5 parts total
295 295 bundle2-output-part: "replycaps" * bytes payload (glob)
296 296 bundle2-output-part: "check:phases" 24 bytes payload
297 297 bundle2-output-part: "check:heads" streamed payload
298 298 bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
299 299 bundle2-output-part: "phase-heads" 24 bytes payload
300 300 bundle2-input-bundle: with-transaction
301 301 bundle2-input-part: "replycaps" supported
302 302 bundle2-input-part: total payload size * (glob)
303 303 bundle2-input-part: "check:phases" supported
304 304 bundle2-input-part: total payload size 24
305 305 bundle2-input-part: "check:heads" supported
306 306 bundle2-input-part: total payload size 20
307 307 bundle2-input-part: "changegroup" (params: 1 mandatory) supported
308 308 adding changesets
309 309 add changeset dfca2c9e2ef2
310 310 adding manifests
311 311 adding file changes
312 312 adding b revisions
313 313 adding c revisions
314 314 adding d revisions
315 315 added 1 changesets with 3 changes to 3 files
316 316 bundle2-input-part: total payload size 1315
317 317 bundle2-input-part: "phase-heads" supported
318 318 bundle2-input-part: total payload size 24
319 319 bundle2-input-bundle: 4 parts total
320 320 updating the branch cache
321 321 bundle2-output-bundle: "HG20", 1 parts total
322 322 bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) empty payload
323 323 bundle2-input-bundle: no-transaction
324 324 bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported
325 325 bundle2-input-bundle: 0 parts total
326 326 listing keys for "phases"
327 327
328 328 Clear the cache to force a download
329 329 $ rm -rf `hg config lfs.usercache`
330 330 $ hg --repo ../repo1 update tip --debug
331 331 http auth: user foo, password ***
332 332 resolving manifests
333 333 branchmerge: False, force: False, partial: False
334 334 ancestor: 99a7098854a3, local: 99a7098854a3+, remote: dfca2c9e2ef2
335 335 http auth: user foo, password ***
336 336 Status: 200
337 337 Content-Length: 608 (git-server !)
338 338 Content-Length: 670 (hg-server !)
339 339 Content-Type: application/vnd.git-lfs+json
340 340 Date: $HTTP_DATE$
341 341 Server: testing stub value (hg-server !)
342 342 {
343 343 "objects": [
344 344 {
345 345 "actions": {
346 346 "download": {
347 347 "expires_at": "$ISO_8601_DATE_TIME$"
348 348 "header": {
349 349 "Accept": "application/vnd.git-lfs"
350 350 }
351 351 "href": "http://localhost:$HGPORT/*/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19" (glob)
352 352 }
353 353 }
354 354 "oid": "37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19"
355 355 "size": 20
356 356 }
357 357 {
358 358 "actions": {
359 359 "download": {
360 360 "expires_at": "$ISO_8601_DATE_TIME$"
361 361 "header": {
362 362 "Accept": "application/vnd.git-lfs"
363 363 }
364 364 "href": "http://localhost:$HGPORT/*/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998" (glob)
365 365 }
366 366 }
367 367 "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
368 368 "size": 19
369 369 }
370 370 ]
371 371 "transfer": "basic" (hg-server !)
372 372 }
373 373 lfs: need to transfer 2 objects (39 bytes)
374 374 lfs: downloading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes)
375 375 Status: 200
376 376 Content-Length: 20
377 377 Content-Type: text/plain; charset=utf-8 (git-server !)
378 378 Content-Type: application/octet-stream (hg-server !)
379 379 Date: $HTTP_DATE$
380 380 Server: testing stub value (hg-server !)
381 381 lfs: adding 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 to the usercache
382 382 lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19
383 383 lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
384 384 Status: 200
385 385 Content-Length: 19
386 386 Content-Type: text/plain; charset=utf-8 (git-server !)
387 387 Content-Type: application/octet-stream (hg-server !)
388 388 Date: $HTTP_DATE$
389 389 Server: testing stub value (hg-server !)
390 390 lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache
391 391 lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
392 392 lfs: downloaded 2 files (39 bytes)
393 393 b: remote created -> g
394 394 getting b
395 395 lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
396 396 c: remote created -> g
397 397 getting c
398 398 lfs: found d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 in the local lfs store
399 399 d: remote created -> g
400 400 getting d
401 401 lfs: found 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 in the local lfs store
402 402 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
403 403
404 404 Test a corrupt file download, but clear the cache first to force a download.
405 405 `hg serve` indicates a corrupt file without transferring it, unlike
406 406 lfs-test-server.
407 407
408 408 $ rm -rf `hg config lfs.usercache`
409 409 #if git-server
410 410 $ cp $TESTTMP/lfs-content/d1/1e/1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 blob
411 411 $ echo 'damage' > $TESTTMP/lfs-content/d1/1e/1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
412 412 #else
413 413 $ cp $TESTTMP/server/.hg/store/lfs/objects/d1/1e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 blob
414 414 $ echo 'damage' > $TESTTMP/server/.hg/store/lfs/objects/d1/1e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
415 415 #endif
416 416 $ rm ../repo1/.hg/store/lfs/objects/d1/1e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
417 417 $ rm ../repo1/*
418 418
419 419 TODO: give the proper error indication from `hg serve`
420 420
421 421 $ hg --repo ../repo1 update -C tip --debug
422 422 http auth: user foo, password ***
423 423 resolving manifests
424 424 branchmerge: False, force: True, partial: False
425 425 ancestor: dfca2c9e2ef2+, local: dfca2c9e2ef2+, remote: dfca2c9e2ef2
426 426 http auth: user foo, password ***
427 427 Status: 200
428 428 Content-Length: 311 (git-server !)
429 429 Content-Length: 183 (hg-server !)
430 430 Content-Type: application/vnd.git-lfs+json
431 431 Date: $HTTP_DATE$
432 432 Server: testing stub value (hg-server !)
433 433 {
434 434 "objects": [
435 435 {
436 436 "actions": { (git-server !)
437 437 "download": { (git-server !)
438 438 "expires_at": "$ISO_8601_DATE_TIME$" (git-server !)
439 439 "header": { (git-server !)
440 440 "Accept": "application/vnd.git-lfs" (git-server !)
441 441 } (git-server !)
442 442 "href": "http://localhost:$HGPORT/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998" (git-server !)
443 443 } (git-server !)
444 444 "error": { (hg-server !)
445 445 "code": 422 (hg-server !)
446 446 "message": "The object is corrupt" (hg-server !)
447 447 }
448 448 "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
449 449 "size": 19
450 450 }
451 451 ]
452 452 "transfer": "basic" (hg-server !)
453 453 }
454 454 lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes) (git-server !)
455 455 Status: 200 (git-server !)
456 456 Content-Length: 7 (git-server !)
457 457 Content-Type: text/plain; charset=utf-8 (git-server !)
458 458 Date: $HTTP_DATE$ (git-server !)
459 459 abort: corrupt remote lfs object: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (git-server !)
460 460 abort: LFS server error for "c": Validation error! (hg-server !)
461 461 [255]
462 462
463 463 The corrupted blob is not added to the usercache or local store
464 464
465 465 $ test -f ../repo1/.hg/store/lfs/objects/d1/1e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
466 466 [1]
467 467 $ test -f `hg config lfs.usercache`/d1/1e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
468 468 [1]
469 469 #if git-server
470 470 $ cp blob $TESTTMP/lfs-content/d1/1e/1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
471 471 #else
472 472 $ cp blob $TESTTMP/server/.hg/store/lfs/objects/d1/1e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
473 473 #endif
474 474
475 475 Test a corrupted file upload
476 476
477 477 $ echo 'another lfs blob' > b
478 478 $ hg ci -m 'another blob'
479 479 $ echo 'damage' > .hg/store/lfs/objects/e6/59058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0
480 480 $ hg push --debug ../repo1
481 481 http auth: user foo, password ***
482 482 pushing to ../repo1
483 483 http auth: user foo, password ***
484 484 http auth: user foo, password ***
485 485 query 1; heads
486 486 searching for changes
487 487 all remote heads known locally
488 488 listing keys for "phases"
489 489 checking for updated bookmarks
490 490 listing keys for "bookmarks"
491 491 listing keys for "bookmarks"
492 492 lfs: computing set of blobs to upload
493 493 Status: 200
494 494 Content-Length: 309 (git-server !)
495 495 Content-Length: 350 (hg-server !)
496 496 Content-Type: application/vnd.git-lfs+json
497 497 Date: $HTTP_DATE$
498 498 Server: testing stub value (hg-server !)
499 499 {
500 500 "objects": [
501 501 {
502 502 "actions": {
503 503 "upload": {
504 504 "expires_at": "$ISO_8601_DATE_TIME$"
505 505 "header": {
506 506 "Accept": "application/vnd.git-lfs"
507 507 }
508 508 "href": "http://localhost:$HGPORT/*/e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0" (glob)
509 509 }
510 510 }
511 511 "oid": "e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0"
512 512 "size": 17
513 513 }
514 514 ]
515 515 "transfer": "basic" (hg-server !)
516 516 }
517 517 lfs: uploading e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0 (17 bytes)
518 518 abort: detected corrupt lfs object: e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0
519 519 (run hg verify)
520 520 [255]
521 521
522 522 Archive will prefetch blobs in a group
523 523
524 524 $ rm -rf .hg/store/lfs `hg config lfs.usercache`
525 525 $ hg archive --debug -r 1 ../archive
526 526 http auth: user foo, password ***
527 527 http auth: user foo, password ***
528 528 Status: 200
529 529 Content-Length: 905 (git-server !)
530 530 Content-Length: 988 (hg-server !)
531 531 Content-Type: application/vnd.git-lfs+json
532 532 Date: $HTTP_DATE$
533 533 Server: testing stub value (hg-server !)
534 534 {
535 535 "objects": [
536 536 {
537 537 "actions": {
538 538 "download": {
539 539 "expires_at": "$ISO_8601_DATE_TIME$"
540 540 "header": {
541 541 "Accept": "application/vnd.git-lfs"
542 542 }
543 543 "href": "http://localhost:$HGPORT/*/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b" (glob)
544 544 }
545 545 }
546 546 "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
547 547 "size": 12
548 548 }
549 549 {
550 550 "actions": {
551 551 "download": {
552 552 "expires_at": "$ISO_8601_DATE_TIME$"
553 553 "header": {
554 554 "Accept": "application/vnd.git-lfs"
555 555 }
556 556 "href": "http://localhost:$HGPORT/*/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19" (glob)
557 557 }
558 558 }
559 559 "oid": "37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19"
560 560 "size": 20
561 561 }
562 562 {
563 563 "actions": {
564 564 "download": {
565 565 "expires_at": "$ISO_8601_DATE_TIME$"
566 566 "header": {
567 567 "Accept": "application/vnd.git-lfs"
568 568 }
569 569 "href": "http://localhost:$HGPORT/*/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998" (glob)
570 570 }
571 571 }
572 572 "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
573 573 "size": 19
574 574 }
575 575 ]
576 576 "transfer": "basic" (hg-server !)
577 577 }
578 578 lfs: need to transfer 3 objects (51 bytes)
579 579 lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
580 580 Status: 200
581 581 Content-Length: 12
582 582 Content-Type: text/plain; charset=utf-8 (git-server !)
583 583 Content-Type: application/octet-stream (hg-server !)
584 584 Date: $HTTP_DATE$
585 585 Server: testing stub value (hg-server !)
586 586 lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache
587 587 lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b
588 588 lfs: downloading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes)
589 589 Status: 200
590 590 Content-Length: 20
591 591 Content-Type: text/plain; charset=utf-8 (git-server !)
592 592 Content-Type: application/octet-stream (hg-server !)
593 593 Date: $HTTP_DATE$
594 594 Server: testing stub value (hg-server !)
595 595 lfs: adding 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 to the usercache
596 596 lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19
597 597 lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
598 598 Status: 200
599 599 Content-Length: 19
600 600 Content-Type: text/plain; charset=utf-8 (git-server !)
601 601 Content-Type: application/octet-stream (hg-server !)
602 602 Date: $HTTP_DATE$
603 603 Server: testing stub value (hg-server !)
604 604 lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache
605 605 lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
606 606 lfs: downloaded 3 files (51 bytes)
607 607 lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
608 608 lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
609 609 lfs: found d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 in the local lfs store
610 610 lfs: found 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 in the local lfs store
611 611 $ find ../archive | sort
612 612 ../archive
613 613 ../archive/.hg_archival.txt
614 614 ../archive/a
615 615 ../archive/b
616 616 ../archive/c
617 617 ../archive/d
618 618
619 619 Cat will prefetch blobs in a group
620 620
621 621 $ rm -rf .hg/store/lfs `hg config lfs.usercache`
622 622 $ hg cat --debug -r 1 a b c nonexistent
623 623 http auth: user foo, password ***
624 624 http auth: user foo, password ***
625 625 Status: 200
626 626 Content-Length: 608 (git-server !)
627 627 Content-Length: 670 (hg-server !)
628 628 Content-Type: application/vnd.git-lfs+json
629 629 Date: $HTTP_DATE$
630 630 Server: testing stub value (hg-server !)
631 631 {
632 632 "objects": [
633 633 {
634 634 "actions": {
635 635 "download": {
636 636 "expires_at": "$ISO_8601_DATE_TIME$"
637 637 "header": {
638 638 "Accept": "application/vnd.git-lfs"
639 639 }
640 640 "href": "http://localhost:$HGPORT/*/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b" (glob)
641 641 }
642 642 }
643 643 "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
644 644 "size": 12
645 645 }
646 646 {
647 647 "actions": {
648 648 "download": {
649 649 "expires_at": "$ISO_8601_DATE_TIME$"
650 650 "header": {
651 651 "Accept": "application/vnd.git-lfs"
652 652 }
653 653 "href": "http://localhost:$HGPORT/*/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998" (glob)
654 654 }
655 655 }
656 656 "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
657 657 "size": 19
658 658 }
659 659 ]
660 660 "transfer": "basic" (hg-server !)
661 661 }
662 662 lfs: need to transfer 2 objects (31 bytes)
663 663 lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
664 664 Status: 200
665 665 Content-Length: 12
666 666 Content-Type: text/plain; charset=utf-8 (git-server !)
667 667 Content-Type: application/octet-stream (hg-server !)
668 668 Date: $HTTP_DATE$
669 669 Server: testing stub value (hg-server !)
670 670 lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache
671 671 lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b
672 672 lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
673 673 Status: 200
674 674 Content-Length: 19
675 675 Content-Type: text/plain; charset=utf-8 (git-server !)
676 676 Content-Type: application/octet-stream (hg-server !)
677 677 Date: $HTTP_DATE$
678 678 Server: testing stub value (hg-server !)
679 679 lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache
680 680 lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
681 681 lfs: downloaded 2 files (31 bytes)
682 682 lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
683 683 THIS-IS-LFS
684 684 lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
685 685 THIS-IS-LFS
686 686 lfs: found d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 in the local lfs store
687 687 ANOTHER-LARGE-FILE
688 688 nonexistent: no such file in rev dfca2c9e2ef2
689 689
690 690 Revert will prefetch blobs in a group
691 691
692 692 $ rm -rf .hg/store/lfs
693 693 $ rm -rf `hg config lfs.usercache`
694 694 $ rm *
695 695 $ hg revert --all -r 1 --debug
696 696 http auth: user foo, password ***
697 697 adding a
698 698 reverting b
699 699 reverting c
700 700 reverting d
701 701 http auth: user foo, password ***
702 702 Status: 200
703 703 Content-Length: 905 (git-server !)
704 704 Content-Length: 988 (hg-server !)
705 705 Content-Type: application/vnd.git-lfs+json
706 706 Date: $HTTP_DATE$
707 707 Server: testing stub value (hg-server !)
708 708 {
709 709 "objects": [
710 710 {
711 711 "actions": {
712 712 "download": {
713 713 "expires_at": "$ISO_8601_DATE_TIME$"
714 714 "header": {
715 715 "Accept": "application/vnd.git-lfs"
716 716 }
717 717 "href": "http://localhost:$HGPORT/*/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b" (glob)
718 718 }
719 719 }
720 720 "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
721 721 "size": 12
722 722 }
723 723 {
724 724 "actions": {
725 725 "download": {
726 726 "expires_at": "$ISO_8601_DATE_TIME$"
727 727 "header": {
728 728 "Accept": "application/vnd.git-lfs"
729 729 }
730 730 "href": "http://localhost:$HGPORT/*/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19" (glob)
731 731 }
732 732 }
733 733 "oid": "37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19"
734 734 "size": 20
735 735 }
736 736 {
737 737 "actions": {
738 738 "download": {
739 739 "expires_at": "$ISO_8601_DATE_TIME$"
740 740 "header": {
741 741 "Accept": "application/vnd.git-lfs"
742 742 }
743 743 "href": "http://localhost:$HGPORT/*/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998" (glob)
744 744 }
745 745 }
746 746 "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
747 747 "size": 19
748 748 }
749 749 ]
750 750 "transfer": "basic" (hg-server !)
751 751 }
752 752 lfs: need to transfer 3 objects (51 bytes)
753 753 lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
754 754 Status: 200
755 755 Content-Length: 12
756 756 Content-Type: text/plain; charset=utf-8 (git-server !)
757 757 Content-Type: application/octet-stream (hg-server !)
758 758 Date: $HTTP_DATE$
759 759 Server: testing stub value (hg-server !)
760 760 lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache
761 761 lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b
762 762 lfs: downloading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes)
763 763 Status: 200
764 764 Content-Length: 20
765 765 Content-Type: text/plain; charset=utf-8 (git-server !)
766 766 Content-Type: application/octet-stream (hg-server !)
767 767 Date: $HTTP_DATE$
768 768 Server: testing stub value (hg-server !)
769 769 lfs: adding 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 to the usercache
770 770 lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19
771 771 lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
772 772 Status: 200
773 773 Content-Length: 19
774 774 Content-Type: text/plain; charset=utf-8 (git-server !)
775 775 Content-Type: application/octet-stream (hg-server !)
776 776 Date: $HTTP_DATE$
777 777 Server: testing stub value (hg-server !)
778 778 lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache
779 779 lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
780 780 lfs: downloaded 3 files (51 bytes)
781 781 lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
782 782 lfs: found d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 in the local lfs store
783 783 lfs: found 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 in the local lfs store
784 784 lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
785 785
786 786 Check error message when the remote missed a blob:
787 787
788 788 $ echo FFFFF > b
789 789 $ hg commit -m b -A b
790 790 $ echo FFFFF >> b
791 791 $ hg commit -m b b
792 792 $ rm -rf .hg/store/lfs
793 793 $ rm -rf `hg config lfs.usercache`
794 794 $ hg update -C '.^' --debug
795 795 http auth: user foo, password ***
796 796 resolving manifests
797 797 branchmerge: False, force: True, partial: False
798 798 ancestor: 62fdbaf221c6+, local: 62fdbaf221c6+, remote: ef0564edf47e
799 799 http auth: user foo, password ***
800 800 Status: 200
801 801 Content-Length: 308 (git-server !)
802 802 Content-Length: 186 (hg-server !)
803 803 Content-Type: application/vnd.git-lfs+json
804 804 Date: $HTTP_DATE$
805 805 Server: testing stub value (hg-server !)
806 806 {
807 807 "objects": [
808 808 {
809 809 "actions": { (git-server !)
810 810 "upload": { (git-server !)
811 811 "expires_at": "$ISO_8601_DATE_TIME$" (git-server !)
812 812 "header": { (git-server !)
813 813 "Accept": "application/vnd.git-lfs" (git-server !)
814 814 } (git-server !)
815 815 "href": "http://localhost:$HGPORT/objects/8e6ea5f6c066b44a0efa43bcce86aea73f17e6e23f0663df0251e7524e140a13" (git-server !)
816 816 } (git-server !)
817 817 "error": { (hg-server !)
818 818 "code": 404 (hg-server !)
819 819 "message": "The object does not exist" (hg-server !)
820 820 }
821 821 "oid": "8e6ea5f6c066b44a0efa43bcce86aea73f17e6e23f0663df0251e7524e140a13"
822 822 "size": 6
823 823 }
824 824 ]
825 825 "transfer": "basic" (hg-server !)
826 826 }
827 827 abort: LFS server error for "b": The object does not exist!
828 828 [255]
829 829
830 830 Check error message when object does not exist:
831 831
832 832 $ cd $TESTTMP
833 833 $ hg init test && cd test
834 834 $ echo "[extensions]" >> .hg/hgrc
835 835 $ echo "lfs=" >> .hg/hgrc
836 836 $ echo "[lfs]" >> .hg/hgrc
837 837 $ echo "threshold=1" >> .hg/hgrc
838 838 $ echo a > a
839 839 $ hg add a
840 840 $ hg commit -m 'test'
841 841 $ echo aaaaa > a
842 842 $ hg commit -m 'largefile'
843 843 $ hg debugdata a 1 # verify this is no the file content but includes "oid", the LFS "pointer".
844 844 version https://git-lfs.github.com/spec/v1
845 845 oid sha256:bdc26931acfb734b142a8d675f205becf27560dc461f501822de13274fe6fc8a
846 846 size 6
847 847 x-is-binary 0
848 848 $ cd ..
849 849 $ rm -rf `hg config lfs.usercache`
850 850
851 851 (Restart the server in a different location so it no longer has the content)
852 852
853 853 $ $PYTHON $RUNTESTDIR/killdaemons.py $DAEMON_PIDS
854 854
855 855 #if hg-server
856 856 $ cat $TESTTMP/access.log $TESTTMP/errors.log
857 857 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
858 858 $LOCALIP - - [$LOGDATE$] "PUT /.hg/lfs/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b HTTP/1.1" 201 - (glob)
859 859 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
860 860 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b HTTP/1.1" 200 - (glob)
861 861 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
862 862 $LOCALIP - - [$LOGDATE$] "PUT /.hg/lfs/objects/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 HTTP/1.1" 201 - (glob)
863 863 $LOCALIP - - [$LOGDATE$] "PUT /.hg/lfs/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 HTTP/1.1" 201 - (glob)
864 864 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
865 865 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 HTTP/1.1" 200 - (glob)
866 866 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 HTTP/1.1" 200 - (glob)
867 867 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
868 868 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
869 869 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
870 870 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b HTTP/1.1" 200 - (glob)
871 871 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 HTTP/1.1" 200 - (glob)
872 872 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 HTTP/1.1" 200 - (glob)
873 873 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
874 874 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b HTTP/1.1" 200 - (glob)
875 875 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 HTTP/1.1" 200 - (glob)
876 876 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
877 877 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b HTTP/1.1" 200 - (glob)
878 878 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 HTTP/1.1" 200 - (glob)
879 879 $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 HTTP/1.1" 200 - (glob)
880 880 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
881 881 #endif
882 882
883 $ rm $DAEMON_PIDS
884 883 $ mkdir $TESTTMP/lfs-server2
885 884 $ cd $TESTTMP/lfs-server2
886 885 #if no-windows git-server
887 886 $ lfs-test-server &> lfs-server.log &
888 887 $ echo $! >> $DAEMON_PIDS
889 888 #endif
890 889
891 890 #if windows git-server
892 891 $ $PYTHON $TESTTMP/spawn.py >> $DAEMON_PIDS
893 892 #endif
894 893
895 894 #if hg-server
896 895 $ hg init server2
897 896 $ hg --config "lfs.usercache=$TESTTMP/servercache2" -R server2 serve -d \
898 897 > -p $HGPORT --pid-file=hg.pid -A $TESTTMP/access.log -E $TESTTMP/errors.log
899 898 $ cat hg.pid >> $DAEMON_PIDS
900 899 #endif
901 900
902 901 $ cd $TESTTMP
903 902 $ hg --debug clone test test2
904 903 http auth: user foo, password ***
905 904 linked 6 files
906 905 http auth: user foo, password ***
907 906 updating to branch default
908 907 resolving manifests
909 908 branchmerge: False, force: False, partial: False
910 909 ancestor: 000000000000, local: 000000000000+, remote: d2a338f184a8
911 910 http auth: user foo, password ***
912 911 Status: 200
913 912 Content-Length: 308 (git-server !)
914 913 Content-Length: 186 (hg-server !)
915 914 Content-Type: application/vnd.git-lfs+json
916 915 Date: $HTTP_DATE$
917 916 Server: testing stub value (hg-server !)
918 917 {
919 918 "objects": [
920 919 {
921 920 "actions": { (git-server !)
922 921 "upload": { (git-server !)
923 922 "expires_at": "$ISO_8601_DATE_TIME$" (git-server !)
924 923 "header": { (git-server !)
925 924 "Accept": "application/vnd.git-lfs" (git-server !)
926 925 } (git-server !)
927 926 "href": "http://localhost:$HGPORT/objects/bdc26931acfb734b142a8d675f205becf27560dc461f501822de13274fe6fc8a" (git-server !)
928 927 } (git-server !)
929 928 "error": { (hg-server !)
930 929 "code": 404 (hg-server !)
931 930 "message": "The object does not exist" (hg-server !)
932 931 }
933 932 "oid": "bdc26931acfb734b142a8d675f205becf27560dc461f501822de13274fe6fc8a"
934 933 "size": 6
935 934 }
936 935 ]
937 936 "transfer": "basic" (hg-server !)
938 937 }
939 938 abort: LFS server error for "a": The object does not exist!
940 939 [255]
941 940
942 941 $ $PYTHON $RUNTESTDIR/killdaemons.py $DAEMON_PIDS
@@ -1,1618 +1,1618 b''
1 1 $ cat >> $HGRCPATH << EOF
2 2 > [phases]
3 3 > # public changeset are not obsolete
4 4 > publish=false
5 5 > [ui]
6 6 > logtemplate="{rev}:{node|short} ({phase}{if(obsolete, ' *{obsolete}*')}{if(instabilities, ' {instabilities}')}) [{tags} {bookmarks}] {desc|firstline}{if(obsfate, " [{join(obsfate, "; ")}]")}\n"
7 7 > EOF
8 8 $ mkcommit() {
9 9 > echo "$1" > "$1"
10 10 > hg add "$1"
11 11 > hg ci -m "add $1"
12 12 > }
13 13 $ getid() {
14 14 > hg log -T "{node}\n" --hidden -r "desc('$1')"
15 15 > }
16 16
17 17 $ cat > debugkeys.py <<EOF
18 18 > def reposetup(ui, repo):
19 19 > class debugkeysrepo(repo.__class__):
20 20 > def listkeys(self, namespace):
21 21 > ui.write(b'listkeys %s\n' % (namespace,))
22 22 > return super(debugkeysrepo, self).listkeys(namespace)
23 23 >
24 24 > if repo.local():
25 25 > repo.__class__ = debugkeysrepo
26 26 > EOF
27 27
28 28 $ hg init tmpa
29 29 $ cd tmpa
30 30 $ mkcommit kill_me
31 31
32 32 Checking that the feature is properly disabled
33 33
34 34 $ hg debugobsolete -d '0 0' `getid kill_me` -u babar
35 35 abort: creating obsolete markers is not enabled on this repo
36 36 [255]
37 37
38 38 Enabling it
39 39
40 40 $ cat >> $HGRCPATH << EOF
41 41 > [experimental]
42 42 > evolution=exchange
43 43 > evolution.createmarkers=True
44 44 > EOF
45 45
46 46 Killing a single changeset without replacement
47 47
48 48 $ hg debugobsolete 0
49 49 abort: changeset references must be full hexadecimal node identifiers
50 50 [255]
51 51 $ hg debugobsolete '00'
52 52 abort: changeset references must be full hexadecimal node identifiers
53 53 [255]
54 54 $ hg debugobsolete -d '0 0' `getid kill_me` -u babar
55 55 obsoleted 1 changesets
56 56 $ hg debugobsolete
57 57 97b7c2d76b1845ed3eb988cd612611e72406cef0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'babar'}
58 58
59 59 (test that mercurial is not confused)
60 60
61 61 $ hg up null --quiet # having 0 as parent prevents it to be hidden
62 62 $ hg tip
63 63 -1:000000000000 (public) [tip ]
64 64 $ hg up --hidden tip --quiet
65 65 updating to a hidden changeset 97b7c2d76b18
66 66 (hidden revision '97b7c2d76b18' is pruned)
67 67
68 68 Killing a single changeset with itself should fail
69 69 (simple local safeguard)
70 70
71 71 $ hg debugobsolete `getid kill_me` `getid kill_me`
72 72 abort: bad obsmarker input: in-marker cycle with 97b7c2d76b1845ed3eb988cd612611e72406cef0
73 73 [255]
74 74
75 75 $ cd ..
76 76
77 77 Killing a single changeset with replacement
78 78 (and testing the format option)
79 79
80 80 $ hg init tmpb
81 81 $ cd tmpb
82 82 $ mkcommit a
83 83 $ mkcommit b
84 84 $ mkcommit original_c
85 85 $ hg up "desc('b')"
86 86 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
87 87 $ mkcommit new_c
88 88 created new head
89 89 $ hg log -r 'hidden()' --template '{rev}:{node|short} {desc}\n' --hidden
90 90 $ hg debugobsolete --config format.obsstore-version=0 --flag 12 `getid original_c` `getid new_c` -d '121 120'
91 91 obsoleted 1 changesets
92 92 $ hg log -r 'hidden()' --template '{rev}:{node|short} {desc}\n' --hidden
93 93 2:245bde4270cd add original_c
94 94 $ hg debugrevlog -cd
95 95 # rev p1rev p2rev start end deltastart base p1 p2 rawsize totalsize compression heads chainlen
96 96 0 -1 -1 0 59 0 0 0 0 58 58 0 1 0
97 97 1 0 -1 59 118 59 59 0 0 58 116 0 1 0
98 98 2 1 -1 118 193 118 118 59 0 76 192 0 1 0
99 99 3 1 -1 193 260 193 193 59 0 66 258 0 2 0
100 100 $ hg debugobsolete
101 101 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
102 102
103 103 (check for version number of the obsstore)
104 104
105 105 $ dd bs=1 count=1 if=.hg/store/obsstore 2>/dev/null
106 106 \x00 (no-eol) (esc)
107 107
108 108 do it again (it read the obsstore before adding new changeset)
109 109
110 110 $ hg up '.^'
111 111 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
112 112 $ mkcommit new_2_c
113 113 created new head
114 114 $ hg debugobsolete -d '1337 0' `getid new_c` `getid new_2_c`
115 115 obsoleted 1 changesets
116 116 $ hg debugobsolete
117 117 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
118 118 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
119 119
120 120 Register two markers with a missing node
121 121
122 122 $ hg up '.^'
123 123 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
124 124 $ mkcommit new_3_c
125 125 created new head
126 126 $ hg debugobsolete -d '1338 0' `getid new_2_c` 1337133713371337133713371337133713371337
127 127 obsoleted 1 changesets
128 128 $ hg debugobsolete -d '1339 0' 1337133713371337133713371337133713371337 `getid new_3_c`
129 129 $ hg debugobsolete
130 130 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
131 131 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
132 132 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
133 133 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
134 134
135 135 Test the --index option of debugobsolete command
136 136 $ hg debugobsolete --index
137 137 0 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
138 138 1 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
139 139 2 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
140 140 3 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
141 141
142 142 Refuse pathological nullid successors
143 143 $ hg debugobsolete -d '9001 0' 1337133713371337133713371337133713371337 0000000000000000000000000000000000000000
144 144 transaction abort!
145 145 rollback completed
146 146 abort: bad obsolescence marker detected: invalid successors nullid
147 147 [255]
148 148
149 149 Check that graphlog detect that a changeset is obsolete:
150 150
151 151 $ hg log -G
152 152 @ 5:5601fb93a350 (draft) [tip ] add new_3_c
153 153 |
154 154 o 1:7c3bad9141dc (draft) [ ] add b
155 155 |
156 156 o 0:1f0dee641bb7 (draft) [ ] add a
157 157
158 158
159 159 check that heads does not report them
160 160
161 161 $ hg heads
162 162 5:5601fb93a350 (draft) [tip ] add new_3_c
163 163 $ hg heads --hidden
164 164 5:5601fb93a350 (draft) [tip ] add new_3_c
165 165 4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c [rewritten as 5:5601fb93a350]
166 166 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c [rewritten as 4:ca819180edb9]
167 167 2:245bde4270cd (draft *obsolete*) [ ] add original_c [rewritten as 3:cdbce2fbb163]
168 168
169 169
170 170 check that summary does not report them
171 171
172 172 $ hg init ../sink
173 173 $ echo '[paths]' >> .hg/hgrc
174 174 $ echo 'default=../sink' >> .hg/hgrc
175 175 $ hg summary --remote
176 176 parent: 5:5601fb93a350 tip
177 177 add new_3_c
178 178 branch: default
179 179 commit: (clean)
180 180 update: (current)
181 181 phases: 3 draft
182 182 remote: 3 outgoing
183 183
184 184 $ hg summary --remote --hidden
185 185 parent: 5:5601fb93a350 tip
186 186 add new_3_c
187 187 branch: default
188 188 commit: (clean)
189 189 update: 3 new changesets, 4 branch heads (merge)
190 190 phases: 6 draft
191 191 remote: 3 outgoing
192 192
193 193 check that various commands work well with filtering
194 194
195 195 $ hg tip
196 196 5:5601fb93a350 (draft) [tip ] add new_3_c
197 197 $ hg log -r 6
198 198 abort: unknown revision '6'!
199 199 [255]
200 200 $ hg log -r 4
201 201 abort: hidden revision '4' was rewritten as: 5601fb93a350!
202 202 (use --hidden to access hidden revisions)
203 203 [255]
204 204 $ hg debugrevspec 'rev(6)'
205 205 $ hg debugrevspec 'rev(4)'
206 206 $ hg debugrevspec 'null'
207 207 -1
208 208
209 209 Check that public changeset are not accounted as obsolete:
210 210
211 211 $ hg --hidden phase --public 2
212 212 1 new phase-divergent changesets
213 213 $ hg log -G
214 214 @ 5:5601fb93a350 (draft phase-divergent) [tip ] add new_3_c
215 215 |
216 216 | o 2:245bde4270cd (public) [ ] add original_c
217 217 |/
218 218 o 1:7c3bad9141dc (public) [ ] add b
219 219 |
220 220 o 0:1f0dee641bb7 (public) [ ] add a
221 221
222 222
223 223 And that bumped changeset are detected
224 224 --------------------------------------
225 225
226 226 If we didn't filtered obsolete changesets out, 3 and 4 would show up too. Also
227 227 note that the bumped changeset (5:5601fb93a350) is not a direct successor of
228 228 the public changeset
229 229
230 230 $ hg log --hidden -r 'phasedivergent()'
231 231 5:5601fb93a350 (draft phase-divergent) [tip ] add new_3_c
232 232
233 233 And that we can't push bumped changeset
234 234
235 235 $ hg push ../tmpa -r 0 --force #(make repo related)
236 236 pushing to ../tmpa
237 237 searching for changes
238 238 warning: repository is unrelated
239 239 adding changesets
240 240 adding manifests
241 241 adding file changes
242 242 added 1 changesets with 1 changes to 1 files (+1 heads)
243 243 $ hg push ../tmpa
244 244 pushing to ../tmpa
245 245 searching for changes
246 246 abort: push includes phase-divergent changeset: 5601fb93a350!
247 247 [255]
248 248
249 249 Fixing "bumped" situation
250 250 We need to create a clone of 5 and add a special marker with a flag
251 251
252 252 $ hg summary
253 253 parent: 5:5601fb93a350 tip (phase-divergent)
254 254 add new_3_c
255 255 branch: default
256 256 commit: (clean)
257 257 update: 1 new changesets, 2 branch heads (merge)
258 258 phases: 1 draft
259 259 phase-divergent: 1 changesets
260 260 $ hg up '5^'
261 261 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
262 262 $ hg revert -ar 5
263 263 adding new_3_c
264 264 $ hg ci -m 'add n3w_3_c'
265 265 created new head
266 266 $ hg debugobsolete -d '1338 0' --flags 1 `getid new_3_c` `getid n3w_3_c`
267 267 obsoleted 1 changesets
268 268 $ hg log -r 'phasedivergent()'
269 269 $ hg log -G
270 270 @ 6:6f9641995072 (draft) [tip ] add n3w_3_c
271 271 |
272 272 | o 2:245bde4270cd (public) [ ] add original_c
273 273 |/
274 274 o 1:7c3bad9141dc (public) [ ] add b
275 275 |
276 276 o 0:1f0dee641bb7 (public) [ ] add a
277 277
278 278
279 279 Basic exclusive testing
280 280
281 281 $ hg log -G --hidden
282 282 @ 6:6f9641995072 (draft) [tip ] add n3w_3_c
283 283 |
284 284 | x 5:5601fb93a350 (draft *obsolete*) [ ] add new_3_c [rewritten as 6:6f9641995072]
285 285 |/
286 286 | x 4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c [rewritten as 5:5601fb93a350]
287 287 |/
288 288 | x 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c [rewritten as 4:ca819180edb9]
289 289 |/
290 290 | o 2:245bde4270cd (public) [ ] add original_c
291 291 |/
292 292 o 1:7c3bad9141dc (public) [ ] add b
293 293 |
294 294 o 0:1f0dee641bb7 (public) [ ] add a
295 295
296 296 $ hg debugobsolete --rev 6f9641995072
297 297 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
298 298 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
299 299 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
300 300 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
301 301 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
302 302 $ hg debugobsolete --rev 6f9641995072 --exclusive
303 303 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
304 304 $ hg debugobsolete --rev 5601fb93a350 --hidden
305 305 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
306 306 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
307 307 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
308 308 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
309 309 $ hg debugobsolete --rev 5601fb93a350 --hidden --exclusive
310 310 $ hg debugobsolete --rev 5601fb93a350+6f9641995072 --hidden --exclusive
311 311 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
312 312 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
313 313 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
314 314
315 315 $ cd ..
316 316
317 317 Revision 0 is hidden
318 318 --------------------
319 319
320 320 $ hg init rev0hidden
321 321 $ cd rev0hidden
322 322
323 323 $ mkcommit kill0
324 324 $ hg up -q null
325 325 $ hg debugobsolete `getid kill0`
326 326 obsoleted 1 changesets
327 327 $ mkcommit a
328 328 $ mkcommit b
329 329
330 330 Should pick the first visible revision as "repo" node
331 331
332 332 $ hg archive ../archive-null
333 333 $ cat ../archive-null/.hg_archival.txt
334 334 repo: 1f0dee641bb7258c56bd60e93edfa2405381c41e
335 335 node: 7c3bad9141dcb46ff89abf5f61856facd56e476c
336 336 branch: default
337 337 latesttag: null
338 338 latesttagdistance: 2
339 339 changessincelatesttag: 2
340 340
341 341
342 342 $ cd ..
343 343
344 344 Can disable transaction summary report
345 345
346 346 $ hg init transaction-summary
347 347 $ cd transaction-summary
348 348 $ mkcommit a
349 349 $ mkcommit b
350 350 $ hg up -q null
351 351 $ hg --config experimental.evolution.report-instabilities=false debugobsolete `getid a`
352 352 obsoleted 1 changesets
353 353 $ cd ..
354 354
355 355 Exchange Test
356 356 ============================
357 357
358 358 Destination repo does not have any data
359 359 ---------------------------------------
360 360
361 361 Simple incoming test
362 362
363 363 $ hg init tmpc
364 364 $ cd tmpc
365 365 $ hg incoming ../tmpb
366 366 comparing with ../tmpb
367 367 0:1f0dee641bb7 (public) [ ] add a
368 368 1:7c3bad9141dc (public) [ ] add b
369 369 2:245bde4270cd (public) [ ] add original_c
370 370 6:6f9641995072 (draft) [tip ] add n3w_3_c
371 371
372 372 Try to pull markers
373 373 (extinct changeset are excluded but marker are pushed)
374 374
375 375 $ hg pull ../tmpb
376 376 pulling from ../tmpb
377 377 requesting all changes
378 378 adding changesets
379 379 adding manifests
380 380 adding file changes
381 381 added 4 changesets with 4 changes to 4 files (+1 heads)
382 382 5 new obsolescence markers
383 383 new changesets 1f0dee641bb7:6f9641995072
384 384 (run 'hg heads' to see heads, 'hg merge' to merge)
385 385 $ hg debugobsolete
386 386 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
387 387 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
388 388 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
389 389 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
390 390 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
391 391
392 392 Rollback//Transaction support
393 393
394 394 $ hg debugobsolete -d '1340 0' aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
395 395 $ hg debugobsolete
396 396 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
397 397 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
398 398 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
399 399 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
400 400 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
401 401 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 (Thu Jan 01 00:22:20 1970 +0000) {'user': 'test'}
402 402 $ hg rollback -n
403 403 repository tip rolled back to revision 3 (undo debugobsolete)
404 404 $ hg rollback
405 405 repository tip rolled back to revision 3 (undo debugobsolete)
406 406 $ hg debugobsolete
407 407 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
408 408 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
409 409 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
410 410 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
411 411 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
412 412
413 413 $ cd ..
414 414
415 415 Try to push markers
416 416
417 417 $ hg init tmpd
418 418 $ hg -R tmpb push tmpd
419 419 pushing to tmpd
420 420 searching for changes
421 421 adding changesets
422 422 adding manifests
423 423 adding file changes
424 424 added 4 changesets with 4 changes to 4 files (+1 heads)
425 425 5 new obsolescence markers
426 426 $ hg -R tmpd debugobsolete | sort
427 427 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
428 428 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
429 429 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
430 430 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
431 431 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
432 432
433 433 Check obsolete keys are exchanged only if source has an obsolete store
434 434
435 435 $ hg init empty
436 436 $ hg --config extensions.debugkeys=debugkeys.py -R empty push tmpd
437 437 pushing to tmpd
438 438 listkeys phases
439 439 listkeys bookmarks
440 440 no changes found
441 441 listkeys phases
442 442 [1]
443 443
444 444 clone support
445 445 (markers are copied and extinct changesets are included to allow hardlinks)
446 446
447 447 $ hg clone tmpb clone-dest
448 448 updating to branch default
449 449 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
450 450 $ hg -R clone-dest log -G --hidden
451 451 @ 6:6f9641995072 (draft) [tip ] add n3w_3_c
452 452 |
453 453 | x 5:5601fb93a350 (draft *obsolete*) [ ] add new_3_c [rewritten as 6:6f9641995072]
454 454 |/
455 455 | x 4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c [rewritten as 5:5601fb93a350]
456 456 |/
457 457 | x 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c [rewritten as 4:ca819180edb9]
458 458 |/
459 459 | o 2:245bde4270cd (public) [ ] add original_c
460 460 |/
461 461 o 1:7c3bad9141dc (public) [ ] add b
462 462 |
463 463 o 0:1f0dee641bb7 (public) [ ] add a
464 464
465 465 $ hg -R clone-dest debugobsolete
466 466 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
467 467 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
468 468 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
469 469 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
470 470 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
471 471
472 472
473 473 Destination repo have existing data
474 474 ---------------------------------------
475 475
476 476 On pull
477 477
478 478 $ hg init tmpe
479 479 $ cd tmpe
480 480 $ hg debugobsolete -d '1339 0' 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00
481 481 $ hg pull ../tmpb
482 482 pulling from ../tmpb
483 483 requesting all changes
484 484 adding changesets
485 485 adding manifests
486 486 adding file changes
487 487 added 4 changesets with 4 changes to 4 files (+1 heads)
488 488 5 new obsolescence markers
489 489 new changesets 1f0dee641bb7:6f9641995072
490 490 (run 'hg heads' to see heads, 'hg merge' to merge)
491 491 $ hg debugobsolete
492 492 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
493 493 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
494 494 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
495 495 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
496 496 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
497 497 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
498 498
499 499
500 500 On push
501 501
502 502 $ hg push ../tmpc
503 503 pushing to ../tmpc
504 504 searching for changes
505 505 no changes found
506 506 1 new obsolescence markers
507 507 [1]
508 508 $ hg -R ../tmpc debugobsolete
509 509 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
510 510 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
511 511 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
512 512 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
513 513 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
514 514 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
515 515
516 516 detect outgoing obsolete and unstable
517 517 ---------------------------------------
518 518
519 519
520 520 $ hg log -G
521 521 o 3:6f9641995072 (draft) [tip ] add n3w_3_c
522 522 |
523 523 | o 2:245bde4270cd (public) [ ] add original_c
524 524 |/
525 525 o 1:7c3bad9141dc (public) [ ] add b
526 526 |
527 527 o 0:1f0dee641bb7 (public) [ ] add a
528 528
529 529 $ hg up 'desc("n3w_3_c")'
530 530 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
531 531 $ mkcommit original_d
532 532 $ mkcommit original_e
533 533 $ hg debugobsolete --record-parents `getid original_d` -d '0 0'
534 534 obsoleted 1 changesets
535 535 1 new orphan changesets
536 536 $ hg debugobsolete | grep `getid original_d`
537 537 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
538 538 $ hg log -r 'obsolete()'
539 539 4:94b33453f93b (draft *obsolete*) [ ] add original_d [pruned]
540 540 $ hg summary
541 541 parent: 5:cda648ca50f5 tip (orphan)
542 542 add original_e
543 543 branch: default
544 544 commit: (clean)
545 545 update: 1 new changesets, 2 branch heads (merge)
546 546 phases: 3 draft
547 547 orphan: 1 changesets
548 548 $ hg log -G -r '::orphan()'
549 549 @ 5:cda648ca50f5 (draft orphan) [tip ] add original_e
550 550 |
551 551 x 4:94b33453f93b (draft *obsolete*) [ ] add original_d [pruned]
552 552 |
553 553 o 3:6f9641995072 (draft) [ ] add n3w_3_c
554 554 |
555 555 o 1:7c3bad9141dc (public) [ ] add b
556 556 |
557 557 o 0:1f0dee641bb7 (public) [ ] add a
558 558
559 559
560 560 refuse to push obsolete changeset
561 561
562 562 $ hg push ../tmpc/ -r 'desc("original_d")'
563 563 pushing to ../tmpc/
564 564 searching for changes
565 565 abort: push includes obsolete changeset: 94b33453f93b!
566 566 [255]
567 567
568 568 refuse to push unstable changeset
569 569
570 570 $ hg push ../tmpc/
571 571 pushing to ../tmpc/
572 572 searching for changes
573 573 abort: push includes orphan changeset: cda648ca50f5!
574 574 [255]
575 575
576 576 Test that extinct changeset are properly detected
577 577
578 578 $ hg log -r 'extinct()'
579 579
580 580 Don't try to push extinct changeset
581 581
582 582 $ hg init ../tmpf
583 583 $ hg out ../tmpf
584 584 comparing with ../tmpf
585 585 searching for changes
586 586 0:1f0dee641bb7 (public) [ ] add a
587 587 1:7c3bad9141dc (public) [ ] add b
588 588 2:245bde4270cd (public) [ ] add original_c
589 589 3:6f9641995072 (draft) [ ] add n3w_3_c
590 590 4:94b33453f93b (draft *obsolete*) [ ] add original_d [pruned]
591 591 5:cda648ca50f5 (draft orphan) [tip ] add original_e
592 592 $ hg push ../tmpf -f # -f because be push unstable too
593 593 pushing to ../tmpf
594 594 searching for changes
595 595 adding changesets
596 596 adding manifests
597 597 adding file changes
598 598 added 6 changesets with 6 changes to 6 files (+1 heads)
599 599 7 new obsolescence markers
600 600 1 new orphan changesets
601 601
602 602 no warning displayed
603 603
604 604 $ hg push ../tmpf
605 605 pushing to ../tmpf
606 606 searching for changes
607 607 no changes found
608 608 [1]
609 609
610 610 Do not warn about new head when the new head is a successors of a remote one
611 611
612 612 $ hg log -G
613 613 @ 5:cda648ca50f5 (draft orphan) [tip ] add original_e
614 614 |
615 615 x 4:94b33453f93b (draft *obsolete*) [ ] add original_d [pruned]
616 616 |
617 617 o 3:6f9641995072 (draft) [ ] add n3w_3_c
618 618 |
619 619 | o 2:245bde4270cd (public) [ ] add original_c
620 620 |/
621 621 o 1:7c3bad9141dc (public) [ ] add b
622 622 |
623 623 o 0:1f0dee641bb7 (public) [ ] add a
624 624
625 625 $ hg up -q 'desc(n3w_3_c)'
626 626 $ mkcommit obsolete_e
627 627 created new head
628 628 $ hg debugobsolete `getid 'original_e'` `getid 'obsolete_e'` \
629 629 > -u 'test <test@example.net>'
630 630 obsoleted 1 changesets
631 631 $ hg outgoing ../tmpf # parasite hg outgoing testin
632 632 comparing with ../tmpf
633 633 searching for changes
634 634 6:3de5eca88c00 (draft) [tip ] add obsolete_e
635 635 $ hg push ../tmpf
636 636 pushing to ../tmpf
637 637 searching for changes
638 638 adding changesets
639 639 adding manifests
640 640 adding file changes
641 641 added 1 changesets with 1 changes to 1 files (+1 heads)
642 642 1 new obsolescence markers
643 643 obsoleted 1 changesets
644 644
645 645 test relevance computation
646 646 ---------------------------------------
647 647
648 648 Checking simple case of "marker relevance".
649 649
650 650
651 651 Reminder of the repo situation
652 652
653 653 $ hg log --hidden --graph
654 654 @ 6:3de5eca88c00 (draft) [tip ] add obsolete_e
655 655 |
656 656 | x 5:cda648ca50f5 (draft *obsolete*) [ ] add original_e [rewritten as 6:3de5eca88c00 by test <test@example.net>]
657 657 | |
658 658 | x 4:94b33453f93b (draft *obsolete*) [ ] add original_d [pruned]
659 659 |/
660 660 o 3:6f9641995072 (draft) [ ] add n3w_3_c
661 661 |
662 662 | o 2:245bde4270cd (public) [ ] add original_c
663 663 |/
664 664 o 1:7c3bad9141dc (public) [ ] add b
665 665 |
666 666 o 0:1f0dee641bb7 (public) [ ] add a
667 667
668 668
669 669 List of all markers
670 670
671 671 $ hg debugobsolete
672 672 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
673 673 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
674 674 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
675 675 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
676 676 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
677 677 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
678 678 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
679 679 cda648ca50f50482b7055c0b0c4c117bba6733d9 3de5eca88c00aa039da7399a220f4a5221faa585 0 (*) {'user': 'test <test@example.net>'} (glob)
680 680
681 681 List of changesets with no chain
682 682
683 683 $ hg debugobsolete --hidden --rev ::2
684 684
685 685 List of changesets that are included on marker chain
686 686
687 687 $ hg debugobsolete --hidden --rev 6
688 688 cda648ca50f50482b7055c0b0c4c117bba6733d9 3de5eca88c00aa039da7399a220f4a5221faa585 0 (*) {'user': 'test <test@example.net>'} (glob)
689 689
690 690 List of changesets with a longer chain, (including a pruned children)
691 691
692 692 $ hg debugobsolete --hidden --rev 3
693 693 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
694 694 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
695 695 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
696 696 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
697 697 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
698 698 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
699 699 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
700 700
701 701 List of both
702 702
703 703 $ hg debugobsolete --hidden --rev 3::6
704 704 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
705 705 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
706 706 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
707 707 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
708 708 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
709 709 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
710 710 cda648ca50f50482b7055c0b0c4c117bba6733d9 3de5eca88c00aa039da7399a220f4a5221faa585 0 (*) {'user': 'test <test@example.net>'} (glob)
711 711 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
712 712
713 713 List of all markers in JSON
714 714
715 715 $ hg debugobsolete -Tjson
716 716 [
717 717 {
718 718 "date": [1339, 0],
719 719 "flag": 0,
720 720 "metadata": {"user": "test"},
721 721 "prednode": "1339133913391339133913391339133913391339",
722 722 "succnodes": ["ca819180edb99ed25ceafb3e9584ac287e240b00"]
723 723 },
724 724 {
725 725 "date": [1339, 0],
726 726 "flag": 0,
727 727 "metadata": {"user": "test"},
728 728 "prednode": "1337133713371337133713371337133713371337",
729 729 "succnodes": ["5601fb93a350734d935195fee37f4054c529ff39"]
730 730 },
731 731 {
732 732 "date": [121, 120],
733 733 "flag": 12,
734 734 "metadata": {"user": "test"},
735 735 "prednode": "245bde4270cd1072a27757984f9cda8ba26f08ca",
736 736 "succnodes": ["cdbce2fbb16313928851e97e0d85413f3f7eb77f"]
737 737 },
738 738 {
739 739 "date": [1338, 0],
740 740 "flag": 1,
741 741 "metadata": {"user": "test"},
742 742 "prednode": "5601fb93a350734d935195fee37f4054c529ff39",
743 743 "succnodes": ["6f96419950729f3671185b847352890f074f7557"]
744 744 },
745 745 {
746 746 "date": [1338, 0],
747 747 "flag": 0,
748 748 "metadata": {"user": "test"},
749 749 "prednode": "ca819180edb99ed25ceafb3e9584ac287e240b00",
750 750 "succnodes": ["1337133713371337133713371337133713371337"]
751 751 },
752 752 {
753 753 "date": [1337, 0],
754 754 "flag": 0,
755 755 "metadata": {"user": "test"},
756 756 "prednode": "cdbce2fbb16313928851e97e0d85413f3f7eb77f",
757 757 "succnodes": ["ca819180edb99ed25ceafb3e9584ac287e240b00"]
758 758 },
759 759 {
760 760 "date": [0, 0],
761 761 "flag": 0,
762 762 "metadata": {"user": "test"},
763 763 "parentnodes": ["6f96419950729f3671185b847352890f074f7557"],
764 764 "prednode": "94b33453f93bdb8d457ef9b770851a618bf413e1",
765 765 "succnodes": []
766 766 },
767 767 {
768 768 "date": *, (glob)
769 769 "flag": 0,
770 770 "metadata": {"user": "test <test@example.net>"},
771 771 "prednode": "cda648ca50f50482b7055c0b0c4c117bba6733d9",
772 772 "succnodes": ["3de5eca88c00aa039da7399a220f4a5221faa585"]
773 773 }
774 774 ]
775 775
776 776 Template keywords
777 777
778 778 $ hg debugobsolete -r6 -T '{succnodes % "{node|short}"} {date|shortdate}\n'
779 779 3de5eca88c00 ????-??-?? (glob)
780 780 $ hg debugobsolete -r6 -T '{join(metadata % "{key}={value}", " ")}\n'
781 781 user=test <test@example.net>
782 782 $ hg debugobsolete -r6 -T '{metadata}\n{metadata}\n'
783 783 'user': 'test <test@example.net>'
784 784 'user': 'test <test@example.net>'
785 785 $ hg debugobsolete -r6 -T '{succnodes}\n{succnodes}\n'
786 786 3de5eca88c00aa039da7399a220f4a5221faa585
787 787 3de5eca88c00aa039da7399a220f4a5221faa585
788 788 $ hg debugobsolete -r6 -T '{flag} {get(metadata, "user")}\n'
789 789 0 test <test@example.net>
790 790
791 791 Test the debug output for exchange
792 792 ----------------------------------
793 793
794 794 $ hg pull ../tmpb --config 'experimental.obsmarkers-exchange-debug=True' # bundle2
795 795 pulling from ../tmpb
796 796 searching for changes
797 797 no changes found
798 798 obsmarker-exchange: 346 bytes received
799 799
800 800 check hgweb does not explode
801 801 ====================================
802 802
803 803 $ hg unbundle $TESTDIR/bundles/hgweb+obs.hg
804 804 adding changesets
805 805 adding manifests
806 806 adding file changes
807 807 added 62 changesets with 63 changes to 9 files (+60 heads)
808 808 new changesets 50c51b361e60:c15e9edfca13
809 809 (run 'hg heads .' to see heads, 'hg merge' to merge)
810 810 $ for node in `hg log -r 'desc(babar_)' --template '{node}\n'`;
811 811 > do
812 812 > hg debugobsolete $node
813 813 > done
814 814 obsoleted 1 changesets
815 815 obsoleted 1 changesets
816 816 obsoleted 1 changesets
817 817 obsoleted 1 changesets
818 818 obsoleted 1 changesets
819 819 obsoleted 1 changesets
820 820 obsoleted 1 changesets
821 821 obsoleted 1 changesets
822 822 obsoleted 1 changesets
823 823 obsoleted 1 changesets
824 824 obsoleted 1 changesets
825 825 obsoleted 1 changesets
826 826 obsoleted 1 changesets
827 827 obsoleted 1 changesets
828 828 obsoleted 1 changesets
829 829 obsoleted 1 changesets
830 830 obsoleted 1 changesets
831 831 obsoleted 1 changesets
832 832 obsoleted 1 changesets
833 833 obsoleted 1 changesets
834 834 obsoleted 1 changesets
835 835 obsoleted 1 changesets
836 836 obsoleted 1 changesets
837 837 obsoleted 1 changesets
838 838 obsoleted 1 changesets
839 839 obsoleted 1 changesets
840 840 obsoleted 1 changesets
841 841 obsoleted 1 changesets
842 842 obsoleted 1 changesets
843 843 obsoleted 1 changesets
844 844 obsoleted 1 changesets
845 845 obsoleted 1 changesets
846 846 obsoleted 1 changesets
847 847 obsoleted 1 changesets
848 848 obsoleted 1 changesets
849 849 obsoleted 1 changesets
850 850 obsoleted 1 changesets
851 851 obsoleted 1 changesets
852 852 obsoleted 1 changesets
853 853 obsoleted 1 changesets
854 854 obsoleted 1 changesets
855 855 obsoleted 1 changesets
856 856 obsoleted 1 changesets
857 857 obsoleted 1 changesets
858 858 obsoleted 1 changesets
859 859 obsoleted 1 changesets
860 860 obsoleted 1 changesets
861 861 obsoleted 1 changesets
862 862 obsoleted 1 changesets
863 863 obsoleted 1 changesets
864 864 obsoleted 1 changesets
865 865 obsoleted 1 changesets
866 866 obsoleted 1 changesets
867 867 obsoleted 1 changesets
868 868 obsoleted 1 changesets
869 869 obsoleted 1 changesets
870 870 obsoleted 1 changesets
871 871 obsoleted 1 changesets
872 872 obsoleted 1 changesets
873 873 obsoleted 1 changesets
874 874 $ hg up tip
875 875 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
876 876
877 877 #if serve
878 878
879 879 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
880 880 $ cat hg.pid >> $DAEMON_PIDS
881 881
882 882 check changelog view
883 883
884 884 $ get-with-headers.py --headeronly localhost:$HGPORT 'shortlog/'
885 885 200 Script output follows
886 886
887 887 check graph view
888 888
889 889 $ get-with-headers.py --headeronly localhost:$HGPORT 'graph'
890 890 200 Script output follows
891 891
892 892 check filelog view
893 893
894 894 $ get-with-headers.py --headeronly localhost:$HGPORT 'log/'`hg log -r . -T "{node}"`/'babar'
895 895 200 Script output follows
896 896
897 897 check filelog view for hidden commits (obsolete ones are hidden here)
898 898
899 899 $ get-with-headers.py localhost:$HGPORT 'log/'`hg log -r . -T "{node}"`/'babar' | grep obsolete
900 900 [1]
901 901
902 902 $ get-with-headers.py --headeronly localhost:$HGPORT 'rev/68'
903 903 200 Script output follows
904 904 $ get-with-headers.py --headeronly localhost:$HGPORT 'rev/67'
905 905 404 Not Found
906 906 [1]
907 907
908 908 check that web.view config option:
909 909
910 910 $ killdaemons.py hg.pid
911 911 $ cat >> .hg/hgrc << EOF
912 912 > [web]
913 913 > view=all
914 914 > EOF
915 915 $ wait
916 916 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
917 917 $ get-with-headers.py --headeronly localhost:$HGPORT 'rev/67'
918 918 200 Script output follows
919 919 $ killdaemons.py hg.pid
920 920
921 921 Checking _enable=False warning if obsolete marker exists
922 922
923 923 $ echo '[experimental]' >> $HGRCPATH
924 924 $ echo "evolution=" >> $HGRCPATH
925 925 $ hg log -r tip
926 926 68:c15e9edfca13 (draft) [tip ] add celestine
927 927
928 928 reenable for later test
929 929
930 930 $ echo '[experimental]' >> $HGRCPATH
931 931 $ echo "evolution.exchange=True" >> $HGRCPATH
932 932 $ echo "evolution.createmarkers=True" >> $HGRCPATH
933 933
934 $ rm hg.pid access.log errors.log
934 $ rm access.log errors.log
935 935 #endif
936 936
937 937 Several troubles on the same changeset (create an unstable and bumped changeset)
938 938
939 939 $ hg debugobsolete `getid obsolete_e`
940 940 obsoleted 1 changesets
941 941 2 new orphan changesets
942 942 $ hg debugobsolete `getid original_c` `getid babar`
943 943 1 new phase-divergent changesets
944 944 $ hg log --config ui.logtemplate= -r 'phasedivergent() and orphan()'
945 945 changeset: 7:50c51b361e60
946 946 user: test
947 947 date: Thu Jan 01 00:00:00 1970 +0000
948 948 instability: orphan, phase-divergent
949 949 summary: add babar
950 950
951 951
952 952 test the "obsolete" templatekw
953 953
954 954 $ hg log -r 'obsolete()'
955 955 6:3de5eca88c00 (draft *obsolete*) [ ] add obsolete_e [pruned]
956 956
957 957 test the "troubles" templatekw
958 958
959 959 $ hg log -r 'phasedivergent() and orphan()'
960 960 7:50c51b361e60 (draft orphan phase-divergent) [ ] add babar
961 961
962 962 test the default cmdline template
963 963
964 964 $ hg log -T default -r 'phasedivergent()'
965 965 changeset: 7:50c51b361e60
966 966 user: test
967 967 date: Thu Jan 01 00:00:00 1970 +0000
968 968 instability: orphan, phase-divergent
969 969 summary: add babar
970 970
971 971 $ hg log -T default -r 'obsolete()'
972 972 changeset: 6:3de5eca88c00
973 973 parent: 3:6f9641995072
974 974 user: test
975 975 date: Thu Jan 01 00:00:00 1970 +0000
976 976 obsolete: pruned
977 977 summary: add obsolete_e
978 978
979 979
980 980 test the obsolete labels
981 981
982 982 $ hg log --config ui.logtemplate= --color=debug -r 'phasedivergent()'
983 983 [log.changeset changeset.draft changeset.unstable instability.orphan instability.phase-divergent|changeset: 7:50c51b361e60]
984 984 [log.user|user: test]
985 985 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
986 986 [log.instability|instability: orphan, phase-divergent]
987 987 [log.summary|summary: add babar]
988 988
989 989
990 990 $ hg log -T default -r 'phasedivergent()' --color=debug
991 991 [log.changeset changeset.draft changeset.unstable instability.orphan instability.phase-divergent|changeset: 7:50c51b361e60]
992 992 [log.user|user: test]
993 993 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
994 994 [log.instability|instability: orphan, phase-divergent]
995 995 [log.summary|summary: add babar]
996 996
997 997
998 998 $ hg log --config ui.logtemplate= --color=debug -r "obsolete()"
999 999 [log.changeset changeset.draft changeset.obsolete|changeset: 6:3de5eca88c00]
1000 1000 [log.parent changeset.draft|parent: 3:6f9641995072]
1001 1001 [log.user|user: test]
1002 1002 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
1003 1003 [log.obsfate|obsolete: pruned]
1004 1004 [log.summary|summary: add obsolete_e]
1005 1005
1006 1006
1007 1007 $ hg log -T default -r 'obsolete()' --color=debug
1008 1008 [log.changeset changeset.draft changeset.obsolete|changeset: 6:3de5eca88c00]
1009 1009 [log.parent changeset.draft|parent: 3:6f9641995072]
1010 1010 [log.user|user: test]
1011 1011 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
1012 1012 [log.obsfate|obsolete: pruned]
1013 1013 [log.summary|summary: add obsolete_e]
1014 1014
1015 1015
1016 1016 test summary output
1017 1017
1018 1018 $ hg up -r 'phasedivergent() and orphan()'
1019 1019 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1020 1020 $ hg summary
1021 1021 parent: 7:50c51b361e60 (orphan, phase-divergent)
1022 1022 add babar
1023 1023 branch: default
1024 1024 commit: (clean)
1025 1025 update: 2 new changesets (update)
1026 1026 phases: 4 draft
1027 1027 orphan: 2 changesets
1028 1028 phase-divergent: 1 changesets
1029 1029 $ hg up -r 'obsolete()'
1030 1030 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1031 1031 $ hg summary
1032 1032 parent: 6:3de5eca88c00 (obsolete)
1033 1033 add obsolete_e
1034 1034 branch: default
1035 1035 commit: (clean)
1036 1036 update: 3 new changesets (update)
1037 1037 phases: 4 draft
1038 1038 orphan: 2 changesets
1039 1039 phase-divergent: 1 changesets
1040 1040
1041 1041 test debugwhyunstable output
1042 1042
1043 1043 $ hg debugwhyunstable 50c51b361e60
1044 1044 orphan: obsolete parent 3de5eca88c00aa039da7399a220f4a5221faa585
1045 1045 phase-divergent: immutable predecessor 245bde4270cd1072a27757984f9cda8ba26f08ca
1046 1046
1047 1047 test whyunstable template keyword
1048 1048
1049 1049 $ hg log -r 50c51b361e60 -T '{whyunstable}\n'
1050 1050 orphan: obsolete parent 3de5eca88c00
1051 1051 phase-divergent: immutable predecessor 245bde4270cd
1052 1052 $ hg log -r 50c51b361e60 -T '{whyunstable % "{instability}: {reason} {node|shortest}\n"}'
1053 1053 orphan: obsolete parent 3de5
1054 1054 phase-divergent: immutable predecessor 245b
1055 1055
1056 1056 #if serve
1057 1057
1058 1058 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
1059 1059 $ cat hg.pid >> $DAEMON_PIDS
1060 1060
1061 1061 check obsolete changeset
1062 1062
1063 1063 $ get-with-headers.py localhost:$HGPORT 'log?rev=first(obsolete())&style=paper' | grep '<span class="obsolete">'
1064 1064 <span class="phase">draft</span> <span class="obsolete">obsolete</span>
1065 1065 $ get-with-headers.py localhost:$HGPORT 'log?rev=first(obsolete())&style=coal' | grep '<span class="obsolete">'
1066 1066 <span class="phase">draft</span> <span class="obsolete">obsolete</span>
1067 1067 $ get-with-headers.py localhost:$HGPORT 'log?rev=first(obsolete())&style=gitweb' | grep '<span class="logtags">'
1068 1068 <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="obsoletetag" title="obsolete">obsolete</span> </span>
1069 1069 $ get-with-headers.py localhost:$HGPORT 'log?rev=first(obsolete())&style=monoblue' | grep '<span class="logtags">'
1070 1070 <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="obsoletetag" title="obsolete">obsolete</span> </span>
1071 1071 $ get-with-headers.py localhost:$HGPORT 'log?rev=first(obsolete())&style=spartan' | grep 'class="obsolete"'
1072 1072 <th class="obsolete">obsolete:</th>
1073 1073 <td class="obsolete">pruned by &#116;&#101;&#115;&#116; <span class="age">Thu, 01 Jan 1970 00:00:00 +0000</span></td>
1074 1074
1075 1075 check changeset with instabilities
1076 1076
1077 1077 $ get-with-headers.py localhost:$HGPORT 'log?rev=first(phasedivergent())&style=paper' | grep '<span class="instability">'
1078 1078 <span class="phase">draft</span> <span class="instability">orphan</span> <span class="instability">phase-divergent</span>
1079 1079 $ get-with-headers.py localhost:$HGPORT 'log?rev=first(phasedivergent())&style=coal' | grep '<span class="instability">'
1080 1080 <span class="phase">draft</span> <span class="instability">orphan</span> <span class="instability">phase-divergent</span>
1081 1081 $ get-with-headers.py localhost:$HGPORT 'log?rev=first(phasedivergent())&style=gitweb' | grep '<span class="logtags">'
1082 1082 <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="instabilitytag" title="orphan">orphan</span> <span class="instabilitytag" title="phase-divergent">phase-divergent</span> </span>
1083 1083 $ get-with-headers.py localhost:$HGPORT 'log?rev=first(phasedivergent())&style=monoblue' | grep '<span class="logtags">'
1084 1084 <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="instabilitytag" title="orphan">orphan</span> <span class="instabilitytag" title="phase-divergent">phase-divergent</span> </span>
1085 1085 $ get-with-headers.py localhost:$HGPORT 'log?rev=first(phasedivergent())&style=spartan' | grep 'class="unstable"'
1086 1086 <th class="unstable">unstable:</th>
1087 1087 <td class="unstable">orphan: obsolete parent <a href="/rev/3de5eca88c00?style=spartan">3de5eca88c00</a></td>
1088 1088 <th class="unstable">unstable:</th>
1089 1089 <td class="unstable">phase-divergent: immutable predecessor <a href="/rev/245bde4270cd?style=spartan">245bde4270cd</a></td>
1090 1090
1091 1091 check explanation for an orphan and phase-divergent changeset
1092 1092
1093 1093 $ get-with-headers.py localhost:$HGPORT 'rev/50c51b361e60?style=paper' | egrep '(orphan|phase-divergent):'
1094 1094 <td>orphan: obsolete parent <a href="/rev/3de5eca88c00?style=paper">3de5eca88c00</a><br>
1095 1095 phase-divergent: immutable predecessor <a href="/rev/245bde4270cd?style=paper">245bde4270cd</a></td>
1096 1096 $ get-with-headers.py localhost:$HGPORT 'rev/50c51b361e60?style=coal' | egrep '(orphan|phase-divergent):'
1097 1097 <td>orphan: obsolete parent <a href="/rev/3de5eca88c00?style=coal">3de5eca88c00</a><br>
1098 1098 phase-divergent: immutable predecessor <a href="/rev/245bde4270cd?style=coal">245bde4270cd</a></td>
1099 1099 $ get-with-headers.py localhost:$HGPORT 'rev/50c51b361e60?style=gitweb' | egrep '(orphan|phase-divergent):'
1100 1100 <td>orphan: obsolete parent <a class="list" href="/rev/3de5eca88c00?style=gitweb">3de5eca88c00</a></td>
1101 1101 <td>phase-divergent: immutable predecessor <a class="list" href="/rev/245bde4270cd?style=gitweb">245bde4270cd</a></td>
1102 1102 $ get-with-headers.py localhost:$HGPORT 'rev/50c51b361e60?style=monoblue' | egrep '(orphan|phase-divergent):'
1103 1103 <dd>orphan: obsolete parent <a href="/rev/3de5eca88c00?style=monoblue">3de5eca88c00</a></dd>
1104 1104 <dd>phase-divergent: immutable predecessor <a href="/rev/245bde4270cd?style=monoblue">245bde4270cd</a></dd>
1105 1105 $ get-with-headers.py localhost:$HGPORT 'rev/50c51b361e60?style=spartan' | egrep '(orphan|phase-divergent):'
1106 1106 <td class="unstable">orphan: obsolete parent <a href="/rev/3de5eca88c00?style=spartan">3de5eca88c00</a></td>
1107 1107 <td class="unstable">phase-divergent: immutable predecessor <a href="/rev/245bde4270cd?style=spartan">245bde4270cd</a></td>
1108 1108
1109 1109 $ killdaemons.py
1110 1110
1111 1111 $ rm hg.pid access.log errors.log
1112 1112
1113 1113 #endif
1114 1114
1115 1115 Test incoming/outcoming with changesets obsoleted remotely, known locally
1116 1116 ===============================================================================
1117 1117
1118 1118 This test issue 3805
1119 1119
1120 1120 $ hg init repo-issue3805
1121 1121 $ cd repo-issue3805
1122 1122 $ echo "base" > base
1123 1123 $ hg ci -Am "base"
1124 1124 adding base
1125 1125 $ echo "foo" > foo
1126 1126 $ hg ci -Am "A"
1127 1127 adding foo
1128 1128 $ hg clone . ../other-issue3805
1129 1129 updating to branch default
1130 1130 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1131 1131 $ echo "bar" >> foo
1132 1132 $ hg ci --amend
1133 1133 $ cd ../other-issue3805
1134 1134 $ hg log -G
1135 1135 @ 1:29f0c6921ddd (draft) [tip ] A
1136 1136 |
1137 1137 o 0:d20a80d4def3 (draft) [ ] base
1138 1138
1139 1139 $ hg log -G -R ../repo-issue3805
1140 1140 @ 2:323a9c3ddd91 (draft) [tip ] A
1141 1141 |
1142 1142 o 0:d20a80d4def3 (draft) [ ] base
1143 1143
1144 1144 $ hg incoming
1145 1145 comparing with $TESTTMP/tmpe/repo-issue3805
1146 1146 searching for changes
1147 1147 2:323a9c3ddd91 (draft) [tip ] A
1148 1148 $ hg incoming --bundle ../issue3805.hg
1149 1149 comparing with $TESTTMP/tmpe/repo-issue3805
1150 1150 searching for changes
1151 1151 2:323a9c3ddd91 (draft) [tip ] A
1152 1152 $ hg outgoing
1153 1153 comparing with $TESTTMP/tmpe/repo-issue3805
1154 1154 searching for changes
1155 1155 1:29f0c6921ddd (draft) [tip ] A
1156 1156
1157 1157 #if serve
1158 1158
1159 1159 $ hg serve -R ../repo-issue3805 -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
1160 1160 $ cat hg.pid >> $DAEMON_PIDS
1161 1161
1162 1162 $ hg incoming http://localhost:$HGPORT
1163 1163 comparing with http://localhost:$HGPORT/
1164 1164 searching for changes
1165 1165 2:323a9c3ddd91 (draft) [tip ] A
1166 1166 $ hg outgoing http://localhost:$HGPORT
1167 1167 comparing with http://localhost:$HGPORT/
1168 1168 searching for changes
1169 1169 1:29f0c6921ddd (draft) [tip ] A
1170 1170
1171 1171 $ killdaemons.py
1172 1172
1173 1173 #endif
1174 1174
1175 1175 This test issue 3814
1176 1176
1177 1177 (nothing to push but locally hidden changeset)
1178 1178
1179 1179 $ cd ..
1180 1180 $ hg init repo-issue3814
1181 1181 $ cd repo-issue3805
1182 1182 $ hg push -r 323a9c3ddd91 ../repo-issue3814
1183 1183 pushing to ../repo-issue3814
1184 1184 searching for changes
1185 1185 adding changesets
1186 1186 adding manifests
1187 1187 adding file changes
1188 1188 added 2 changesets with 2 changes to 2 files
1189 1189 1 new obsolescence markers
1190 1190 $ hg out ../repo-issue3814
1191 1191 comparing with ../repo-issue3814
1192 1192 searching for changes
1193 1193 no changes found
1194 1194 [1]
1195 1195
1196 1196 Test that a local tag blocks a changeset from being hidden
1197 1197
1198 1198 $ hg tag -l visible -r 1 --hidden
1199 1199 $ hg log -G
1200 1200 @ 2:323a9c3ddd91 (draft) [tip ] A
1201 1201 |
1202 1202 | x 1:29f0c6921ddd (draft *obsolete*) [visible ] A [rewritten using amend as 2:323a9c3ddd91]
1203 1203 |/
1204 1204 o 0:d20a80d4def3 (draft) [ ] base
1205 1205
1206 1206 Test that removing a local tag does not cause some commands to fail
1207 1207
1208 1208 $ hg tag -l -r tip tiptag
1209 1209 $ hg tags
1210 1210 tiptag 2:323a9c3ddd91
1211 1211 tip 2:323a9c3ddd91
1212 1212 visible 1:29f0c6921ddd
1213 1213 $ hg --config extensions.strip= strip -r tip --no-backup
1214 1214 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1215 1215 $ hg tags
1216 1216 visible 1:29f0c6921ddd
1217 1217 tip 1:29f0c6921ddd
1218 1218
1219 1219 Test bundle overlay onto hidden revision
1220 1220
1221 1221 $ cd ..
1222 1222 $ hg init repo-bundleoverlay
1223 1223 $ cd repo-bundleoverlay
1224 1224 $ echo "A" > foo
1225 1225 $ hg ci -Am "A"
1226 1226 adding foo
1227 1227 $ echo "B" >> foo
1228 1228 $ hg ci -m "B"
1229 1229 $ hg up 0
1230 1230 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1231 1231 $ echo "C" >> foo
1232 1232 $ hg ci -m "C"
1233 1233 created new head
1234 1234 $ hg log -G
1235 1235 @ 2:c186d7714947 (draft) [tip ] C
1236 1236 |
1237 1237 | o 1:44526ebb0f98 (draft) [ ] B
1238 1238 |/
1239 1239 o 0:4b34ecfb0d56 (draft) [ ] A
1240 1240
1241 1241
1242 1242 $ hg clone -r1 . ../other-bundleoverlay
1243 1243 adding changesets
1244 1244 adding manifests
1245 1245 adding file changes
1246 1246 added 2 changesets with 2 changes to 1 files
1247 1247 new changesets 4b34ecfb0d56:44526ebb0f98
1248 1248 updating to branch default
1249 1249 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1250 1250 $ cd ../other-bundleoverlay
1251 1251 $ echo "B+" >> foo
1252 1252 $ hg ci --amend -m "B+"
1253 1253 $ hg log -G --hidden
1254 1254 @ 2:b7d587542d40 (draft) [tip ] B+
1255 1255 |
1256 1256 | x 1:44526ebb0f98 (draft *obsolete*) [ ] B [rewritten using amend as 2:b7d587542d40]
1257 1257 |/
1258 1258 o 0:4b34ecfb0d56 (draft) [ ] A
1259 1259
1260 1260
1261 1261 #if repobundlerepo
1262 1262 $ hg incoming ../repo-bundleoverlay --bundle ../bundleoverlay.hg
1263 1263 comparing with ../repo-bundleoverlay
1264 1264 searching for changes
1265 1265 1:44526ebb0f98 (draft) [ ] B
1266 1266 2:c186d7714947 (draft) [tip ] C
1267 1267 $ hg log -G -R ../bundleoverlay.hg
1268 1268 o 3:c186d7714947 (draft) [tip ] C
1269 1269 |
1270 1270 | @ 2:b7d587542d40 (draft) [ ] B+
1271 1271 |/
1272 1272 o 0:4b34ecfb0d56 (draft) [ ] A
1273 1273
1274 1274 #endif
1275 1275
1276 1276 #if serve
1277 1277
1278 1278 Test issue 4506
1279 1279
1280 1280 $ cd ..
1281 1281 $ hg init repo-issue4506
1282 1282 $ cd repo-issue4506
1283 1283 $ echo "0" > foo
1284 1284 $ hg add foo
1285 1285 $ hg ci -m "content-0"
1286 1286
1287 1287 $ hg up null
1288 1288 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1289 1289 $ echo "1" > bar
1290 1290 $ hg add bar
1291 1291 $ hg ci -m "content-1"
1292 1292 created new head
1293 1293 $ hg up 0
1294 1294 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1295 1295 $ hg graft 1
1296 1296 grafting 1:1c9eddb02162 "content-1" (tip)
1297 1297
1298 1298 $ hg debugobsolete `hg log -r1 -T'{node}'` `hg log -r2 -T'{node}'`
1299 1299 obsoleted 1 changesets
1300 1300
1301 1301 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
1302 1302 $ cat hg.pid >> $DAEMON_PIDS
1303 1303
1304 1304 $ get-with-headers.py --headeronly localhost:$HGPORT 'rev/1'
1305 1305 404 Not Found
1306 1306 [1]
1307 1307 $ get-with-headers.py --headeronly localhost:$HGPORT 'file/tip/bar'
1308 1308 200 Script output follows
1309 1309 $ get-with-headers.py --headeronly localhost:$HGPORT 'annotate/tip/bar'
1310 1310 200 Script output follows
1311 1311
1312 1312 $ killdaemons.py
1313 1313
1314 1314 #endif
1315 1315
1316 1316 Test heads computation on pending index changes with obsolescence markers
1317 1317 $ cd ..
1318 1318 $ cat >$TESTTMP/test_extension.py << EOF
1319 1319 > from __future__ import absolute_import
1320 1320 > from mercurial.i18n import _
1321 1321 > from mercurial import cmdutil, registrar
1322 1322 >
1323 1323 > cmdtable = {}
1324 1324 > command = registrar.command(cmdtable)
1325 1325 > @command(b"amendtransient",[], _(b'hg amendtransient [rev]'))
1326 1326 > def amend(ui, repo, *pats, **opts):
1327 1327 > opts['message'] = 'Test'
1328 1328 > opts['logfile'] = None
1329 1329 > cmdutil.amend(ui, repo, repo['.'], {}, pats, opts)
1330 1330 > ui.write(b'%s\n' % repo.changelog.headrevs())
1331 1331 > EOF
1332 1332 $ cat >> $HGRCPATH << EOF
1333 1333 > [extensions]
1334 1334 > testextension=$TESTTMP/test_extension.py
1335 1335 > EOF
1336 1336 $ hg init repo-issue-nativerevs-pending-changes
1337 1337 $ cd repo-issue-nativerevs-pending-changes
1338 1338 $ mkcommit a
1339 1339 $ mkcommit b
1340 1340 $ hg up ".^"
1341 1341 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1342 1342 $ echo aa > a
1343 1343 $ hg amendtransient
1344 1344 1 new orphan changesets
1345 1345 [1, 2]
1346 1346
1347 1347 Test cache consistency for the visible filter
1348 1348 1) We want to make sure that the cached filtered revs are invalidated when
1349 1349 bookmarks change
1350 1350 $ cd ..
1351 1351 $ cat >$TESTTMP/test_extension.py << EOF
1352 1352 > from __future__ import absolute_import, print_function
1353 1353 > import weakref
1354 1354 > from mercurial import (
1355 1355 > bookmarks,
1356 1356 > cmdutil,
1357 1357 > extensions,
1358 1358 > repoview,
1359 1359 > )
1360 1360 > def _bookmarkchanged(orig, bkmstoreinst, *args, **kwargs):
1361 1361 > reporef = weakref.ref(bkmstoreinst._repo)
1362 1362 > def trhook(tr):
1363 1363 > repo = reporef()
1364 1364 > hidden1 = repoview.computehidden(repo)
1365 1365 > hidden = repoview.filterrevs(repo, b'visible')
1366 1366 > if sorted(hidden1) != sorted(hidden):
1367 1367 > print("cache inconsistency")
1368 1368 > bkmstoreinst._repo.currenttransaction().addpostclose('test_extension', trhook)
1369 1369 > orig(bkmstoreinst, *args, **kwargs)
1370 1370 > def extsetup(ui):
1371 1371 > extensions.wrapfunction(bookmarks.bmstore, '_recordchange',
1372 1372 > _bookmarkchanged)
1373 1373 > EOF
1374 1374
1375 1375 $ hg init repo-cache-inconsistency
1376 1376 $ cd repo-issue-nativerevs-pending-changes
1377 1377 $ mkcommit a
1378 1378 a already tracked!
1379 1379 $ mkcommit b
1380 1380 $ hg id
1381 1381 13bedc178fce tip
1382 1382 $ echo "hello" > b
1383 1383 $ hg commit --amend -m "message"
1384 1384 $ hg book bookb -r 13bedc178fce --hidden
1385 1385 bookmarking hidden changeset 13bedc178fce
1386 1386 (hidden revision '13bedc178fce' was rewritten as: a9b1f8652753)
1387 1387 $ hg log -r 13bedc178fce
1388 1388 4:13bedc178fce (draft *obsolete*) [ bookb] add b [rewritten using amend as 5:a9b1f8652753]
1389 1389 $ hg book -d bookb
1390 1390 $ hg log -r 13bedc178fce
1391 1391 abort: hidden revision '13bedc178fce' was rewritten as: a9b1f8652753!
1392 1392 (use --hidden to access hidden revisions)
1393 1393 [255]
1394 1394
1395 1395 Empty out the test extension, as it isn't compatible with later parts
1396 1396 of the test.
1397 1397 $ echo > $TESTTMP/test_extension.py
1398 1398
1399 1399 Test ability to pull changeset with locally applying obsolescence markers
1400 1400 (issue4945)
1401 1401
1402 1402 $ cd ..
1403 1403 $ hg init issue4845
1404 1404 $ cd issue4845
1405 1405
1406 1406 $ echo foo > f0
1407 1407 $ hg add f0
1408 1408 $ hg ci -m '0'
1409 1409 $ echo foo > f1
1410 1410 $ hg add f1
1411 1411 $ hg ci -m '1'
1412 1412 $ echo foo > f2
1413 1413 $ hg add f2
1414 1414 $ hg ci -m '2'
1415 1415
1416 1416 $ echo bar > f2
1417 1417 $ hg commit --amend --config experimental.evolution.createmarkers=True
1418 1418 $ hg log -G
1419 1419 @ 3:b0551702f918 (draft) [tip ] 2
1420 1420 |
1421 1421 o 1:e016b03fd86f (draft) [ ] 1
1422 1422 |
1423 1423 o 0:a78f55e5508c (draft) [ ] 0
1424 1424
1425 1425 $ hg log -G --hidden
1426 1426 @ 3:b0551702f918 (draft) [tip ] 2
1427 1427 |
1428 1428 | x 2:e008cf283490 (draft *obsolete*) [ ] 2 [rewritten using amend as 3:b0551702f918]
1429 1429 |/
1430 1430 o 1:e016b03fd86f (draft) [ ] 1
1431 1431 |
1432 1432 o 0:a78f55e5508c (draft) [ ] 0
1433 1433
1434 1434
1435 1435 $ hg strip --hidden -r 2 --config extensions.strip= --config devel.strip-obsmarkers=no
1436 1436 saved backup bundle to $TESTTMP/tmpe/issue4845/.hg/strip-backup/e008cf283490-ede36964-backup.hg
1437 1437 $ hg debugobsolete
1438 1438 e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
1439 1439 $ hg log -G
1440 1440 @ 2:b0551702f918 (draft) [tip ] 2
1441 1441 |
1442 1442 o 1:e016b03fd86f (draft) [ ] 1
1443 1443 |
1444 1444 o 0:a78f55e5508c (draft) [ ] 0
1445 1445
1446 1446 $ hg log -G --hidden
1447 1447 @ 2:b0551702f918 (draft) [tip ] 2
1448 1448 |
1449 1449 o 1:e016b03fd86f (draft) [ ] 1
1450 1450 |
1451 1451 o 0:a78f55e5508c (draft) [ ] 0
1452 1452
1453 1453 $ hg debugbundle .hg/strip-backup/e008cf283490-*-backup.hg
1454 1454 Stream params: {Compression: BZ}
1455 1455 changegroup -- {nbchanges: 1, version: 02}
1456 1456 e008cf2834908e5d6b0f792a9d4b0e2272260fb8
1457 1457 cache:rev-branch-cache -- {}
1458 1458 phase-heads -- {}
1459 1459 e008cf2834908e5d6b0f792a9d4b0e2272260fb8 draft
1460 1460
1461 1461 #if repobundlerepo
1462 1462 $ hg pull .hg/strip-backup/e008cf283490-*-backup.hg
1463 1463 pulling from .hg/strip-backup/e008cf283490-ede36964-backup.hg
1464 1464 searching for changes
1465 1465 no changes found
1466 1466 #endif
1467 1467 $ hg debugobsolete
1468 1468 e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
1469 1469 $ hg log -G
1470 1470 @ 2:b0551702f918 (draft) [tip ] 2
1471 1471 |
1472 1472 o 1:e016b03fd86f (draft) [ ] 1
1473 1473 |
1474 1474 o 0:a78f55e5508c (draft) [ ] 0
1475 1475
1476 1476 $ hg log -G --hidden
1477 1477 @ 2:b0551702f918 (draft) [tip ] 2
1478 1478 |
1479 1479 o 1:e016b03fd86f (draft) [ ] 1
1480 1480 |
1481 1481 o 0:a78f55e5508c (draft) [ ] 0
1482 1482
1483 1483
1484 1484 Testing that strip remove markers:
1485 1485
1486 1486 $ hg strip -r 1 --config extensions.strip=
1487 1487 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1488 1488 saved backup bundle to $TESTTMP/tmpe/issue4845/.hg/strip-backup/e016b03fd86f-65ede734-backup.hg
1489 1489 $ hg debugobsolete
1490 1490 $ hg log -G
1491 1491 @ 0:a78f55e5508c (draft) [tip ] 0
1492 1492
1493 1493 $ hg log -G --hidden
1494 1494 @ 0:a78f55e5508c (draft) [tip ] 0
1495 1495
1496 1496 $ hg debugbundle .hg/strip-backup/e016b03fd86f-*-backup.hg
1497 1497 Stream params: {Compression: BZ}
1498 1498 changegroup -- {nbchanges: 2, version: 02}
1499 1499 e016b03fd86fcccc54817d120b90b751aaf367d6
1500 1500 b0551702f918510f01ae838ab03a463054c67b46
1501 1501 cache:rev-branch-cache -- {}
1502 1502 obsmarkers -- {}
1503 1503 version: 1 (92 bytes)
1504 1504 e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
1505 1505 phase-heads -- {}
1506 1506 b0551702f918510f01ae838ab03a463054c67b46 draft
1507 1507
1508 1508 $ hg unbundle .hg/strip-backup/e016b03fd86f-*-backup.hg
1509 1509 adding changesets
1510 1510 adding manifests
1511 1511 adding file changes
1512 1512 added 2 changesets with 2 changes to 2 files
1513 1513 1 new obsolescence markers
1514 1514 new changesets e016b03fd86f:b0551702f918
1515 1515 (run 'hg update' to get a working copy)
1516 1516 $ hg debugobsolete | sort
1517 1517 e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
1518 1518 $ hg log -G
1519 1519 o 2:b0551702f918 (draft) [tip ] 2
1520 1520 |
1521 1521 o 1:e016b03fd86f (draft) [ ] 1
1522 1522 |
1523 1523 @ 0:a78f55e5508c (draft) [ ] 0
1524 1524
1525 1525 $ hg log -G --hidden
1526 1526 o 2:b0551702f918 (draft) [tip ] 2
1527 1527 |
1528 1528 o 1:e016b03fd86f (draft) [ ] 1
1529 1529 |
1530 1530 @ 0:a78f55e5508c (draft) [ ] 0
1531 1531
1532 1532 Test that 'hg debugobsolete --index --rev' can show indices of obsmarkers when
1533 1533 only a subset of those are displayed (because of --rev option)
1534 1534 $ hg init doindexrev
1535 1535 $ cd doindexrev
1536 1536 $ echo a > a
1537 1537 $ hg ci -Am a
1538 1538 adding a
1539 1539 $ hg ci --amend -m aa
1540 1540 $ echo b > b
1541 1541 $ hg ci -Am b
1542 1542 adding b
1543 1543 $ hg ci --amend -m bb
1544 1544 $ echo c > c
1545 1545 $ hg ci -Am c
1546 1546 adding c
1547 1547 $ hg ci --amend -m cc
1548 1548 $ echo d > d
1549 1549 $ hg ci -Am d
1550 1550 adding d
1551 1551 $ hg ci --amend -m dd --config experimental.evolution.track-operation=1
1552 1552 $ hg debugobsolete --index --rev "3+7"
1553 1553 1 6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1 d27fb9b066076fd921277a4b9e8b9cb48c95bc6a 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
1554 1554 3 4715cf767440ed891755448016c2b8cf70760c30 7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
1555 1555 $ hg debugobsolete --index --rev "3+7" -Tjson
1556 1556 [
1557 1557 {
1558 1558 "date": [0, 0],
1559 1559 "flag": 0,
1560 1560 "index": 1,
1561 1561 "metadata": {"ef1": "1", "operation": "amend", "user": "test"},
1562 1562 "prednode": "6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1",
1563 1563 "succnodes": ["d27fb9b066076fd921277a4b9e8b9cb48c95bc6a"]
1564 1564 },
1565 1565 {
1566 1566 "date": [0, 0],
1567 1567 "flag": 0,
1568 1568 "index": 3,
1569 1569 "metadata": {"ef1": "1", "operation": "amend", "user": "test"},
1570 1570 "prednode": "4715cf767440ed891755448016c2b8cf70760c30",
1571 1571 "succnodes": ["7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d"]
1572 1572 }
1573 1573 ]
1574 1574
1575 1575 Test the --delete option of debugobsolete command
1576 1576 $ hg debugobsolete --index
1577 1577 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b f9bd49731b0b175e42992a3c8fa6c678b2bc11f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
1578 1578 1 6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1 d27fb9b066076fd921277a4b9e8b9cb48c95bc6a 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
1579 1579 2 1ab51af8f9b41ef8c7f6f3312d4706d870b1fb74 29346082e4a9e27042b62d2da0e2de211c027621 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
1580 1580 3 4715cf767440ed891755448016c2b8cf70760c30 7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
1581 1581 $ hg debugobsolete --delete 1 --delete 3
1582 1582 deleted 2 obsolescence markers
1583 1583 $ hg debugobsolete
1584 1584 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b f9bd49731b0b175e42992a3c8fa6c678b2bc11f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
1585 1585 1ab51af8f9b41ef8c7f6f3312d4706d870b1fb74 29346082e4a9e27042b62d2da0e2de211c027621 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
1586 1586
1587 1587 Test adding changeset after obsmarkers affecting it
1588 1588 (eg: during pull, or unbundle)
1589 1589
1590 1590 $ mkcommit e
1591 1591 $ hg bundle -r . --base .~1 ../bundle-2.hg
1592 1592 1 changesets found
1593 1593 $ getid .
1594 1594 $ hg --config extensions.strip= strip -r .
1595 1595 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1596 1596 saved backup bundle to $TESTTMP/tmpe/issue4845/doindexrev/.hg/strip-backup/9bc153528424-ee80edd4-backup.hg
1597 1597 $ hg debugobsolete 9bc153528424ea266d13e57f9ff0d799dfe61e4b
1598 1598 $ hg unbundle ../bundle-2.hg
1599 1599 adding changesets
1600 1600 adding manifests
1601 1601 adding file changes
1602 1602 added 1 changesets with 1 changes to 1 files
1603 1603 (run 'hg update' to get a working copy)
1604 1604 $ hg log -G
1605 1605 @ 7:7ae79c5d60f0 (draft) [tip ] dd
1606 1606 |
1607 1607 | o 6:4715cf767440 (draft) [ ] d
1608 1608 |/
1609 1609 o 5:29346082e4a9 (draft) [ ] cc
1610 1610 |
1611 1611 o 3:d27fb9b06607 (draft) [ ] bb
1612 1612 |
1613 1613 | o 2:6fdef60fcbab (draft) [ ] b
1614 1614 |/
1615 1615 o 1:f9bd49731b0b (draft) [ ] aa
1616 1616
1617 1617
1618 1618 $ cd ..
@@ -1,1624 +1,1623 b''
1 1 This file tests the behavior of run-tests.py itself.
2 2
3 3 Avoid interference from actual test env:
4 4
5 5 $ . "$TESTDIR/helper-runtests.sh"
6 6
7 7 Smoke test with install
8 8 ============
9 9 $ $PYTHON $TESTDIR/run-tests.py $HGTEST_RUN_TESTS_PURE -l
10 10
11 11 # Ran 0 tests, 0 skipped, 0 failed.
12 12
13 13 Define a helper to avoid the install step
14 14 =============
15 15 $ rt()
16 16 > {
17 17 > $PYTHON $TESTDIR/run-tests.py --with-hg=`which hg` "$@"
18 18 > }
19 19
20 20 error paths
21 21
22 22 #if symlink
23 23 $ ln -s `which true` hg
24 24 $ $PYTHON $TESTDIR/run-tests.py --with-hg=./hg
25 25 warning: --with-hg should specify an hg script
26 26
27 27 # Ran 0 tests, 0 skipped, 0 failed.
28 28 $ rm hg
29 29 #endif
30 30
31 31 #if execbit
32 32 $ touch hg
33 33 $ $PYTHON $TESTDIR/run-tests.py --with-hg=./hg
34 34 usage: run-tests.py [options] [tests]
35 35 run-tests.py: error: --with-hg must specify an executable hg script
36 36 [2]
37 37 $ rm hg
38 38 #endif
39 39
40 40 Features for testing optional lines
41 41 ===================================
42 42
43 43 $ cat > hghaveaddon.py <<EOF
44 44 > import hghave
45 45 > @hghave.check("custom", "custom hghave feature")
46 46 > def has_custom():
47 47 > return True
48 48 > @hghave.check("missing", "missing hghave feature")
49 49 > def has_missing():
50 50 > return False
51 51 > EOF
52 52
53 53 an empty test
54 54 =======================
55 55
56 56 $ touch test-empty.t
57 57 $ rt
58 58 .
59 59 # Ran 1 tests, 0 skipped, 0 failed.
60 60 $ rm test-empty.t
61 61
62 62 a succesful test
63 63 =======================
64 64
65 65 $ cat > test-success.t << EOF
66 66 > $ echo babar
67 67 > babar
68 68 > $ echo xyzzy
69 69 > dont_print (?)
70 70 > nothing[42]line (re) (?)
71 71 > never*happens (glob) (?)
72 72 > more_nothing (?)
73 73 > xyzzy
74 74 > nor this (?)
75 75 > $ printf 'abc\ndef\nxyz\n'
76 76 > 123 (?)
77 77 > abc
78 78 > def (?)
79 79 > 456 (?)
80 80 > xyz
81 81 > $ printf 'zyx\nwvu\ntsr\n'
82 82 > abc (?)
83 83 > zyx (custom !)
84 84 > wvu
85 85 > no_print (no-custom !)
86 86 > tsr (no-missing !)
87 87 > missing (missing !)
88 88 > EOF
89 89
90 90 $ rt
91 91 .
92 92 # Ran 1 tests, 0 skipped, 0 failed.
93 93
94 94 failing test
95 95 ==================
96 96
97 97 test churn with globs
98 98 $ cat > test-failure.t <<EOF
99 99 > $ echo "bar-baz"; echo "bar-bad"; echo foo
100 100 > bar*bad (glob)
101 101 > bar*baz (glob)
102 102 > | fo (re)
103 103 > EOF
104 104 $ rt test-failure.t
105 105
106 106 --- $TESTTMP/test-failure.t
107 107 +++ $TESTTMP/test-failure.t.err
108 108 @@ -1,4 +1,4 @@
109 109 $ echo "bar-baz"; echo "bar-bad"; echo foo
110 110 + bar*baz (glob)
111 111 bar*bad (glob)
112 112 - bar*baz (glob)
113 113 - | fo (re)
114 114 + foo
115 115
116 116 ERROR: test-failure.t output changed
117 117 !
118 118 Failed test-failure.t: output changed
119 119 # Ran 1 tests, 0 skipped, 1 failed.
120 120 python hash seed: * (glob)
121 121 [1]
122 122
123 123 test diff colorisation
124 124
125 125 #if no-windows pygments
126 126 $ rt test-failure.t --color always
127 127
128 128 \x1b[38;5;124m--- $TESTTMP/test-failure.t\x1b[39m (esc)
129 129 \x1b[38;5;34m+++ $TESTTMP/test-failure.t.err\x1b[39m (esc)
130 130 \x1b[38;5;90;01m@@ -1,4 +1,4 @@\x1b[39;00m (esc)
131 131 $ echo "bar-baz"; echo "bar-bad"; echo foo
132 132 \x1b[38;5;34m+ bar*baz (glob)\x1b[39m (esc)
133 133 bar*bad (glob)
134 134 \x1b[38;5;124m- bar*baz (glob)\x1b[39m (esc)
135 135 \x1b[38;5;124m- | fo (re)\x1b[39m (esc)
136 136 \x1b[38;5;34m+ foo\x1b[39m (esc)
137 137
138 138 \x1b[38;5;88mERROR: \x1b[39m\x1b[38;5;9mtest-failure.t\x1b[39m\x1b[38;5;88m output changed\x1b[39m (esc)
139 139 !
140 140 \x1b[38;5;88mFailed \x1b[39m\x1b[38;5;9mtest-failure.t\x1b[39m\x1b[38;5;88m: output changed\x1b[39m (esc)
141 141 # Ran 1 tests, 0 skipped, 1 failed.
142 142 python hash seed: * (glob)
143 143 [1]
144 144
145 145 $ rt test-failure.t 2> tmp.log
146 146 [1]
147 147 $ cat tmp.log
148 148
149 149 --- $TESTTMP/test-failure.t
150 150 +++ $TESTTMP/test-failure.t.err
151 151 @@ -1,4 +1,4 @@
152 152 $ echo "bar-baz"; echo "bar-bad"; echo foo
153 153 + bar*baz (glob)
154 154 bar*bad (glob)
155 155 - bar*baz (glob)
156 156 - | fo (re)
157 157 + foo
158 158
159 159 ERROR: test-failure.t output changed
160 160 !
161 161 Failed test-failure.t: output changed
162 162 # Ran 1 tests, 0 skipped, 1 failed.
163 163 python hash seed: * (glob)
164 164 #endif
165 165
166 166 $ cat > test-failure.t << EOF
167 167 > $ true
168 168 > should go away (true !)
169 169 > $ true
170 170 > should stay (false !)
171 171 >
172 172 > Should remove first line, not second or third
173 173 > $ echo 'testing'
174 174 > baz*foo (glob) (true !)
175 175 > foobar*foo (glob) (false !)
176 176 > te*ting (glob) (true !)
177 177 >
178 178 > Should keep first two lines, remove third and last
179 179 > $ echo 'testing'
180 180 > test.ng (re) (true !)
181 181 > foo.ar (re) (false !)
182 182 > b.r (re) (true !)
183 183 > missing (?)
184 184 > awol (true !)
185 185 >
186 186 > The "missing" line should stay, even though awol is dropped
187 187 > $ echo 'testing'
188 188 > test.ng (re) (true !)
189 189 > foo.ar (?)
190 190 > awol
191 191 > missing (?)
192 192 > EOF
193 193 $ rt test-failure.t
194 194
195 195 --- $TESTTMP/test-failure.t
196 196 +++ $TESTTMP/test-failure.t.err
197 197 @@ -1,11 +1,9 @@
198 198 $ true
199 199 - should go away (true !)
200 200 $ true
201 201 should stay (false !)
202 202
203 203 Should remove first line, not second or third
204 204 $ echo 'testing'
205 205 - baz*foo (glob) (true !)
206 206 foobar*foo (glob) (false !)
207 207 te*ting (glob) (true !)
208 208
209 209 foo.ar (re) (false !)
210 210 missing (?)
211 211 @@ -13,13 +11,10 @@
212 212 $ echo 'testing'
213 213 test.ng (re) (true !)
214 214 foo.ar (re) (false !)
215 215 - b.r (re) (true !)
216 216 missing (?)
217 217 - awol (true !)
218 218
219 219 The "missing" line should stay, even though awol is dropped
220 220 $ echo 'testing'
221 221 test.ng (re) (true !)
222 222 foo.ar (?)
223 223 - awol
224 224 missing (?)
225 225
226 226 ERROR: test-failure.t output changed
227 227 !
228 228 Failed test-failure.t: output changed
229 229 # Ran 1 tests, 0 skipped, 1 failed.
230 230 python hash seed: * (glob)
231 231 [1]
232 232
233 233 basic failing test
234 234 $ cat > test-failure.t << EOF
235 235 > $ echo babar
236 236 > rataxes
237 237 > This is a noop statement so that
238 238 > this test is still more bytes than success.
239 239 > pad pad pad pad............................................................
240 240 > pad pad pad pad............................................................
241 241 > pad pad pad pad............................................................
242 242 > pad pad pad pad............................................................
243 243 > pad pad pad pad............................................................
244 244 > pad pad pad pad............................................................
245 245 > EOF
246 246
247 247 >>> fh = open('test-failure-unicode.t', 'wb')
248 248 >>> fh.write(u' $ echo babar\u03b1\n'.encode('utf-8')) and None
249 249 >>> fh.write(u' l\u03b5\u03b5t\n'.encode('utf-8')) and None
250 250
251 251 $ rt
252 252
253 253 --- $TESTTMP/test-failure.t
254 254 +++ $TESTTMP/test-failure.t.err
255 255 @@ -1,5 +1,5 @@
256 256 $ echo babar
257 257 - rataxes
258 258 + babar
259 259 This is a noop statement so that
260 260 this test is still more bytes than success.
261 261 pad pad pad pad............................................................
262 262
263 263 ERROR: test-failure.t output changed
264 264 !.
265 265 --- $TESTTMP/test-failure-unicode.t
266 266 +++ $TESTTMP/test-failure-unicode.t.err
267 267 @@ -1,2 +1,2 @@
268 268 $ echo babar\xce\xb1 (esc)
269 269 - l\xce\xb5\xce\xb5t (esc)
270 270 + babar\xce\xb1 (esc)
271 271
272 272 ERROR: test-failure-unicode.t output changed
273 273 !
274 274 Failed test-failure.t: output changed
275 275 Failed test-failure-unicode.t: output changed
276 276 # Ran 3 tests, 0 skipped, 2 failed.
277 277 python hash seed: * (glob)
278 278 [1]
279 279
280 280 test --outputdir
281 281 $ mkdir output
282 282 $ rt --outputdir output
283 283
284 284 --- $TESTTMP/test-failure.t
285 285 +++ $TESTTMP/output/test-failure.t.err
286 286 @@ -1,5 +1,5 @@
287 287 $ echo babar
288 288 - rataxes
289 289 + babar
290 290 This is a noop statement so that
291 291 this test is still more bytes than success.
292 292 pad pad pad pad............................................................
293 293
294 294 ERROR: test-failure.t output changed
295 295 !.
296 296 --- $TESTTMP/test-failure-unicode.t
297 297 +++ $TESTTMP/output/test-failure-unicode.t.err
298 298 @@ -1,2 +1,2 @@
299 299 $ echo babar\xce\xb1 (esc)
300 300 - l\xce\xb5\xce\xb5t (esc)
301 301 + babar\xce\xb1 (esc)
302 302
303 303 ERROR: test-failure-unicode.t output changed
304 304 !
305 305 Failed test-failure.t: output changed
306 306 Failed test-failure-unicode.t: output changed
307 307 # Ran 3 tests, 0 skipped, 2 failed.
308 308 python hash seed: * (glob)
309 309 [1]
310 310 $ ls -a output
311 311 .
312 312 ..
313 313 .testtimes
314 314 test-failure-unicode.t.err
315 315 test-failure.t.err
316 316
317 317 test --xunit support
318 318 $ rt --xunit=xunit.xml
319 319
320 320 --- $TESTTMP/test-failure.t
321 321 +++ $TESTTMP/test-failure.t.err
322 322 @@ -1,5 +1,5 @@
323 323 $ echo babar
324 324 - rataxes
325 325 + babar
326 326 This is a noop statement so that
327 327 this test is still more bytes than success.
328 328 pad pad pad pad............................................................
329 329
330 330 ERROR: test-failure.t output changed
331 331 !.
332 332 --- $TESTTMP/test-failure-unicode.t
333 333 +++ $TESTTMP/test-failure-unicode.t.err
334 334 @@ -1,2 +1,2 @@
335 335 $ echo babar\xce\xb1 (esc)
336 336 - l\xce\xb5\xce\xb5t (esc)
337 337 + babar\xce\xb1 (esc)
338 338
339 339 ERROR: test-failure-unicode.t output changed
340 340 !
341 341 Failed test-failure.t: output changed
342 342 Failed test-failure-unicode.t: output changed
343 343 # Ran 3 tests, 0 skipped, 2 failed.
344 344 python hash seed: * (glob)
345 345 [1]
346 346 $ cat xunit.xml
347 347 <?xml version="1.0" encoding="utf-8"?>
348 348 <testsuite errors="0" failures="2" name="run-tests" skipped="0" tests="3">
349 349 <testcase name="test-success.t" time="*"/> (glob)
350 350 <testcase name="test-failure-unicode.t" time="*"> (glob)
351 351 <failure message="output changed" type="output-mismatch">
352 352 <![CDATA[--- $TESTTMP/test-failure-unicode.t
353 353 +++ $TESTTMP/test-failure-unicode.t.err
354 354 @@ -1,2 +1,2 @@
355 355 $ echo babar\xce\xb1 (esc)
356 356 - l\xce\xb5\xce\xb5t (esc)
357 357 + babar\xce\xb1 (esc)
358 358 ]]> </failure>
359 359 </testcase>
360 360 <testcase name="test-failure.t" time="*"> (glob)
361 361 <failure message="output changed" type="output-mismatch">
362 362 <![CDATA[--- $TESTTMP/test-failure.t
363 363 +++ $TESTTMP/test-failure.t.err
364 364 @@ -1,5 +1,5 @@
365 365 $ echo babar
366 366 - rataxes
367 367 + babar
368 368 This is a noop statement so that
369 369 this test is still more bytes than success.
370 370 pad pad pad pad............................................................
371 371 ]]> </failure>
372 372 </testcase>
373 373 </testsuite>
374 374
375 375 $ cat .testtimes
376 376 test-empty.t * (glob)
377 377 test-failure-unicode.t * (glob)
378 378 test-failure.t * (glob)
379 379 test-success.t * (glob)
380 380
381 381 $ rt --list-tests
382 382 test-failure-unicode.t
383 383 test-failure.t
384 384 test-success.t
385 385
386 386 $ rt --list-tests --json
387 387 test-failure-unicode.t
388 388 test-failure.t
389 389 test-success.t
390 390 $ cat report.json
391 391 testreport ={
392 392 "test-failure-unicode.t": {
393 393 "result": "success"
394 394 },
395 395 "test-failure.t": {
396 396 "result": "success"
397 397 },
398 398 "test-success.t": {
399 399 "result": "success"
400 400 }
401 401 } (no-eol)
402 402
403 403 $ rt --list-tests --xunit=xunit.xml
404 404 test-failure-unicode.t
405 405 test-failure.t
406 406 test-success.t
407 407 $ cat xunit.xml
408 408 <?xml version="1.0" encoding="utf-8"?>
409 409 <testsuite errors="0" failures="0" name="run-tests" skipped="0" tests="0">
410 410 <testcase name="test-failure-unicode.t"/>
411 411 <testcase name="test-failure.t"/>
412 412 <testcase name="test-success.t"/>
413 413 </testsuite>
414 414
415 415 $ rt --list-tests test-failure* --json --xunit=xunit.xml --outputdir output
416 416 test-failure-unicode.t
417 417 test-failure.t
418 418 $ cat output/report.json
419 419 testreport ={
420 420 "test-failure-unicode.t": {
421 421 "result": "success"
422 422 },
423 423 "test-failure.t": {
424 424 "result": "success"
425 425 }
426 426 } (no-eol)
427 427 $ cat xunit.xml
428 428 <?xml version="1.0" encoding="utf-8"?>
429 429 <testsuite errors="0" failures="0" name="run-tests" skipped="0" tests="0">
430 430 <testcase name="test-failure-unicode.t"/>
431 431 <testcase name="test-failure.t"/>
432 432 </testsuite>
433 433
434 434 $ rm test-failure-unicode.t
435 435
436 436 test for --retest
437 437 ====================
438 438
439 439 $ rt --retest
440 440
441 441 --- $TESTTMP/test-failure.t
442 442 +++ $TESTTMP/test-failure.t.err
443 443 @@ -1,5 +1,5 @@
444 444 $ echo babar
445 445 - rataxes
446 446 + babar
447 447 This is a noop statement so that
448 448 this test is still more bytes than success.
449 449 pad pad pad pad............................................................
450 450
451 451 ERROR: test-failure.t output changed
452 452 !
453 453 Failed test-failure.t: output changed
454 454 # Ran 2 tests, 1 skipped, 1 failed.
455 455 python hash seed: * (glob)
456 456 [1]
457 457
458 458 --retest works with --outputdir
459 459 $ rm -r output
460 460 $ mkdir output
461 461 $ mv test-failure.t.err output
462 462 $ rt --retest --outputdir output
463 463
464 464 --- $TESTTMP/test-failure.t
465 465 +++ $TESTTMP/output/test-failure.t.err
466 466 @@ -1,5 +1,5 @@
467 467 $ echo babar
468 468 - rataxes
469 469 + babar
470 470 This is a noop statement so that
471 471 this test is still more bytes than success.
472 472 pad pad pad pad............................................................
473 473
474 474 ERROR: test-failure.t output changed
475 475 !
476 476 Failed test-failure.t: output changed
477 477 # Ran 2 tests, 1 skipped, 1 failed.
478 478 python hash seed: * (glob)
479 479 [1]
480 480
481 481 Selecting Tests To Run
482 482 ======================
483 483
484 484 successful
485 485
486 486 $ rt test-success.t
487 487 .
488 488 # Ran 1 tests, 0 skipped, 0 failed.
489 489
490 490 success w/ keyword
491 491 $ rt -k xyzzy
492 492 .
493 493 # Ran 2 tests, 1 skipped, 0 failed.
494 494
495 495 failed
496 496
497 497 $ rt test-failure.t
498 498
499 499 --- $TESTTMP/test-failure.t
500 500 +++ $TESTTMP/test-failure.t.err
501 501 @@ -1,5 +1,5 @@
502 502 $ echo babar
503 503 - rataxes
504 504 + babar
505 505 This is a noop statement so that
506 506 this test is still more bytes than success.
507 507 pad pad pad pad............................................................
508 508
509 509 ERROR: test-failure.t output changed
510 510 !
511 511 Failed test-failure.t: output changed
512 512 # Ran 1 tests, 0 skipped, 1 failed.
513 513 python hash seed: * (glob)
514 514 [1]
515 515
516 516 failure w/ keyword
517 517 $ rt -k rataxes
518 518
519 519 --- $TESTTMP/test-failure.t
520 520 +++ $TESTTMP/test-failure.t.err
521 521 @@ -1,5 +1,5 @@
522 522 $ echo babar
523 523 - rataxes
524 524 + babar
525 525 This is a noop statement so that
526 526 this test is still more bytes than success.
527 527 pad pad pad pad............................................................
528 528
529 529 ERROR: test-failure.t output changed
530 530 !
531 531 Failed test-failure.t: output changed
532 532 # Ran 2 tests, 1 skipped, 1 failed.
533 533 python hash seed: * (glob)
534 534 [1]
535 535
536 536 Verify that when a process fails to start we show a useful message
537 537 ==================================================================
538 538
539 539 $ cat > test-serve-fail.t <<EOF
540 540 > $ echo 'abort: child process failed to start blah'
541 541 > EOF
542 542 $ rt test-serve-fail.t
543 543
544 544 --- $TESTTMP/test-serve-fail.t
545 545 +++ $TESTTMP/test-serve-fail.t.err
546 546 @@ -1* +1,2 @@ (glob)
547 547 $ echo 'abort: child process failed to start blah'
548 548 + abort: child process failed to start blah
549 549
550 550 ERROR: test-serve-fail.t output changed
551 551 !
552 552 Failed test-serve-fail.t: server failed to start (HGPORT=*) (glob)
553 553 # Ran 1 tests, 0 skipped, 1 failed.
554 554 python hash seed: * (glob)
555 555 [1]
556 556 $ rm test-serve-fail.t
557 557
558 558 Verify that we can try other ports
559 559 ===================================
560 560
561 561 Extensions aren't inherited by the invoked run-tests.py. An extension
562 562 introducing a repository requirement could cause this to fail. So we force
563 563 HGRCPATH to get a clean environment.
564 564
565 565 $ HGRCPATH= hg init inuse
566 566 $ hg serve -R inuse -p $HGPORT -d --pid-file=blocks.pid
567 567 $ cat blocks.pid >> $DAEMON_PIDS
568 568 $ cat > test-serve-inuse.t <<EOF
569 569 > $ hg serve -R `pwd`/inuse -p \$HGPORT -d --pid-file=hg.pid
570 570 > $ cat hg.pid >> \$DAEMON_PIDS
571 571 > EOF
572 572 $ rt test-serve-inuse.t
573 573 .
574 574 # Ran 1 tests, 0 skipped, 0 failed.
575 575 $ rm test-serve-inuse.t
576 576 $ killdaemons.py $DAEMON_PIDS
577 $ rm $DAEMON_PIDS
578 577
579 578 Running In Debug Mode
580 579 ======================
581 580
582 581 $ rt --debug 2>&1 | grep -v pwd
583 582 + echo *SALT* 0 0 (glob)
584 583 *SALT* 0 0 (glob)
585 584 + echo babar
586 585 babar
587 586 + echo *SALT* 10 0 (glob)
588 587 *SALT* 10 0 (glob)
589 588 *+ echo *SALT* 0 0 (glob)
590 589 *SALT* 0 0 (glob)
591 590 + echo babar
592 591 babar
593 592 + echo *SALT* 2 0 (glob)
594 593 *SALT* 2 0 (glob)
595 594 + echo xyzzy
596 595 xyzzy
597 596 + echo *SALT* 9 0 (glob)
598 597 *SALT* 9 0 (glob)
599 598 + printf *abc\ndef\nxyz\n* (glob)
600 599 abc
601 600 def
602 601 xyz
603 602 + echo *SALT* 15 0 (glob)
604 603 *SALT* 15 0 (glob)
605 604 + printf *zyx\nwvu\ntsr\n* (glob)
606 605 zyx
607 606 wvu
608 607 tsr
609 608 + echo *SALT* 22 0 (glob)
610 609 *SALT* 22 0 (glob)
611 610 .
612 611 # Ran 2 tests, 0 skipped, 0 failed.
613 612
614 613 Parallel runs
615 614 ==============
616 615
617 616 (duplicate the failing test to get predictable output)
618 617 $ cp test-failure.t test-failure-copy.t
619 618
620 619 $ rt --jobs 2 test-failure*.t -n
621 620 !!
622 621 Failed test-failure*.t: output changed (glob)
623 622 Failed test-failure*.t: output changed (glob)
624 623 # Ran 2 tests, 0 skipped, 2 failed.
625 624 python hash seed: * (glob)
626 625 [1]
627 626
628 627 failures in parallel with --first should only print one failure
629 628 $ rt --jobs 2 --first test-failure*.t
630 629
631 630 --- $TESTTMP/test-failure*.t (glob)
632 631 +++ $TESTTMP/test-failure*.t.err (glob)
633 632 @@ -1,5 +1,5 @@
634 633 $ echo babar
635 634 - rataxes
636 635 + babar
637 636 This is a noop statement so that
638 637 this test is still more bytes than success.
639 638 pad pad pad pad............................................................
640 639
641 640 Failed test-failure*.t: output changed (glob)
642 641 Failed test-failure*.t: output changed (glob)
643 642 # Ran 2 tests, 0 skipped, 2 failed.
644 643 python hash seed: * (glob)
645 644 [1]
646 645
647 646
648 647 (delete the duplicated test file)
649 648 $ rm test-failure-copy.t
650 649
651 650
652 651 Interactive run
653 652 ===============
654 653
655 654 (backup the failing test)
656 655 $ cp test-failure.t backup
657 656
658 657 Refuse the fix
659 658
660 659 $ echo 'n' | rt -i
661 660
662 661 --- $TESTTMP/test-failure.t
663 662 +++ $TESTTMP/test-failure.t.err
664 663 @@ -1,5 +1,5 @@
665 664 $ echo babar
666 665 - rataxes
667 666 + babar
668 667 This is a noop statement so that
669 668 this test is still more bytes than success.
670 669 pad pad pad pad............................................................
671 670 Accept this change? [n]
672 671 ERROR: test-failure.t output changed
673 672 !.
674 673 Failed test-failure.t: output changed
675 674 # Ran 2 tests, 0 skipped, 1 failed.
676 675 python hash seed: * (glob)
677 676 [1]
678 677
679 678 $ cat test-failure.t
680 679 $ echo babar
681 680 rataxes
682 681 This is a noop statement so that
683 682 this test is still more bytes than success.
684 683 pad pad pad pad............................................................
685 684 pad pad pad pad............................................................
686 685 pad pad pad pad............................................................
687 686 pad pad pad pad............................................................
688 687 pad pad pad pad............................................................
689 688 pad pad pad pad............................................................
690 689
691 690 Interactive with custom view
692 691
693 692 $ echo 'n' | rt -i --view echo
694 693 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err
695 694 Accept this change? [n]* (glob)
696 695 ERROR: test-failure.t output changed
697 696 !.
698 697 Failed test-failure.t: output changed
699 698 # Ran 2 tests, 0 skipped, 1 failed.
700 699 python hash seed: * (glob)
701 700 [1]
702 701
703 702 View the fix
704 703
705 704 $ echo 'y' | rt --view echo
706 705 $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err
707 706
708 707 ERROR: test-failure.t output changed
709 708 !.
710 709 Failed test-failure.t: output changed
711 710 # Ran 2 tests, 0 skipped, 1 failed.
712 711 python hash seed: * (glob)
713 712 [1]
714 713
715 714 Accept the fix
716 715
717 716 $ cat >> test-failure.t <<EOF
718 717 > $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
719 718 > saved backup bundle to \$TESTTMP/foo.hg
720 719 > $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
721 720 > saved backup bundle to $TESTTMP\\foo.hg
722 721 > $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
723 722 > saved backup bundle to \$TESTTMP/*.hg (glob)
724 723 > EOF
725 724 $ echo 'y' | rt -i 2>&1
726 725
727 726 --- $TESTTMP/test-failure.t
728 727 +++ $TESTTMP/test-failure.t.err
729 728 @@ -1,5 +1,5 @@
730 729 $ echo babar
731 730 - rataxes
732 731 + babar
733 732 This is a noop statement so that
734 733 this test is still more bytes than success.
735 734 pad pad pad pad............................................................
736 735 @@ -11,6 +11,6 @@
737 736 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
738 737 saved backup bundle to $TESTTMP/foo.hg
739 738 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
740 739 - saved backup bundle to $TESTTMP\foo.hg
741 740 + saved backup bundle to $TESTTMP/foo.hg
742 741 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
743 742 saved backup bundle to $TESTTMP/*.hg (glob)
744 743 Accept this change? [n] ..
745 744 # Ran 2 tests, 0 skipped, 0 failed.
746 745
747 746 $ sed -e 's,(glob)$,&<,g' test-failure.t
748 747 $ echo babar
749 748 babar
750 749 This is a noop statement so that
751 750 this test is still more bytes than success.
752 751 pad pad pad pad............................................................
753 752 pad pad pad pad............................................................
754 753 pad pad pad pad............................................................
755 754 pad pad pad pad............................................................
756 755 pad pad pad pad............................................................
757 756 pad pad pad pad............................................................
758 757 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
759 758 saved backup bundle to $TESTTMP/foo.hg
760 759 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
761 760 saved backup bundle to $TESTTMP/foo.hg
762 761 $ echo 'saved backup bundle to $TESTTMP/foo.hg'
763 762 saved backup bundle to $TESTTMP/*.hg (glob)<
764 763
765 764 Race condition - test file was modified when test is running
766 765
767 766 $ TESTRACEDIR=`pwd`
768 767 $ export TESTRACEDIR
769 768 $ cat > test-race.t <<EOF
770 769 > $ echo 1
771 770 > $ echo "# a new line" >> $TESTRACEDIR/test-race.t
772 771 > EOF
773 772
774 773 $ rt -i test-race.t
775 774
776 775 --- $TESTTMP/test-race.t
777 776 +++ $TESTTMP/test-race.t.err
778 777 @@ -1,2 +1,3 @@
779 778 $ echo 1
780 779 + 1
781 780 $ echo "# a new line" >> $TESTTMP/test-race.t
782 781 Reference output has changed (run again to prompt changes)
783 782 ERROR: test-race.t output changed
784 783 !
785 784 Failed test-race.t: output changed
786 785 # Ran 1 tests, 0 skipped, 1 failed.
787 786 python hash seed: * (glob)
788 787 [1]
789 788
790 789 $ rm test-race.t
791 790
792 791 When "#testcases" is used in .t files
793 792
794 793 $ cat >> test-cases.t <<EOF
795 794 > #testcases a b
796 795 > #if a
797 796 > $ echo 1
798 797 > #endif
799 798 > #if b
800 799 > $ echo 2
801 800 > #endif
802 801 > EOF
803 802
804 803 $ cat <<EOF | rt -i test-cases.t 2>&1
805 804 > y
806 805 > y
807 806 > EOF
808 807
809 808 --- $TESTTMP/test-cases.t
810 809 +++ $TESTTMP/test-cases.t.a.err
811 810 @@ -1,6 +1,7 @@
812 811 #testcases a b
813 812 #if a
814 813 $ echo 1
815 814 + 1
816 815 #endif
817 816 #if b
818 817 $ echo 2
819 818 Accept this change? [n] .
820 819 --- $TESTTMP/test-cases.t
821 820 +++ $TESTTMP/test-cases.t.b.err
822 821 @@ -5,4 +5,5 @@
823 822 #endif
824 823 #if b
825 824 $ echo 2
826 825 + 2
827 826 #endif
828 827 Accept this change? [n] .
829 828 # Ran 2 tests, 0 skipped, 0 failed.
830 829
831 830 $ cat test-cases.t
832 831 #testcases a b
833 832 #if a
834 833 $ echo 1
835 834 1
836 835 #endif
837 836 #if b
838 837 $ echo 2
839 838 2
840 839 #endif
841 840
842 841 $ cat >> test-cases.t <<'EOF'
843 842 > #if a
844 843 > $ NAME=A
845 844 > #else
846 845 > $ NAME=B
847 846 > #endif
848 847 > $ echo $NAME
849 848 > A (a !)
850 849 > B (b !)
851 850 > EOF
852 851 $ rt test-cases.t
853 852 ..
854 853 # Ran 2 tests, 0 skipped, 0 failed.
855 854
856 855 $ rm test-cases.t
857 856
858 857 (reinstall)
859 858 $ mv backup test-failure.t
860 859
861 860 No Diff
862 861 ===============
863 862
864 863 $ rt --nodiff
865 864 !.
866 865 Failed test-failure.t: output changed
867 866 # Ran 2 tests, 0 skipped, 1 failed.
868 867 python hash seed: * (glob)
869 868 [1]
870 869
871 870 test --tmpdir support
872 871 $ rt --tmpdir=$TESTTMP/keep test-success.t
873 872
874 873 Keeping testtmp dir: $TESTTMP/keep/child1/test-success.t
875 874 Keeping threadtmp dir: $TESTTMP/keep/child1
876 875 .
877 876 # Ran 1 tests, 0 skipped, 0 failed.
878 877
879 878 timeouts
880 879 ========
881 880 $ cat > test-timeout.t <<EOF
882 881 > $ sleep 2
883 882 > $ echo pass
884 883 > pass
885 884 > EOF
886 885 > echo '#require slow' > test-slow-timeout.t
887 886 > cat test-timeout.t >> test-slow-timeout.t
888 887 $ rt --timeout=1 --slowtimeout=3 test-timeout.t test-slow-timeout.t
889 888 st
890 889 Skipped test-slow-timeout.t: missing feature: allow slow tests (use --allow-slow-tests)
891 890 Failed test-timeout.t: timed out
892 891 # Ran 1 tests, 1 skipped, 1 failed.
893 892 python hash seed: * (glob)
894 893 [1]
895 894 $ rt --timeout=1 --slowtimeout=3 \
896 895 > test-timeout.t test-slow-timeout.t --allow-slow-tests
897 896 .t
898 897 Failed test-timeout.t: timed out
899 898 # Ran 2 tests, 0 skipped, 1 failed.
900 899 python hash seed: * (glob)
901 900 [1]
902 901 $ rm test-timeout.t test-slow-timeout.t
903 902
904 903 test for --time
905 904 ==================
906 905
907 906 $ rt test-success.t --time
908 907 .
909 908 # Ran 1 tests, 0 skipped, 0 failed.
910 909 # Producing time report
911 910 start end cuser csys real Test
912 911 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
913 912
914 913 test for --time with --job enabled
915 914 ====================================
916 915
917 916 $ rt test-success.t --time --jobs 2
918 917 .
919 918 # Ran 1 tests, 0 skipped, 0 failed.
920 919 # Producing time report
921 920 start end cuser csys real Test
922 921 \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re)
923 922
924 923 Skips
925 924 ================
926 925 $ cat > test-skip.t <<EOF
927 926 > $ echo xyzzy
928 927 > #if true
929 928 > #require false
930 929 > #end
931 930 > EOF
932 931 $ cat > test-noskip.t <<EOF
933 932 > #if false
934 933 > #require false
935 934 > #endif
936 935 > EOF
937 936 $ rt --nodiff
938 937 !.s.
939 938 Skipped test-skip.t: missing feature: nail clipper
940 939 Failed test-failure.t: output changed
941 940 # Ran 3 tests, 1 skipped, 1 failed.
942 941 python hash seed: * (glob)
943 942 [1]
944 943
945 944 $ rm test-noskip.t
946 945 $ rt --keyword xyzzy
947 946 .s
948 947 Skipped test-skip.t: missing feature: nail clipper
949 948 # Ran 2 tests, 2 skipped, 0 failed.
950 949
951 950 Skips with xml
952 951 $ rt --keyword xyzzy \
953 952 > --xunit=xunit.xml
954 953 .s
955 954 Skipped test-skip.t: missing feature: nail clipper
956 955 # Ran 2 tests, 2 skipped, 0 failed.
957 956 $ cat xunit.xml
958 957 <?xml version="1.0" encoding="utf-8"?>
959 958 <testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="2">
960 959 <testcase name="test-success.t" time="*"/> (glob)
961 960 <testcase name="test-skip.t">
962 961 <skipped>
963 962 <![CDATA[missing feature: nail clipper]]> </skipped>
964 963 </testcase>
965 964 </testsuite>
966 965
967 966 Missing skips or blacklisted skips don't count as executed:
968 967 $ echo test-failure.t > blacklist
969 968 $ rt --blacklist=blacklist --json\
970 969 > test-failure.t test-bogus.t
971 970 ss
972 971 Skipped test-bogus.t: Doesn't exist
973 972 Skipped test-failure.t: blacklisted
974 973 # Ran 0 tests, 2 skipped, 0 failed.
975 974 $ cat report.json
976 975 testreport ={
977 976 "test-bogus.t": {
978 977 "result": "skip"
979 978 },
980 979 "test-failure.t": {
981 980 "result": "skip"
982 981 }
983 982 } (no-eol)
984 983
985 984 Whitelist trumps blacklist
986 985 $ echo test-failure.t > whitelist
987 986 $ rt --blacklist=blacklist --whitelist=whitelist --json\
988 987 > test-failure.t test-bogus.t
989 988 s
990 989 --- $TESTTMP/test-failure.t
991 990 +++ $TESTTMP/test-failure.t.err
992 991 @@ -1,5 +1,5 @@
993 992 $ echo babar
994 993 - rataxes
995 994 + babar
996 995 This is a noop statement so that
997 996 this test is still more bytes than success.
998 997 pad pad pad pad............................................................
999 998
1000 999 ERROR: test-failure.t output changed
1001 1000 !
1002 1001 Skipped test-bogus.t: Doesn't exist
1003 1002 Failed test-failure.t: output changed
1004 1003 # Ran 1 tests, 1 skipped, 1 failed.
1005 1004 python hash seed: * (glob)
1006 1005 [1]
1007 1006
1008 1007 Ensure that --test-list causes only the tests listed in that file to
1009 1008 be executed.
1010 1009 $ echo test-success.t >> onlytest
1011 1010 $ rt --test-list=onlytest
1012 1011 .
1013 1012 # Ran 1 tests, 0 skipped, 0 failed.
1014 1013 $ echo test-bogus.t >> anothertest
1015 1014 $ rt --test-list=onlytest --test-list=anothertest
1016 1015 s.
1017 1016 Skipped test-bogus.t: Doesn't exist
1018 1017 # Ran 1 tests, 1 skipped, 0 failed.
1019 1018 $ rm onlytest anothertest
1020 1019
1021 1020 test for --json
1022 1021 ==================
1023 1022
1024 1023 $ rt --json
1025 1024
1026 1025 --- $TESTTMP/test-failure.t
1027 1026 +++ $TESTTMP/test-failure.t.err
1028 1027 @@ -1,5 +1,5 @@
1029 1028 $ echo babar
1030 1029 - rataxes
1031 1030 + babar
1032 1031 This is a noop statement so that
1033 1032 this test is still more bytes than success.
1034 1033 pad pad pad pad............................................................
1035 1034
1036 1035 ERROR: test-failure.t output changed
1037 1036 !.s
1038 1037 Skipped test-skip.t: missing feature: nail clipper
1039 1038 Failed test-failure.t: output changed
1040 1039 # Ran 2 tests, 1 skipped, 1 failed.
1041 1040 python hash seed: * (glob)
1042 1041 [1]
1043 1042
1044 1043 $ cat report.json
1045 1044 testreport ={
1046 1045 "test-failure.t": [\{] (re)
1047 1046 "csys": "\s*[\d\.]{4,5}", ? (re)
1048 1047 "cuser": "\s*[\d\.]{4,5}", ? (re)
1049 1048 "diff": "---.+\+\+\+.+", ? (re)
1050 1049 "end": "\s*[\d\.]{4,5}", ? (re)
1051 1050 "result": "failure", ? (re)
1052 1051 "start": "\s*[\d\.]{4,5}", ? (re)
1053 1052 "time": "\s*[\d\.]{4,5}" (re)
1054 1053 }, ? (re)
1055 1054 "test-skip.t": {
1056 1055 "csys": "\s*[\d\.]{4,5}", ? (re)
1057 1056 "cuser": "\s*[\d\.]{4,5}", ? (re)
1058 1057 "diff": "", ? (re)
1059 1058 "end": "\s*[\d\.]{4,5}", ? (re)
1060 1059 "result": "skip", ? (re)
1061 1060 "start": "\s*[\d\.]{4,5}", ? (re)
1062 1061 "time": "\s*[\d\.]{4,5}" (re)
1063 1062 }, ? (re)
1064 1063 "test-success.t": [\{] (re)
1065 1064 "csys": "\s*[\d\.]{4,5}", ? (re)
1066 1065 "cuser": "\s*[\d\.]{4,5}", ? (re)
1067 1066 "diff": "", ? (re)
1068 1067 "end": "\s*[\d\.]{4,5}", ? (re)
1069 1068 "result": "success", ? (re)
1070 1069 "start": "\s*[\d\.]{4,5}", ? (re)
1071 1070 "time": "\s*[\d\.]{4,5}" (re)
1072 1071 }
1073 1072 } (no-eol)
1074 1073 --json with --outputdir
1075 1074
1076 1075 $ rm report.json
1077 1076 $ rm -r output
1078 1077 $ mkdir output
1079 1078 $ rt --json --outputdir output
1080 1079
1081 1080 --- $TESTTMP/test-failure.t
1082 1081 +++ $TESTTMP/output/test-failure.t.err
1083 1082 @@ -1,5 +1,5 @@
1084 1083 $ echo babar
1085 1084 - rataxes
1086 1085 + babar
1087 1086 This is a noop statement so that
1088 1087 this test is still more bytes than success.
1089 1088 pad pad pad pad............................................................
1090 1089
1091 1090 ERROR: test-failure.t output changed
1092 1091 !.s
1093 1092 Skipped test-skip.t: missing feature: nail clipper
1094 1093 Failed test-failure.t: output changed
1095 1094 # Ran 2 tests, 1 skipped, 1 failed.
1096 1095 python hash seed: * (glob)
1097 1096 [1]
1098 1097 $ f report.json
1099 1098 report.json: file not found
1100 1099 $ cat output/report.json
1101 1100 testreport ={
1102 1101 "test-failure.t": [\{] (re)
1103 1102 "csys": "\s*[\d\.]{4,5}", ? (re)
1104 1103 "cuser": "\s*[\d\.]{4,5}", ? (re)
1105 1104 "diff": "---.+\+\+\+.+", ? (re)
1106 1105 "end": "\s*[\d\.]{4,5}", ? (re)
1107 1106 "result": "failure", ? (re)
1108 1107 "start": "\s*[\d\.]{4,5}", ? (re)
1109 1108 "time": "\s*[\d\.]{4,5}" (re)
1110 1109 }, ? (re)
1111 1110 "test-skip.t": {
1112 1111 "csys": "\s*[\d\.]{4,5}", ? (re)
1113 1112 "cuser": "\s*[\d\.]{4,5}", ? (re)
1114 1113 "diff": "", ? (re)
1115 1114 "end": "\s*[\d\.]{4,5}", ? (re)
1116 1115 "result": "skip", ? (re)
1117 1116 "start": "\s*[\d\.]{4,5}", ? (re)
1118 1117 "time": "\s*[\d\.]{4,5}" (re)
1119 1118 }, ? (re)
1120 1119 "test-success.t": [\{] (re)
1121 1120 "csys": "\s*[\d\.]{4,5}", ? (re)
1122 1121 "cuser": "\s*[\d\.]{4,5}", ? (re)
1123 1122 "diff": "", ? (re)
1124 1123 "end": "\s*[\d\.]{4,5}", ? (re)
1125 1124 "result": "success", ? (re)
1126 1125 "start": "\s*[\d\.]{4,5}", ? (re)
1127 1126 "time": "\s*[\d\.]{4,5}" (re)
1128 1127 }
1129 1128 } (no-eol)
1130 1129 $ ls -a output
1131 1130 .
1132 1131 ..
1133 1132 .testtimes
1134 1133 report.json
1135 1134 test-failure.t.err
1136 1135
1137 1136 Test that failed test accepted through interactive are properly reported:
1138 1137
1139 1138 $ cp test-failure.t backup
1140 1139 $ echo y | rt --json -i
1141 1140
1142 1141 --- $TESTTMP/test-failure.t
1143 1142 +++ $TESTTMP/test-failure.t.err
1144 1143 @@ -1,5 +1,5 @@
1145 1144 $ echo babar
1146 1145 - rataxes
1147 1146 + babar
1148 1147 This is a noop statement so that
1149 1148 this test is still more bytes than success.
1150 1149 pad pad pad pad............................................................
1151 1150 Accept this change? [n] ..s
1152 1151 Skipped test-skip.t: missing feature: nail clipper
1153 1152 # Ran 2 tests, 1 skipped, 0 failed.
1154 1153
1155 1154 $ cat report.json
1156 1155 testreport ={
1157 1156 "test-failure.t": [\{] (re)
1158 1157 "csys": "\s*[\d\.]{4,5}", ? (re)
1159 1158 "cuser": "\s*[\d\.]{4,5}", ? (re)
1160 1159 "diff": "", ? (re)
1161 1160 "end": "\s*[\d\.]{4,5}", ? (re)
1162 1161 "result": "success", ? (re)
1163 1162 "start": "\s*[\d\.]{4,5}", ? (re)
1164 1163 "time": "\s*[\d\.]{4,5}" (re)
1165 1164 }, ? (re)
1166 1165 "test-skip.t": {
1167 1166 "csys": "\s*[\d\.]{4,5}", ? (re)
1168 1167 "cuser": "\s*[\d\.]{4,5}", ? (re)
1169 1168 "diff": "", ? (re)
1170 1169 "end": "\s*[\d\.]{4,5}", ? (re)
1171 1170 "result": "skip", ? (re)
1172 1171 "start": "\s*[\d\.]{4,5}", ? (re)
1173 1172 "time": "\s*[\d\.]{4,5}" (re)
1174 1173 }, ? (re)
1175 1174 "test-success.t": [\{] (re)
1176 1175 "csys": "\s*[\d\.]{4,5}", ? (re)
1177 1176 "cuser": "\s*[\d\.]{4,5}", ? (re)
1178 1177 "diff": "", ? (re)
1179 1178 "end": "\s*[\d\.]{4,5}", ? (re)
1180 1179 "result": "success", ? (re)
1181 1180 "start": "\s*[\d\.]{4,5}", ? (re)
1182 1181 "time": "\s*[\d\.]{4,5}" (re)
1183 1182 }
1184 1183 } (no-eol)
1185 1184 $ mv backup test-failure.t
1186 1185
1187 1186 backslash on end of line with glob matching is handled properly
1188 1187
1189 1188 $ cat > test-glob-backslash.t << EOF
1190 1189 > $ echo 'foo bar \\'
1191 1190 > foo * \ (glob)
1192 1191 > EOF
1193 1192
1194 1193 $ rt test-glob-backslash.t
1195 1194 .
1196 1195 # Ran 1 tests, 0 skipped, 0 failed.
1197 1196
1198 1197 $ rm -f test-glob-backslash.t
1199 1198
1200 1199 Test globbing of local IP addresses
1201 1200 $ echo 172.16.18.1
1202 1201 $LOCALIP (glob)
1203 1202 $ echo dead:beef::1
1204 1203 $LOCALIP (glob)
1205 1204
1206 1205 Test reusability for third party tools
1207 1206 ======================================
1208 1207
1209 1208 $ mkdir "$TESTTMP"/anothertests
1210 1209 $ cd "$TESTTMP"/anothertests
1211 1210
1212 1211 test that `run-tests.py` can execute hghave, even if it runs not in
1213 1212 Mercurial source tree.
1214 1213
1215 1214 $ cat > test-hghave.t <<EOF
1216 1215 > #require true
1217 1216 > $ echo foo
1218 1217 > foo
1219 1218 > EOF
1220 1219 $ rt test-hghave.t
1221 1220 .
1222 1221 # Ran 1 tests, 0 skipped, 0 failed.
1223 1222
1224 1223 test that RUNTESTDIR refers the directory, in which `run-tests.py` now
1225 1224 running is placed.
1226 1225
1227 1226 $ cat > test-runtestdir.t <<EOF
1228 1227 > - $TESTDIR, in which test-run-tests.t is placed
1229 1228 > - \$TESTDIR, in which test-runtestdir.t is placed (expanded at runtime)
1230 1229 > - \$RUNTESTDIR, in which run-tests.py is placed (expanded at runtime)
1231 1230 >
1232 1231 > #if windows
1233 1232 > $ test "\$TESTDIR" = "$TESTTMP\anothertests"
1234 1233 > #else
1235 1234 > $ test "\$TESTDIR" = "$TESTTMP"/anothertests
1236 1235 > #endif
1237 1236 > If this prints a path, that means RUNTESTDIR didn't equal
1238 1237 > TESTDIR as it should have.
1239 1238 > $ test "\$RUNTESTDIR" = "$TESTDIR" || echo "\$RUNTESTDIR"
1240 1239 > This should print the start of check-code. If this passes but the
1241 1240 > previous check failed, that means we found a copy of check-code at whatever
1242 1241 > RUNTESTSDIR ended up containing, even though it doesn't match TESTDIR.
1243 1242 > $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py | sed 's@.!.*python@#!USRBINENVPY@'
1244 1243 > #!USRBINENVPY
1245 1244 > #
1246 1245 > # check-code - a style and portability checker for Mercurial
1247 1246 > EOF
1248 1247 $ rt test-runtestdir.t
1249 1248 .
1250 1249 # Ran 1 tests, 0 skipped, 0 failed.
1251 1250
1252 1251 #if execbit
1253 1252
1254 1253 test that TESTDIR is referred in PATH
1255 1254
1256 1255 $ cat > custom-command.sh <<EOF
1257 1256 > #!/bin/sh
1258 1257 > echo "hello world"
1259 1258 > EOF
1260 1259 $ chmod +x custom-command.sh
1261 1260 $ cat > test-testdir-path.t <<EOF
1262 1261 > $ custom-command.sh
1263 1262 > hello world
1264 1263 > EOF
1265 1264 $ rt test-testdir-path.t
1266 1265 .
1267 1266 # Ran 1 tests, 0 skipped, 0 failed.
1268 1267
1269 1268 #endif
1270 1269
1271 1270 test support for --allow-slow-tests
1272 1271 $ cat > test-very-slow-test.t <<EOF
1273 1272 > #require slow
1274 1273 > $ echo pass
1275 1274 > pass
1276 1275 > EOF
1277 1276 $ rt test-very-slow-test.t
1278 1277 s
1279 1278 Skipped test-very-slow-test.t: missing feature: allow slow tests (use --allow-slow-tests)
1280 1279 # Ran 0 tests, 1 skipped, 0 failed.
1281 1280 $ rt $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t
1282 1281 .
1283 1282 # Ran 1 tests, 0 skipped, 0 failed.
1284 1283
1285 1284 support for running a test outside the current directory
1286 1285 $ mkdir nonlocal
1287 1286 $ cat > nonlocal/test-is-not-here.t << EOF
1288 1287 > $ echo pass
1289 1288 > pass
1290 1289 > EOF
1291 1290 $ rt nonlocal/test-is-not-here.t
1292 1291 .
1293 1292 # Ran 1 tests, 0 skipped, 0 failed.
1294 1293
1295 1294 support for automatically discovering test if arg is a folder
1296 1295 $ mkdir tmp && cd tmp
1297 1296
1298 1297 $ cat > test-uno.t << EOF
1299 1298 > $ echo line
1300 1299 > line
1301 1300 > EOF
1302 1301
1303 1302 $ cp test-uno.t test-dos.t
1304 1303 $ cd ..
1305 1304 $ cp -R tmp tmpp
1306 1305 $ cp tmp/test-uno.t test-solo.t
1307 1306
1308 1307 $ rt tmp/ test-solo.t tmpp
1309 1308 .....
1310 1309 # Ran 5 tests, 0 skipped, 0 failed.
1311 1310 $ rm -rf tmp tmpp
1312 1311
1313 1312 support for running run-tests.py from another directory
1314 1313 $ mkdir tmp && cd tmp
1315 1314
1316 1315 $ cat > useful-file.sh << EOF
1317 1316 > important command
1318 1317 > EOF
1319 1318
1320 1319 $ cat > test-folder.t << EOF
1321 1320 > $ cat \$TESTDIR/useful-file.sh
1322 1321 > important command
1323 1322 > EOF
1324 1323
1325 1324 $ cat > test-folder-fail.t << EOF
1326 1325 > $ cat \$TESTDIR/useful-file.sh
1327 1326 > important commando
1328 1327 > EOF
1329 1328
1330 1329 $ cd ..
1331 1330 $ rt tmp/test-*.t
1332 1331
1333 1332 --- $TESTTMP/anothertests/tmp/test-folder-fail.t
1334 1333 +++ $TESTTMP/anothertests/tmp/test-folder-fail.t.err
1335 1334 @@ -1,2 +1,2 @@
1336 1335 $ cat $TESTDIR/useful-file.sh
1337 1336 - important commando
1338 1337 + important command
1339 1338
1340 1339 ERROR: test-folder-fail.t output changed
1341 1340 !.
1342 1341 Failed test-folder-fail.t: output changed
1343 1342 # Ran 2 tests, 0 skipped, 1 failed.
1344 1343 python hash seed: * (glob)
1345 1344 [1]
1346 1345
1347 1346 support for bisecting failed tests automatically
1348 1347 $ hg init bisect
1349 1348 $ cd bisect
1350 1349 $ cat >> test-bisect.t <<EOF
1351 1350 > $ echo pass
1352 1351 > pass
1353 1352 > EOF
1354 1353 $ hg add test-bisect.t
1355 1354 $ hg ci -m 'good'
1356 1355 $ cat >> test-bisect.t <<EOF
1357 1356 > $ echo pass
1358 1357 > fail
1359 1358 > EOF
1360 1359 $ hg ci -m 'bad'
1361 1360 $ rt --known-good-rev=0 test-bisect.t
1362 1361
1363 1362 --- $TESTTMP/anothertests/bisect/test-bisect.t
1364 1363 +++ $TESTTMP/anothertests/bisect/test-bisect.t.err
1365 1364 @@ -1,4 +1,4 @@
1366 1365 $ echo pass
1367 1366 pass
1368 1367 $ echo pass
1369 1368 - fail
1370 1369 + pass
1371 1370
1372 1371 ERROR: test-bisect.t output changed
1373 1372 !
1374 1373 Failed test-bisect.t: output changed
1375 1374 test-bisect.t broken by 72cbf122d116 (bad)
1376 1375 # Ran 1 tests, 0 skipped, 1 failed.
1377 1376 python hash seed: * (glob)
1378 1377 [1]
1379 1378
1380 1379 $ cd ..
1381 1380
1382 1381 support bisecting a separate repo
1383 1382
1384 1383 $ hg init bisect-dependent
1385 1384 $ cd bisect-dependent
1386 1385 $ cat > test-bisect-dependent.t <<EOF
1387 1386 > $ tail -1 \$TESTDIR/../bisect/test-bisect.t
1388 1387 > pass
1389 1388 > EOF
1390 1389 $ hg commit -Am dependent test-bisect-dependent.t
1391 1390
1392 1391 $ rt --known-good-rev=0 test-bisect-dependent.t
1393 1392
1394 1393 --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
1395 1394 +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
1396 1395 @@ -1,2 +1,2 @@
1397 1396 $ tail -1 $TESTDIR/../bisect/test-bisect.t
1398 1397 - pass
1399 1398 + fail
1400 1399
1401 1400 ERROR: test-bisect-dependent.t output changed
1402 1401 !
1403 1402 Failed test-bisect-dependent.t: output changed
1404 1403 Failed to identify failure point for test-bisect-dependent.t
1405 1404 # Ran 1 tests, 0 skipped, 1 failed.
1406 1405 python hash seed: * (glob)
1407 1406 [1]
1408 1407
1409 1408 $ rt --bisect-repo=../test-bisect test-bisect-dependent.t
1410 1409 usage: run-tests.py [options] [tests]
1411 1410 run-tests.py: error: --bisect-repo cannot be used without --known-good-rev
1412 1411 [2]
1413 1412
1414 1413 $ rt --known-good-rev=0 --bisect-repo=../bisect test-bisect-dependent.t
1415 1414
1416 1415 --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t
1417 1416 +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err
1418 1417 @@ -1,2 +1,2 @@
1419 1418 $ tail -1 $TESTDIR/../bisect/test-bisect.t
1420 1419 - pass
1421 1420 + fail
1422 1421
1423 1422 ERROR: test-bisect-dependent.t output changed
1424 1423 !
1425 1424 Failed test-bisect-dependent.t: output changed
1426 1425 test-bisect-dependent.t broken by 72cbf122d116 (bad)
1427 1426 # Ran 1 tests, 0 skipped, 1 failed.
1428 1427 python hash seed: * (glob)
1429 1428 [1]
1430 1429
1431 1430 $ cd ..
1432 1431
1433 1432 Test a broken #if statement doesn't break run-tests threading.
1434 1433 ==============================================================
1435 1434 $ mkdir broken
1436 1435 $ cd broken
1437 1436 $ cat > test-broken.t <<EOF
1438 1437 > true
1439 1438 > #if notarealhghavefeature
1440 1439 > $ false
1441 1440 > #endif
1442 1441 > EOF
1443 1442 $ for f in 1 2 3 4 ; do
1444 1443 > cat > test-works-$f.t <<EOF
1445 1444 > This is test case $f
1446 1445 > $ sleep 1
1447 1446 > EOF
1448 1447 > done
1449 1448 $ rt -j 2
1450 1449 ....
1451 1450 # Ran 5 tests, 0 skipped, 0 failed.
1452 1451 skipped: unknown feature: notarealhghavefeature
1453 1452
1454 1453 $ cd ..
1455 1454 $ rm -rf broken
1456 1455
1457 1456 Test cases in .t files
1458 1457 ======================
1459 1458 $ mkdir cases
1460 1459 $ cd cases
1461 1460 $ cat > test-cases-abc.t <<'EOF'
1462 1461 > #testcases A B C
1463 1462 > $ V=B
1464 1463 > #if A
1465 1464 > $ V=A
1466 1465 > #endif
1467 1466 > #if C
1468 1467 > $ V=C
1469 1468 > #endif
1470 1469 > $ echo $V | sed 's/A/C/'
1471 1470 > C
1472 1471 > #if C
1473 1472 > $ [ $V = C ]
1474 1473 > #endif
1475 1474 > #if A
1476 1475 > $ [ $V = C ]
1477 1476 > [1]
1478 1477 > #endif
1479 1478 > #if no-C
1480 1479 > $ [ $V = C ]
1481 1480 > [1]
1482 1481 > #endif
1483 1482 > $ [ $V = D ]
1484 1483 > [1]
1485 1484 > EOF
1486 1485 $ rt
1487 1486 .
1488 1487 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1489 1488 +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
1490 1489 @@ -7,7 +7,7 @@
1491 1490 $ V=C
1492 1491 #endif
1493 1492 $ echo $V | sed 's/A/C/'
1494 1493 - C
1495 1494 + B
1496 1495 #if C
1497 1496 $ [ $V = C ]
1498 1497 #endif
1499 1498
1500 1499 ERROR: test-cases-abc.t (case B) output changed
1501 1500 !.
1502 1501 Failed test-cases-abc.t (case B): output changed
1503 1502 # Ran 3 tests, 0 skipped, 1 failed.
1504 1503 python hash seed: * (glob)
1505 1504 [1]
1506 1505
1507 1506 --restart works
1508 1507
1509 1508 $ rt --restart
1510 1509
1511 1510 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1512 1511 +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
1513 1512 @@ -7,7 +7,7 @@
1514 1513 $ V=C
1515 1514 #endif
1516 1515 $ echo $V | sed 's/A/C/'
1517 1516 - C
1518 1517 + B
1519 1518 #if C
1520 1519 $ [ $V = C ]
1521 1520 #endif
1522 1521
1523 1522 ERROR: test-cases-abc.t (case B) output changed
1524 1523 !.
1525 1524 Failed test-cases-abc.t (case B): output changed
1526 1525 # Ran 2 tests, 0 skipped, 1 failed.
1527 1526 python hash seed: * (glob)
1528 1527 [1]
1529 1528
1530 1529 --restart works with outputdir
1531 1530
1532 1531 $ mkdir output
1533 1532 $ mv test-cases-abc.t.B.err output
1534 1533 $ rt --restart --outputdir output
1535 1534
1536 1535 --- $TESTTMP/anothertests/cases/test-cases-abc.t
1537 1536 +++ $TESTTMP/anothertests/cases/output/test-cases-abc.t.B.err
1538 1537 @@ -7,7 +7,7 @@
1539 1538 $ V=C
1540 1539 #endif
1541 1540 $ echo $V | sed 's/A/C/'
1542 1541 - C
1543 1542 + B
1544 1543 #if C
1545 1544 $ [ $V = C ]
1546 1545 #endif
1547 1546
1548 1547 ERROR: test-cases-abc.t (case B) output changed
1549 1548 !.
1550 1549 Failed test-cases-abc.t (case B): output changed
1551 1550 # Ran 2 tests, 0 skipped, 1 failed.
1552 1551 python hash seed: * (glob)
1553 1552 [1]
1554 1553
1555 1554 Test TESTCASE variable
1556 1555
1557 1556 $ cat > test-cases-ab.t <<'EOF'
1558 1557 > $ dostuff() {
1559 1558 > > echo "In case $TESTCASE"
1560 1559 > > }
1561 1560 > #testcases A B
1562 1561 > #if A
1563 1562 > $ dostuff
1564 1563 > In case A
1565 1564 > #endif
1566 1565 > #if B
1567 1566 > $ dostuff
1568 1567 > In case B
1569 1568 > #endif
1570 1569 > EOF
1571 1570 $ rt test-cases-ab.t
1572 1571 ..
1573 1572 # Ran 2 tests, 0 skipped, 0 failed.
1574 1573
1575 1574 Test automatic pattern replacement
1576 1575
1577 1576 $ cat << EOF >> common-pattern.py
1578 1577 > substitutions = [
1579 1578 > (br'foo-(.*)\\b',
1580 1579 > br'\$XXX=\\1\$'),
1581 1580 > (br'bar\\n',
1582 1581 > br'\$YYY$\\n'),
1583 1582 > ]
1584 1583 > EOF
1585 1584
1586 1585 $ cat << EOF >> test-substitution.t
1587 1586 > $ echo foo-12
1588 1587 > \$XXX=12$
1589 1588 > $ echo foo-42
1590 1589 > \$XXX=42$
1591 1590 > $ echo bar prior
1592 1591 > bar prior
1593 1592 > $ echo lastbar
1594 1593 > last\$YYY$
1595 1594 > $ echo foo-bar foo-baz
1596 1595 > EOF
1597 1596
1598 1597 $ rt test-substitution.t
1599 1598
1600 1599 --- $TESTTMP/anothertests/cases/test-substitution.t
1601 1600 +++ $TESTTMP/anothertests/cases/test-substitution.t.err
1602 1601 @@ -7,3 +7,4 @@
1603 1602 $ echo lastbar
1604 1603 last$YYY$
1605 1604 $ echo foo-bar foo-baz
1606 1605 + $XXX=bar foo-baz$
1607 1606
1608 1607 ERROR: test-substitution.t output changed
1609 1608 !
1610 1609 Failed test-substitution.t: output changed
1611 1610 # Ran 1 tests, 0 skipped, 1 failed.
1612 1611 python hash seed: * (glob)
1613 1612 [1]
1614 1613
1615 1614 --extra-config-opt works
1616 1615
1617 1616 $ cat << EOF >> test-config-opt.t
1618 1617 > $ hg init test-config-opt
1619 1618 > $ hg -R test-config-opt purge
1620 1619 > EOF
1621 1620
1622 1621 $ rt --extra-config-opt extensions.purge= test-config-opt.t
1623 1622 .
1624 1623 # Ran 1 tests, 0 skipped, 0 failed.
@@ -1,101 +1,102 b''
1 1 #require serve
2 2
3 3 $ hgserve()
4 4 > {
5 5 > hg serve -a localhost -d --pid-file=hg.pid -E errors.log -v $@ \
6 6 > | sed -e "s/:$HGPORT1\\([^0-9]\\)/:HGPORT1\1/g" \
7 7 > -e "s/:$HGPORT2\\([^0-9]\\)/:HGPORT2\1/g" \
8 8 > -e 's/http:\/\/[^/]*\//http:\/\/localhost\//'
9 > cat hg.pid >> "$DAEMON_PIDS"
9 > if [ -f hg.pid ]; then
10 > killdaemons.py hg.pid
11 > fi
10 12 > echo % errors
11 13 > cat errors.log
12 > killdaemons.py hg.pid
13 14 > }
14 15
15 16 $ hg init test
16 17 $ cd test
17 18 $ echo '[web]' > .hg/hgrc
18 19 $ echo 'accesslog = access.log' >> .hg/hgrc
19 20 $ echo "port = $HGPORT1" >> .hg/hgrc
20 21
21 22 Without -v
22 23
23 24 $ hg serve -a localhost -p $HGPORT -d --pid-file=hg.pid -E errors.log
24 25 $ cat hg.pid >> "$DAEMON_PIDS"
25 26 $ if [ -f access.log ]; then
26 27 > echo 'access log created - .hg/hgrc respected'
27 28 > fi
28 29 access log created - .hg/hgrc respected
29 30
30 31 errors
31 32
32 33 $ cat errors.log
33 34
34 35 With -v
35 36
36 37 $ hgserve
37 38 listening at http://localhost/ (bound to *$LOCALIP*:HGPORT1) (glob) (?)
38 39 % errors
39 40
40 41 With -v and -p HGPORT2
41 42
42 43 $ hgserve -p "$HGPORT2"
43 44 listening at http://localhost/ (bound to *$LOCALIP*:HGPORT2) (glob) (?)
44 45 % errors
45 46
46 47 With -v and -p daytime (should fail because low port)
47 48
48 49 #if no-root no-windows
49 50 $ KILLQUIETLY=Y
50 51 $ hgserve -p daytime
51 52 abort: cannot start server at 'localhost:13': Permission denied
52 53 abort: child process failed to start
53 54 % errors
54 55 $ KILLQUIETLY=N
55 56 #endif
56 57
57 58 With --prefix foo
58 59
59 60 $ hgserve --prefix foo
60 61 listening at http://localhost/foo/ (bound to *$LOCALIP*:HGPORT1) (glob) (?)
61 62 % errors
62 63
63 64 With --prefix /foo
64 65
65 66 $ hgserve --prefix /foo
66 67 listening at http://localhost/foo/ (bound to *$LOCALIP*:HGPORT1) (glob) (?)
67 68 % errors
68 69
69 70 With --prefix foo/
70 71
71 72 $ hgserve --prefix foo/
72 73 listening at http://localhost/foo/ (bound to *$LOCALIP*:HGPORT1) (glob) (?)
73 74 % errors
74 75
75 76 With --prefix /foo/
76 77
77 78 $ hgserve --prefix /foo/
78 79 listening at http://localhost/foo/ (bound to *$LOCALIP*:HGPORT1) (glob) (?)
79 80 % errors
80 81
81 82 $ $PYTHON $RUNTESTDIR/killdaemons.py $DAEMON_PIDS
82 83
83 84 With out of bounds accesses
84 85
85 86 $ rm access.log
86 87 $ hg serve -a localhost -p $HGPORT -d --prefix some/dir \
87 88 > --pid-file=hg.pid -E errors.log
88 89 $ cat hg.pid >> "$DAEMON_PIDS"
89 90
90 91 $ hg id http://localhost:$HGPORT/some/dir7
91 92 abort: HTTP Error 404: Not Found
92 93 [255]
93 94 $ hg id http://localhost:$HGPORT/some
94 95 abort: HTTP Error 404: Not Found
95 96 [255]
96 97
97 98 $ cat access.log errors.log
98 99 $LOCALIP - - [$LOGDATE$] "GET /some/dir7?cmd=capabilities HTTP/1.1" 404 - (glob)
99 100 $LOCALIP - - [$LOGDATE$] "GET /some?cmd=capabilities HTTP/1.1" 404 - (glob)
100 101
101 102 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now