##// END OF EJS Templates
pypy: fix failing test files with Pypy5.6.0...
Boris Feld -
r33609:6c142f27 stable
parent child Browse files
Show More
@@ -1,908 +1,910 b''
1 #if windows
1 #if windows
2 $ PYTHONPATH="$TESTDIR/../contrib;$PYTHONPATH"
2 $ PYTHONPATH="$TESTDIR/../contrib;$PYTHONPATH"
3 #else
3 #else
4 $ PYTHONPATH="$TESTDIR/../contrib:$PYTHONPATH"
4 $ PYTHONPATH="$TESTDIR/../contrib:$PYTHONPATH"
5 #endif
5 #endif
6 $ export PYTHONPATH
6 $ export PYTHONPATH
7
7
8 typical client does not want echo-back messages, so test without it:
8 typical client does not want echo-back messages, so test without it:
9
9
10 $ grep -v '^promptecho ' < $HGRCPATH >> $HGRCPATH.new
10 $ grep -v '^promptecho ' < $HGRCPATH >> $HGRCPATH.new
11 $ mv $HGRCPATH.new $HGRCPATH
11 $ mv $HGRCPATH.new $HGRCPATH
12
12
13 $ hg init repo
13 $ hg init repo
14 $ cd repo
14 $ cd repo
15
15
16 >>> from __future__ import print_function
16 >>> from __future__ import print_function
17 >>> from hgclient import readchannel, runcommand, check
17 >>> from hgclient import readchannel, runcommand, check
18 >>> @check
18 >>> @check
19 ... def hellomessage(server):
19 ... def hellomessage(server):
20 ... ch, data = readchannel(server)
20 ... ch, data = readchannel(server)
21 ... print('%c, %r' % (ch, data))
21 ... print('%c, %r' % (ch, data))
22 ... # run an arbitrary command to make sure the next thing the server
22 ... # run an arbitrary command to make sure the next thing the server
23 ... # sends isn't part of the hello message
23 ... # sends isn't part of the hello message
24 ... runcommand(server, ['id'])
24 ... runcommand(server, ['id'])
25 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
25 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
26 *** runcommand id
26 *** runcommand id
27 000000000000 tip
27 000000000000 tip
28
28
29 >>> from hgclient import check
29 >>> from hgclient import check
30 >>> @check
30 >>> @check
31 ... def unknowncommand(server):
31 ... def unknowncommand(server):
32 ... server.stdin.write('unknowncommand\n')
32 ... server.stdin.write('unknowncommand\n')
33 abort: unknown command unknowncommand
33 abort: unknown command unknowncommand
34
34
35 >>> from hgclient import readchannel, runcommand, check
35 >>> from hgclient import readchannel, runcommand, check
36 >>> @check
36 >>> @check
37 ... def checkruncommand(server):
37 ... def checkruncommand(server):
38 ... # hello block
38 ... # hello block
39 ... readchannel(server)
39 ... readchannel(server)
40 ...
40 ...
41 ... # no args
41 ... # no args
42 ... runcommand(server, [])
42 ... runcommand(server, [])
43 ...
43 ...
44 ... # global options
44 ... # global options
45 ... runcommand(server, ['id', '--quiet'])
45 ... runcommand(server, ['id', '--quiet'])
46 ...
46 ...
47 ... # make sure global options don't stick through requests
47 ... # make sure global options don't stick through requests
48 ... runcommand(server, ['id'])
48 ... runcommand(server, ['id'])
49 ...
49 ...
50 ... # --config
50 ... # --config
51 ... runcommand(server, ['id', '--config', 'ui.quiet=True'])
51 ... runcommand(server, ['id', '--config', 'ui.quiet=True'])
52 ...
52 ...
53 ... # make sure --config doesn't stick
53 ... # make sure --config doesn't stick
54 ... runcommand(server, ['id'])
54 ... runcommand(server, ['id'])
55 ...
55 ...
56 ... # negative return code should be masked
56 ... # negative return code should be masked
57 ... runcommand(server, ['id', '-runknown'])
57 ... runcommand(server, ['id', '-runknown'])
58 *** runcommand
58 *** runcommand
59 Mercurial Distributed SCM
59 Mercurial Distributed SCM
60
60
61 basic commands:
61 basic commands:
62
62
63 add add the specified files on the next commit
63 add add the specified files on the next commit
64 annotate show changeset information by line for each file
64 annotate show changeset information by line for each file
65 clone make a copy of an existing repository
65 clone make a copy of an existing repository
66 commit commit the specified files or all outstanding changes
66 commit commit the specified files or all outstanding changes
67 diff diff repository (or selected files)
67 diff diff repository (or selected files)
68 export dump the header and diffs for one or more changesets
68 export dump the header and diffs for one or more changesets
69 forget forget the specified files on the next commit
69 forget forget the specified files on the next commit
70 init create a new repository in the given directory
70 init create a new repository in the given directory
71 log show revision history of entire repository or files
71 log show revision history of entire repository or files
72 merge merge another revision into working directory
72 merge merge another revision into working directory
73 pull pull changes from the specified source
73 pull pull changes from the specified source
74 push push changes to the specified destination
74 push push changes to the specified destination
75 remove remove the specified files on the next commit
75 remove remove the specified files on the next commit
76 serve start stand-alone webserver
76 serve start stand-alone webserver
77 status show changed files in the working directory
77 status show changed files in the working directory
78 summary summarize working directory state
78 summary summarize working directory state
79 update update working directory (or switch revisions)
79 update update working directory (or switch revisions)
80
80
81 (use 'hg help' for the full list of commands or 'hg -v' for details)
81 (use 'hg help' for the full list of commands or 'hg -v' for details)
82 *** runcommand id --quiet
82 *** runcommand id --quiet
83 000000000000
83 000000000000
84 *** runcommand id
84 *** runcommand id
85 000000000000 tip
85 000000000000 tip
86 *** runcommand id --config ui.quiet=True
86 *** runcommand id --config ui.quiet=True
87 000000000000
87 000000000000
88 *** runcommand id
88 *** runcommand id
89 000000000000 tip
89 000000000000 tip
90 *** runcommand id -runknown
90 *** runcommand id -runknown
91 abort: unknown revision 'unknown'!
91 abort: unknown revision 'unknown'!
92 [255]
92 [255]
93
93
94 >>> from hgclient import readchannel, check
94 >>> from hgclient import readchannel, check
95 >>> @check
95 >>> @check
96 ... def inputeof(server):
96 ... def inputeof(server):
97 ... readchannel(server)
97 ... readchannel(server)
98 ... server.stdin.write('runcommand\n')
98 ... server.stdin.write('runcommand\n')
99 ... # close stdin while server is waiting for input
99 ... # close stdin while server is waiting for input
100 ... server.stdin.close()
100 ... server.stdin.close()
101 ...
101 ...
102 ... # server exits with 1 if the pipe closed while reading the command
102 ... # server exits with 1 if the pipe closed while reading the command
103 ... print('server exit code =', server.wait())
103 ... print('server exit code =', server.wait())
104 server exit code = 1
104 server exit code = 1
105
105
106 >>> from hgclient import readchannel, runcommand, check, stringio
106 >>> from hgclient import readchannel, runcommand, check, stringio
107 >>> @check
107 >>> @check
108 ... def serverinput(server):
108 ... def serverinput(server):
109 ... readchannel(server)
109 ... readchannel(server)
110 ...
110 ...
111 ... patch = """
111 ... patch = """
112 ... # HG changeset patch
112 ... # HG changeset patch
113 ... # User test
113 ... # User test
114 ... # Date 0 0
114 ... # Date 0 0
115 ... # Node ID c103a3dec114d882c98382d684d8af798d09d857
115 ... # Node ID c103a3dec114d882c98382d684d8af798d09d857
116 ... # Parent 0000000000000000000000000000000000000000
116 ... # Parent 0000000000000000000000000000000000000000
117 ... 1
117 ... 1
118 ...
118 ...
119 ... diff -r 000000000000 -r c103a3dec114 a
119 ... diff -r 000000000000 -r c103a3dec114 a
120 ... --- /dev/null Thu Jan 01 00:00:00 1970 +0000
120 ... --- /dev/null Thu Jan 01 00:00:00 1970 +0000
121 ... +++ b/a Thu Jan 01 00:00:00 1970 +0000
121 ... +++ b/a Thu Jan 01 00:00:00 1970 +0000
122 ... @@ -0,0 +1,1 @@
122 ... @@ -0,0 +1,1 @@
123 ... +1
123 ... +1
124 ... """
124 ... """
125 ...
125 ...
126 ... runcommand(server, ['import', '-'], input=stringio(patch))
126 ... runcommand(server, ['import', '-'], input=stringio(patch))
127 ... runcommand(server, ['log'])
127 ... runcommand(server, ['log'])
128 *** runcommand import -
128 *** runcommand import -
129 applying patch from stdin
129 applying patch from stdin
130 *** runcommand log
130 *** runcommand log
131 changeset: 0:eff892de26ec
131 changeset: 0:eff892de26ec
132 tag: tip
132 tag: tip
133 user: test
133 user: test
134 date: Thu Jan 01 00:00:00 1970 +0000
134 date: Thu Jan 01 00:00:00 1970 +0000
135 summary: 1
135 summary: 1
136
136
137
137
138 check that "histedit --commands=-" can read rules from the input channel:
138 check that "histedit --commands=-" can read rules from the input channel:
139
139
140 >>> import cStringIO
140 >>> import cStringIO
141 >>> from hgclient import readchannel, runcommand, check
141 >>> from hgclient import readchannel, runcommand, check
142 >>> @check
142 >>> @check
143 ... def serverinput(server):
143 ... def serverinput(server):
144 ... readchannel(server)
144 ... readchannel(server)
145 ... rules = 'pick eff892de26ec\n'
145 ... rules = 'pick eff892de26ec\n'
146 ... runcommand(server, ['histedit', '0', '--commands=-',
146 ... runcommand(server, ['histedit', '0', '--commands=-',
147 ... '--config', 'extensions.histedit='],
147 ... '--config', 'extensions.histedit='],
148 ... input=cStringIO.StringIO(rules))
148 ... input=cStringIO.StringIO(rules))
149 *** runcommand histedit 0 --commands=- --config extensions.histedit=
149 *** runcommand histedit 0 --commands=- --config extensions.histedit=
150
150
151 check that --cwd doesn't persist between requests:
151 check that --cwd doesn't persist between requests:
152
152
153 $ mkdir foo
153 $ mkdir foo
154 $ touch foo/bar
154 $ touch foo/bar
155 >>> from hgclient import readchannel, runcommand, check
155 >>> from hgclient import readchannel, runcommand, check
156 >>> @check
156 >>> @check
157 ... def cwd(server):
157 ... def cwd(server):
158 ... readchannel(server)
158 ... readchannel(server)
159 ... runcommand(server, ['--cwd', 'foo', 'st', 'bar'])
159 ... runcommand(server, ['--cwd', 'foo', 'st', 'bar'])
160 ... runcommand(server, ['st', 'foo/bar'])
160 ... runcommand(server, ['st', 'foo/bar'])
161 *** runcommand --cwd foo st bar
161 *** runcommand --cwd foo st bar
162 ? bar
162 ? bar
163 *** runcommand st foo/bar
163 *** runcommand st foo/bar
164 ? foo/bar
164 ? foo/bar
165
165
166 $ rm foo/bar
166 $ rm foo/bar
167
167
168
168
169 check that local configs for the cached repo aren't inherited when -R is used:
169 check that local configs for the cached repo aren't inherited when -R is used:
170
170
171 $ cat <<EOF >> .hg/hgrc
171 $ cat <<EOF >> .hg/hgrc
172 > [ui]
172 > [ui]
173 > foo = bar
173 > foo = bar
174 > EOF
174 > EOF
175
175
176 >>> from hgclient import readchannel, sep, runcommand, check
176 >>> from hgclient import readchannel, sep, runcommand, check
177 >>> @check
177 >>> @check
178 ... def localhgrc(server):
178 ... def localhgrc(server):
179 ... readchannel(server)
179 ... readchannel(server)
180 ...
180 ...
181 ... # the cached repo local hgrc contains ui.foo=bar, so showconfig should
181 ... # the cached repo local hgrc contains ui.foo=bar, so showconfig should
182 ... # show it
182 ... # show it
183 ... runcommand(server, ['showconfig'], outfilter=sep)
183 ... runcommand(server, ['showconfig'], outfilter=sep)
184 ...
184 ...
185 ... # but not for this repo
185 ... # but not for this repo
186 ... runcommand(server, ['init', 'foo'])
186 ... runcommand(server, ['init', 'foo'])
187 ... runcommand(server, ['-R', 'foo', 'showconfig', 'ui', 'defaults'])
187 ... runcommand(server, ['-R', 'foo', 'showconfig', 'ui', 'defaults'])
188 *** runcommand showconfig
188 *** runcommand showconfig
189 bundle.mainreporoot=$TESTTMP/repo
189 bundle.mainreporoot=$TESTTMP/repo
190 devel.all-warnings=true
190 devel.all-warnings=true
191 devel.default-date=0 0
191 devel.default-date=0 0
192 extensions.fsmonitor= (fsmonitor !)
192 extensions.fsmonitor= (fsmonitor !)
193 largefiles.usercache=$TESTTMP/.cache/largefiles
193 largefiles.usercache=$TESTTMP/.cache/largefiles
194 ui.slash=True
194 ui.slash=True
195 ui.interactive=False
195 ui.interactive=False
196 ui.mergemarkers=detailed
196 ui.mergemarkers=detailed
197 ui.usehttp2=true (?)
197 ui.usehttp2=true (?)
198 ui.foo=bar
198 ui.foo=bar
199 ui.nontty=true
199 ui.nontty=true
200 web.address=localhost
200 web.address=localhost
201 web\.ipv6=(?:True|False) (re)
201 web\.ipv6=(?:True|False) (re)
202 *** runcommand init foo
202 *** runcommand init foo
203 *** runcommand -R foo showconfig ui defaults
203 *** runcommand -R foo showconfig ui defaults
204 ui.slash=True
204 ui.slash=True
205 ui.interactive=False
205 ui.interactive=False
206 ui.mergemarkers=detailed
206 ui.mergemarkers=detailed
207 ui.usehttp2=true (?)
207 ui.usehttp2=true (?)
208 ui.nontty=true
208 ui.nontty=true
209
209
210 $ rm -R foo
210 $ rm -R foo
211
211
212 #if windows
212 #if windows
213 $ PYTHONPATH="$TESTTMP/repo;$PYTHONPATH"
213 $ PYTHONPATH="$TESTTMP/repo;$PYTHONPATH"
214 #else
214 #else
215 $ PYTHONPATH="$TESTTMP/repo:$PYTHONPATH"
215 $ PYTHONPATH="$TESTTMP/repo:$PYTHONPATH"
216 #endif
216 #endif
217
217
218 $ cat <<EOF > hook.py
218 $ cat <<EOF > hook.py
219 > from __future__ import print_function
219 > from __future__ import print_function
220 > import sys
220 > import sys
221 > def hook(**args):
221 > def hook(**args):
222 > print('hook talking')
222 > print('hook talking')
223 > print('now try to read something: %r' % sys.stdin.read())
223 > print('now try to read something: %r' % sys.stdin.read())
224 > EOF
224 > EOF
225
225
226 >>> from hgclient import readchannel, runcommand, check, stringio
226 >>> from hgclient import readchannel, runcommand, check, stringio
227 >>> @check
227 >>> @check
228 ... def hookoutput(server):
228 ... def hookoutput(server):
229 ... readchannel(server)
229 ... readchannel(server)
230 ... runcommand(server, ['--config',
230 ... runcommand(server, ['--config',
231 ... 'hooks.pre-identify=python:hook.hook',
231 ... 'hooks.pre-identify=python:hook.hook',
232 ... 'id'],
232 ... 'id'],
233 ... input=stringio('some input'))
233 ... input=stringio('some input'))
234 *** runcommand --config hooks.pre-identify=python:hook.hook id
234 *** runcommand --config hooks.pre-identify=python:hook.hook id
235 eff892de26ec tip
235 eff892de26ec tip
236
236
237 Clean hook cached version
237 $ rm hook.py*
238 $ rm hook.py*
239 $ rm -Rf __pycache__
238
240
239 $ echo a >> a
241 $ echo a >> a
240 >>> import os
242 >>> import os
241 >>> from hgclient import readchannel, runcommand, check
243 >>> from hgclient import readchannel, runcommand, check
242 >>> @check
244 >>> @check
243 ... def outsidechanges(server):
245 ... def outsidechanges(server):
244 ... readchannel(server)
246 ... readchannel(server)
245 ... runcommand(server, ['status'])
247 ... runcommand(server, ['status'])
246 ... os.system('hg ci -Am2')
248 ... os.system('hg ci -Am2')
247 ... runcommand(server, ['tip'])
249 ... runcommand(server, ['tip'])
248 ... runcommand(server, ['status'])
250 ... runcommand(server, ['status'])
249 *** runcommand status
251 *** runcommand status
250 M a
252 M a
251 *** runcommand tip
253 *** runcommand tip
252 changeset: 1:d3a0a68be6de
254 changeset: 1:d3a0a68be6de
253 tag: tip
255 tag: tip
254 user: test
256 user: test
255 date: Thu Jan 01 00:00:00 1970 +0000
257 date: Thu Jan 01 00:00:00 1970 +0000
256 summary: 2
258 summary: 2
257
259
258 *** runcommand status
260 *** runcommand status
259
261
260 >>> import os
262 >>> import os
261 >>> from hgclient import readchannel, runcommand, check
263 >>> from hgclient import readchannel, runcommand, check
262 >>> @check
264 >>> @check
263 ... def bookmarks(server):
265 ... def bookmarks(server):
264 ... readchannel(server)
266 ... readchannel(server)
265 ... runcommand(server, ['bookmarks'])
267 ... runcommand(server, ['bookmarks'])
266 ...
268 ...
267 ... # changes .hg/bookmarks
269 ... # changes .hg/bookmarks
268 ... os.system('hg bookmark -i bm1')
270 ... os.system('hg bookmark -i bm1')
269 ... os.system('hg bookmark -i bm2')
271 ... os.system('hg bookmark -i bm2')
270 ... runcommand(server, ['bookmarks'])
272 ... runcommand(server, ['bookmarks'])
271 ...
273 ...
272 ... # changes .hg/bookmarks.current
274 ... # changes .hg/bookmarks.current
273 ... os.system('hg upd bm1 -q')
275 ... os.system('hg upd bm1 -q')
274 ... runcommand(server, ['bookmarks'])
276 ... runcommand(server, ['bookmarks'])
275 ...
277 ...
276 ... runcommand(server, ['bookmarks', 'bm3'])
278 ... runcommand(server, ['bookmarks', 'bm3'])
277 ... f = open('a', 'ab')
279 ... f = open('a', 'ab')
278 ... f.write('a\n')
280 ... f.write('a\n')
279 ... f.close()
281 ... f.close()
280 ... runcommand(server, ['commit', '-Amm'])
282 ... runcommand(server, ['commit', '-Amm'])
281 ... runcommand(server, ['bookmarks'])
283 ... runcommand(server, ['bookmarks'])
282 *** runcommand bookmarks
284 *** runcommand bookmarks
283 no bookmarks set
285 no bookmarks set
284 *** runcommand bookmarks
286 *** runcommand bookmarks
285 bm1 1:d3a0a68be6de
287 bm1 1:d3a0a68be6de
286 bm2 1:d3a0a68be6de
288 bm2 1:d3a0a68be6de
287 *** runcommand bookmarks
289 *** runcommand bookmarks
288 * bm1 1:d3a0a68be6de
290 * bm1 1:d3a0a68be6de
289 bm2 1:d3a0a68be6de
291 bm2 1:d3a0a68be6de
290 *** runcommand bookmarks bm3
292 *** runcommand bookmarks bm3
291 *** runcommand commit -Amm
293 *** runcommand commit -Amm
292 *** runcommand bookmarks
294 *** runcommand bookmarks
293 bm1 1:d3a0a68be6de
295 bm1 1:d3a0a68be6de
294 bm2 1:d3a0a68be6de
296 bm2 1:d3a0a68be6de
295 * bm3 2:aef17e88f5f0
297 * bm3 2:aef17e88f5f0
296
298
297 >>> import os
299 >>> import os
298 >>> from hgclient import readchannel, runcommand, check
300 >>> from hgclient import readchannel, runcommand, check
299 >>> @check
301 >>> @check
300 ... def tagscache(server):
302 ... def tagscache(server):
301 ... readchannel(server)
303 ... readchannel(server)
302 ... runcommand(server, ['id', '-t', '-r', '0'])
304 ... runcommand(server, ['id', '-t', '-r', '0'])
303 ... os.system('hg tag -r 0 foo')
305 ... os.system('hg tag -r 0 foo')
304 ... runcommand(server, ['id', '-t', '-r', '0'])
306 ... runcommand(server, ['id', '-t', '-r', '0'])
305 *** runcommand id -t -r 0
307 *** runcommand id -t -r 0
306
308
307 *** runcommand id -t -r 0
309 *** runcommand id -t -r 0
308 foo
310 foo
309
311
310 >>> import os
312 >>> import os
311 >>> from hgclient import readchannel, runcommand, check
313 >>> from hgclient import readchannel, runcommand, check
312 >>> @check
314 >>> @check
313 ... def setphase(server):
315 ... def setphase(server):
314 ... readchannel(server)
316 ... readchannel(server)
315 ... runcommand(server, ['phase', '-r', '.'])
317 ... runcommand(server, ['phase', '-r', '.'])
316 ... os.system('hg phase -r . -p')
318 ... os.system('hg phase -r . -p')
317 ... runcommand(server, ['phase', '-r', '.'])
319 ... runcommand(server, ['phase', '-r', '.'])
318 *** runcommand phase -r .
320 *** runcommand phase -r .
319 3: draft
321 3: draft
320 *** runcommand phase -r .
322 *** runcommand phase -r .
321 3: public
323 3: public
322
324
323 $ echo a >> a
325 $ echo a >> a
324 >>> from hgclient import readchannel, runcommand, check
326 >>> from hgclient import readchannel, runcommand, check
325 >>> @check
327 >>> @check
326 ... def rollback(server):
328 ... def rollback(server):
327 ... readchannel(server)
329 ... readchannel(server)
328 ... runcommand(server, ['phase', '-r', '.', '-p'])
330 ... runcommand(server, ['phase', '-r', '.', '-p'])
329 ... runcommand(server, ['commit', '-Am.'])
331 ... runcommand(server, ['commit', '-Am.'])
330 ... runcommand(server, ['rollback'])
332 ... runcommand(server, ['rollback'])
331 ... runcommand(server, ['phase', '-r', '.'])
333 ... runcommand(server, ['phase', '-r', '.'])
332 *** runcommand phase -r . -p
334 *** runcommand phase -r . -p
333 no phases changed
335 no phases changed
334 *** runcommand commit -Am.
336 *** runcommand commit -Am.
335 *** runcommand rollback
337 *** runcommand rollback
336 repository tip rolled back to revision 3 (undo commit)
338 repository tip rolled back to revision 3 (undo commit)
337 working directory now based on revision 3
339 working directory now based on revision 3
338 *** runcommand phase -r .
340 *** runcommand phase -r .
339 3: public
341 3: public
340
342
341 >>> import os
343 >>> import os
342 >>> from hgclient import readchannel, runcommand, check
344 >>> from hgclient import readchannel, runcommand, check
343 >>> @check
345 >>> @check
344 ... def branch(server):
346 ... def branch(server):
345 ... readchannel(server)
347 ... readchannel(server)
346 ... runcommand(server, ['branch'])
348 ... runcommand(server, ['branch'])
347 ... os.system('hg branch foo')
349 ... os.system('hg branch foo')
348 ... runcommand(server, ['branch'])
350 ... runcommand(server, ['branch'])
349 ... os.system('hg branch default')
351 ... os.system('hg branch default')
350 *** runcommand branch
352 *** runcommand branch
351 default
353 default
352 marked working directory as branch foo
354 marked working directory as branch foo
353 (branches are permanent and global, did you want a bookmark?)
355 (branches are permanent and global, did you want a bookmark?)
354 *** runcommand branch
356 *** runcommand branch
355 foo
357 foo
356 marked working directory as branch default
358 marked working directory as branch default
357 (branches are permanent and global, did you want a bookmark?)
359 (branches are permanent and global, did you want a bookmark?)
358
360
359 $ touch .hgignore
361 $ touch .hgignore
360 >>> import os
362 >>> import os
361 >>> from hgclient import readchannel, runcommand, check
363 >>> from hgclient import readchannel, runcommand, check
362 >>> @check
364 >>> @check
363 ... def hgignore(server):
365 ... def hgignore(server):
364 ... readchannel(server)
366 ... readchannel(server)
365 ... runcommand(server, ['commit', '-Am.'])
367 ... runcommand(server, ['commit', '-Am.'])
366 ... f = open('ignored-file', 'ab')
368 ... f = open('ignored-file', 'ab')
367 ... f.write('')
369 ... f.write('')
368 ... f.close()
370 ... f.close()
369 ... f = open('.hgignore', 'ab')
371 ... f = open('.hgignore', 'ab')
370 ... f.write('ignored-file')
372 ... f.write('ignored-file')
371 ... f.close()
373 ... f.close()
372 ... runcommand(server, ['status', '-i', '-u'])
374 ... runcommand(server, ['status', '-i', '-u'])
373 *** runcommand commit -Am.
375 *** runcommand commit -Am.
374 adding .hgignore
376 adding .hgignore
375 *** runcommand status -i -u
377 *** runcommand status -i -u
376 I ignored-file
378 I ignored-file
377
379
378 cache of non-public revisions should be invalidated on repository change
380 cache of non-public revisions should be invalidated on repository change
379 (issue4855):
381 (issue4855):
380
382
381 >>> import os
383 >>> import os
382 >>> from hgclient import readchannel, runcommand, check
384 >>> from hgclient import readchannel, runcommand, check
383 >>> @check
385 >>> @check
384 ... def phasesetscacheaftercommit(server):
386 ... def phasesetscacheaftercommit(server):
385 ... readchannel(server)
387 ... readchannel(server)
386 ... # load _phasecache._phaserevs and _phasesets
388 ... # load _phasecache._phaserevs and _phasesets
387 ... runcommand(server, ['log', '-qr', 'draft()'])
389 ... runcommand(server, ['log', '-qr', 'draft()'])
388 ... # create draft commits by another process
390 ... # create draft commits by another process
389 ... for i in xrange(5, 7):
391 ... for i in xrange(5, 7):
390 ... f = open('a', 'ab')
392 ... f = open('a', 'ab')
391 ... f.seek(0, os.SEEK_END)
393 ... f.seek(0, os.SEEK_END)
392 ... f.write('a\n')
394 ... f.write('a\n')
393 ... f.close()
395 ... f.close()
394 ... os.system('hg commit -Aqm%d' % i)
396 ... os.system('hg commit -Aqm%d' % i)
395 ... # new commits should be listed as draft revisions
397 ... # new commits should be listed as draft revisions
396 ... runcommand(server, ['log', '-qr', 'draft()'])
398 ... runcommand(server, ['log', '-qr', 'draft()'])
397 *** runcommand log -qr draft()
399 *** runcommand log -qr draft()
398 4:7966c8e3734d
400 4:7966c8e3734d
399 *** runcommand log -qr draft()
401 *** runcommand log -qr draft()
400 4:7966c8e3734d
402 4:7966c8e3734d
401 5:41f6602d1c4f
403 5:41f6602d1c4f
402 6:10501e202c35
404 6:10501e202c35
403
405
404 >>> import os
406 >>> import os
405 >>> from hgclient import readchannel, runcommand, check
407 >>> from hgclient import readchannel, runcommand, check
406 >>> @check
408 >>> @check
407 ... def phasesetscacheafterstrip(server):
409 ... def phasesetscacheafterstrip(server):
408 ... readchannel(server)
410 ... readchannel(server)
409 ... # load _phasecache._phaserevs and _phasesets
411 ... # load _phasecache._phaserevs and _phasesets
410 ... runcommand(server, ['log', '-qr', 'draft()'])
412 ... runcommand(server, ['log', '-qr', 'draft()'])
411 ... # strip cached revisions by another process
413 ... # strip cached revisions by another process
412 ... os.system('hg --config extensions.strip= strip -q 5')
414 ... os.system('hg --config extensions.strip= strip -q 5')
413 ... # shouldn't abort by "unknown revision '6'"
415 ... # shouldn't abort by "unknown revision '6'"
414 ... runcommand(server, ['log', '-qr', 'draft()'])
416 ... runcommand(server, ['log', '-qr', 'draft()'])
415 *** runcommand log -qr draft()
417 *** runcommand log -qr draft()
416 4:7966c8e3734d
418 4:7966c8e3734d
417 5:41f6602d1c4f
419 5:41f6602d1c4f
418 6:10501e202c35
420 6:10501e202c35
419 *** runcommand log -qr draft()
421 *** runcommand log -qr draft()
420 4:7966c8e3734d
422 4:7966c8e3734d
421
423
422 cache of phase roots should be invalidated on strip (issue3827):
424 cache of phase roots should be invalidated on strip (issue3827):
423
425
424 >>> import os
426 >>> import os
425 >>> from hgclient import readchannel, sep, runcommand, check
427 >>> from hgclient import readchannel, sep, runcommand, check
426 >>> @check
428 >>> @check
427 ... def phasecacheafterstrip(server):
429 ... def phasecacheafterstrip(server):
428 ... readchannel(server)
430 ... readchannel(server)
429 ...
431 ...
430 ... # create new head, 5:731265503d86
432 ... # create new head, 5:731265503d86
431 ... runcommand(server, ['update', '-C', '0'])
433 ... runcommand(server, ['update', '-C', '0'])
432 ... f = open('a', 'ab')
434 ... f = open('a', 'ab')
433 ... f.write('a\n')
435 ... f.write('a\n')
434 ... f.close()
436 ... f.close()
435 ... runcommand(server, ['commit', '-Am.', 'a'])
437 ... runcommand(server, ['commit', '-Am.', 'a'])
436 ... runcommand(server, ['log', '-Gq'])
438 ... runcommand(server, ['log', '-Gq'])
437 ...
439 ...
438 ... # make it public; draft marker moves to 4:7966c8e3734d
440 ... # make it public; draft marker moves to 4:7966c8e3734d
439 ... runcommand(server, ['phase', '-p', '.'])
441 ... runcommand(server, ['phase', '-p', '.'])
440 ... # load _phasecache.phaseroots
442 ... # load _phasecache.phaseroots
441 ... runcommand(server, ['phase', '.'], outfilter=sep)
443 ... runcommand(server, ['phase', '.'], outfilter=sep)
442 ...
444 ...
443 ... # strip 1::4 outside server
445 ... # strip 1::4 outside server
444 ... os.system('hg -q --config extensions.mq= strip 1')
446 ... os.system('hg -q --config extensions.mq= strip 1')
445 ...
447 ...
446 ... # shouldn't raise "7966c8e3734d: no node!"
448 ... # shouldn't raise "7966c8e3734d: no node!"
447 ... runcommand(server, ['branches'])
449 ... runcommand(server, ['branches'])
448 *** runcommand update -C 0
450 *** runcommand update -C 0
449 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
451 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
450 (leaving bookmark bm3)
452 (leaving bookmark bm3)
451 *** runcommand commit -Am. a
453 *** runcommand commit -Am. a
452 created new head
454 created new head
453 *** runcommand log -Gq
455 *** runcommand log -Gq
454 @ 5:731265503d86
456 @ 5:731265503d86
455 |
457 |
456 | o 4:7966c8e3734d
458 | o 4:7966c8e3734d
457 | |
459 | |
458 | o 3:b9b85890c400
460 | o 3:b9b85890c400
459 | |
461 | |
460 | o 2:aef17e88f5f0
462 | o 2:aef17e88f5f0
461 | |
463 | |
462 | o 1:d3a0a68be6de
464 | o 1:d3a0a68be6de
463 |/
465 |/
464 o 0:eff892de26ec
466 o 0:eff892de26ec
465
467
466 *** runcommand phase -p .
468 *** runcommand phase -p .
467 *** runcommand phase .
469 *** runcommand phase .
468 5: public
470 5: public
469 *** runcommand branches
471 *** runcommand branches
470 default 1:731265503d86
472 default 1:731265503d86
471
473
472 in-memory cache must be reloaded if transaction is aborted. otherwise
474 in-memory cache must be reloaded if transaction is aborted. otherwise
473 changelog and manifest would have invalid node:
475 changelog and manifest would have invalid node:
474
476
475 $ echo a >> a
477 $ echo a >> a
476 >>> from hgclient import readchannel, runcommand, check
478 >>> from hgclient import readchannel, runcommand, check
477 >>> @check
479 >>> @check
478 ... def txabort(server):
480 ... def txabort(server):
479 ... readchannel(server)
481 ... readchannel(server)
480 ... runcommand(server, ['commit', '--config', 'hooks.pretxncommit=false',
482 ... runcommand(server, ['commit', '--config', 'hooks.pretxncommit=false',
481 ... '-mfoo'])
483 ... '-mfoo'])
482 ... runcommand(server, ['verify'])
484 ... runcommand(server, ['verify'])
483 *** runcommand commit --config hooks.pretxncommit=false -mfoo
485 *** runcommand commit --config hooks.pretxncommit=false -mfoo
484 transaction abort!
486 transaction abort!
485 rollback completed
487 rollback completed
486 abort: pretxncommit hook exited with status 1
488 abort: pretxncommit hook exited with status 1
487 [255]
489 [255]
488 *** runcommand verify
490 *** runcommand verify
489 checking changesets
491 checking changesets
490 checking manifests
492 checking manifests
491 crosschecking files in changesets and manifests
493 crosschecking files in changesets and manifests
492 checking files
494 checking files
493 1 files, 2 changesets, 2 total revisions
495 1 files, 2 changesets, 2 total revisions
494 $ hg revert --no-backup -aq
496 $ hg revert --no-backup -aq
495
497
496 $ cat >> .hg/hgrc << EOF
498 $ cat >> .hg/hgrc << EOF
497 > [experimental]
499 > [experimental]
498 > evolution=createmarkers
500 > evolution=createmarkers
499 > EOF
501 > EOF
500
502
501 >>> import os
503 >>> import os
502 >>> from hgclient import readchannel, runcommand, check
504 >>> from hgclient import readchannel, runcommand, check
503 >>> @check
505 >>> @check
504 ... def obsolete(server):
506 ... def obsolete(server):
505 ... readchannel(server)
507 ... readchannel(server)
506 ...
508 ...
507 ... runcommand(server, ['up', 'null'])
509 ... runcommand(server, ['up', 'null'])
508 ... runcommand(server, ['phase', '-df', 'tip'])
510 ... runcommand(server, ['phase', '-df', 'tip'])
509 ... cmd = 'hg debugobsolete `hg log -r tip --template {node}`'
511 ... cmd = 'hg debugobsolete `hg log -r tip --template {node}`'
510 ... if os.name == 'nt':
512 ... if os.name == 'nt':
511 ... cmd = 'sh -c "%s"' % cmd # run in sh, not cmd.exe
513 ... cmd = 'sh -c "%s"' % cmd # run in sh, not cmd.exe
512 ... os.system(cmd)
514 ... os.system(cmd)
513 ... runcommand(server, ['log', '--hidden'])
515 ... runcommand(server, ['log', '--hidden'])
514 ... runcommand(server, ['log'])
516 ... runcommand(server, ['log'])
515 *** runcommand up null
517 *** runcommand up null
516 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
518 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
517 *** runcommand phase -df tip
519 *** runcommand phase -df tip
518 obsoleted 1 changesets
520 obsoleted 1 changesets
519 *** runcommand log --hidden
521 *** runcommand log --hidden
520 changeset: 1:731265503d86
522 changeset: 1:731265503d86
521 tag: tip
523 tag: tip
522 user: test
524 user: test
523 date: Thu Jan 01 00:00:00 1970 +0000
525 date: Thu Jan 01 00:00:00 1970 +0000
524 summary: .
526 summary: .
525
527
526 changeset: 0:eff892de26ec
528 changeset: 0:eff892de26ec
527 bookmark: bm1
529 bookmark: bm1
528 bookmark: bm2
530 bookmark: bm2
529 bookmark: bm3
531 bookmark: bm3
530 user: test
532 user: test
531 date: Thu Jan 01 00:00:00 1970 +0000
533 date: Thu Jan 01 00:00:00 1970 +0000
532 summary: 1
534 summary: 1
533
535
534 *** runcommand log
536 *** runcommand log
535 changeset: 0:eff892de26ec
537 changeset: 0:eff892de26ec
536 bookmark: bm1
538 bookmark: bm1
537 bookmark: bm2
539 bookmark: bm2
538 bookmark: bm3
540 bookmark: bm3
539 tag: tip
541 tag: tip
540 user: test
542 user: test
541 date: Thu Jan 01 00:00:00 1970 +0000
543 date: Thu Jan 01 00:00:00 1970 +0000
542 summary: 1
544 summary: 1
543
545
544
546
545 $ cat <<EOF >> .hg/hgrc
547 $ cat <<EOF >> .hg/hgrc
546 > [extensions]
548 > [extensions]
547 > mq =
549 > mq =
548 > EOF
550 > EOF
549
551
550 >>> import os
552 >>> import os
551 >>> from hgclient import readchannel, runcommand, check
553 >>> from hgclient import readchannel, runcommand, check
552 >>> @check
554 >>> @check
553 ... def mqoutsidechanges(server):
555 ... def mqoutsidechanges(server):
554 ... readchannel(server)
556 ... readchannel(server)
555 ...
557 ...
556 ... # load repo.mq
558 ... # load repo.mq
557 ... runcommand(server, ['qapplied'])
559 ... runcommand(server, ['qapplied'])
558 ... os.system('hg qnew 0.diff')
560 ... os.system('hg qnew 0.diff')
559 ... # repo.mq should be invalidated
561 ... # repo.mq should be invalidated
560 ... runcommand(server, ['qapplied'])
562 ... runcommand(server, ['qapplied'])
561 ...
563 ...
562 ... runcommand(server, ['qpop', '--all'])
564 ... runcommand(server, ['qpop', '--all'])
563 ... os.system('hg qqueue --create foo')
565 ... os.system('hg qqueue --create foo')
564 ... # repo.mq should be recreated to point to new queue
566 ... # repo.mq should be recreated to point to new queue
565 ... runcommand(server, ['qqueue', '--active'])
567 ... runcommand(server, ['qqueue', '--active'])
566 *** runcommand qapplied
568 *** runcommand qapplied
567 *** runcommand qapplied
569 *** runcommand qapplied
568 0.diff
570 0.diff
569 *** runcommand qpop --all
571 *** runcommand qpop --all
570 popping 0.diff
572 popping 0.diff
571 patch queue now empty
573 patch queue now empty
572 *** runcommand qqueue --active
574 *** runcommand qqueue --active
573 foo
575 foo
574
576
575 $ cat <<EOF > dbgui.py
577 $ cat <<EOF > dbgui.py
576 > import os, sys
578 > import os, sys
577 > from mercurial import commands, registrar
579 > from mercurial import commands, registrar
578 > cmdtable = {}
580 > cmdtable = {}
579 > command = registrar.command(cmdtable)
581 > command = registrar.command(cmdtable)
580 > @command(b"debuggetpass", norepo=True)
582 > @command(b"debuggetpass", norepo=True)
581 > def debuggetpass(ui):
583 > def debuggetpass(ui):
582 > ui.write("%s\\n" % ui.getpass())
584 > ui.write("%s\\n" % ui.getpass())
583 > @command(b"debugprompt", norepo=True)
585 > @command(b"debugprompt", norepo=True)
584 > def debugprompt(ui):
586 > def debugprompt(ui):
585 > ui.write("%s\\n" % ui.prompt("prompt:"))
587 > ui.write("%s\\n" % ui.prompt("prompt:"))
586 > @command(b"debugreadstdin", norepo=True)
588 > @command(b"debugreadstdin", norepo=True)
587 > def debugreadstdin(ui):
589 > def debugreadstdin(ui):
588 > ui.write("read: %r\n" % sys.stdin.read(1))
590 > ui.write("read: %r\n" % sys.stdin.read(1))
589 > @command(b"debugwritestdout", norepo=True)
591 > @command(b"debugwritestdout", norepo=True)
590 > def debugwritestdout(ui):
592 > def debugwritestdout(ui):
591 > os.write(1, "low-level stdout fd and\n")
593 > os.write(1, "low-level stdout fd and\n")
592 > sys.stdout.write("stdout should be redirected to /dev/null\n")
594 > sys.stdout.write("stdout should be redirected to /dev/null\n")
593 > sys.stdout.flush()
595 > sys.stdout.flush()
594 > EOF
596 > EOF
595 $ cat <<EOF >> .hg/hgrc
597 $ cat <<EOF >> .hg/hgrc
596 > [extensions]
598 > [extensions]
597 > dbgui = dbgui.py
599 > dbgui = dbgui.py
598 > EOF
600 > EOF
599
601
600 >>> from hgclient import readchannel, runcommand, check, stringio
602 >>> from hgclient import readchannel, runcommand, check, stringio
601 >>> @check
603 >>> @check
602 ... def getpass(server):
604 ... def getpass(server):
603 ... readchannel(server)
605 ... readchannel(server)
604 ... runcommand(server, ['debuggetpass', '--config',
606 ... runcommand(server, ['debuggetpass', '--config',
605 ... 'ui.interactive=True'],
607 ... 'ui.interactive=True'],
606 ... input=stringio('1234\n'))
608 ... input=stringio('1234\n'))
607 ... runcommand(server, ['debuggetpass', '--config',
609 ... runcommand(server, ['debuggetpass', '--config',
608 ... 'ui.interactive=True'],
610 ... 'ui.interactive=True'],
609 ... input=stringio('\n'))
611 ... input=stringio('\n'))
610 ... runcommand(server, ['debuggetpass', '--config',
612 ... runcommand(server, ['debuggetpass', '--config',
611 ... 'ui.interactive=True'],
613 ... 'ui.interactive=True'],
612 ... input=stringio(''))
614 ... input=stringio(''))
613 ... runcommand(server, ['debugprompt', '--config',
615 ... runcommand(server, ['debugprompt', '--config',
614 ... 'ui.interactive=True'],
616 ... 'ui.interactive=True'],
615 ... input=stringio('5678\n'))
617 ... input=stringio('5678\n'))
616 ... runcommand(server, ['debugreadstdin'])
618 ... runcommand(server, ['debugreadstdin'])
617 ... runcommand(server, ['debugwritestdout'])
619 ... runcommand(server, ['debugwritestdout'])
618 *** runcommand debuggetpass --config ui.interactive=True
620 *** runcommand debuggetpass --config ui.interactive=True
619 password: 1234
621 password: 1234
620 *** runcommand debuggetpass --config ui.interactive=True
622 *** runcommand debuggetpass --config ui.interactive=True
621 password:
623 password:
622 *** runcommand debuggetpass --config ui.interactive=True
624 *** runcommand debuggetpass --config ui.interactive=True
623 password: abort: response expected
625 password: abort: response expected
624 [255]
626 [255]
625 *** runcommand debugprompt --config ui.interactive=True
627 *** runcommand debugprompt --config ui.interactive=True
626 prompt: 5678
628 prompt: 5678
627 *** runcommand debugreadstdin
629 *** runcommand debugreadstdin
628 read: ''
630 read: ''
629 *** runcommand debugwritestdout
631 *** runcommand debugwritestdout
630
632
631
633
632 run commandserver in commandserver, which is silly but should work:
634 run commandserver in commandserver, which is silly but should work:
633
635
634 >>> from __future__ import print_function
636 >>> from __future__ import print_function
635 >>> from hgclient import readchannel, runcommand, check, stringio
637 >>> from hgclient import readchannel, runcommand, check, stringio
636 >>> @check
638 >>> @check
637 ... def nested(server):
639 ... def nested(server):
638 ... print('%c, %r' % readchannel(server))
640 ... print('%c, %r' % readchannel(server))
639 ... class nestedserver(object):
641 ... class nestedserver(object):
640 ... stdin = stringio('getencoding\n')
642 ... stdin = stringio('getencoding\n')
641 ... stdout = stringio()
643 ... stdout = stringio()
642 ... runcommand(server, ['serve', '--cmdserver', 'pipe'],
644 ... runcommand(server, ['serve', '--cmdserver', 'pipe'],
643 ... output=nestedserver.stdout, input=nestedserver.stdin)
645 ... output=nestedserver.stdout, input=nestedserver.stdin)
644 ... nestedserver.stdout.seek(0)
646 ... nestedserver.stdout.seek(0)
645 ... print('%c, %r' % readchannel(nestedserver)) # hello
647 ... print('%c, %r' % readchannel(nestedserver)) # hello
646 ... print('%c, %r' % readchannel(nestedserver)) # getencoding
648 ... print('%c, %r' % readchannel(nestedserver)) # getencoding
647 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
649 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
648 *** runcommand serve --cmdserver pipe
650 *** runcommand serve --cmdserver pipe
649 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
651 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
650 r, '*' (glob)
652 r, '*' (glob)
651
653
652
654
653 start without repository:
655 start without repository:
654
656
655 $ cd ..
657 $ cd ..
656
658
657 >>> from __future__ import print_function
659 >>> from __future__ import print_function
658 >>> from hgclient import readchannel, runcommand, check
660 >>> from hgclient import readchannel, runcommand, check
659 >>> @check
661 >>> @check
660 ... def hellomessage(server):
662 ... def hellomessage(server):
661 ... ch, data = readchannel(server)
663 ... ch, data = readchannel(server)
662 ... print('%c, %r' % (ch, data))
664 ... print('%c, %r' % (ch, data))
663 ... # run an arbitrary command to make sure the next thing the server
665 ... # run an arbitrary command to make sure the next thing the server
664 ... # sends isn't part of the hello message
666 ... # sends isn't part of the hello message
665 ... runcommand(server, ['id'])
667 ... runcommand(server, ['id'])
666 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
668 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
667 *** runcommand id
669 *** runcommand id
668 abort: there is no Mercurial repository here (.hg not found)
670 abort: there is no Mercurial repository here (.hg not found)
669 [255]
671 [255]
670
672
671 >>> from hgclient import readchannel, runcommand, check
673 >>> from hgclient import readchannel, runcommand, check
672 >>> @check
674 >>> @check
673 ... def startwithoutrepo(server):
675 ... def startwithoutrepo(server):
674 ... readchannel(server)
676 ... readchannel(server)
675 ... runcommand(server, ['init', 'repo2'])
677 ... runcommand(server, ['init', 'repo2'])
676 ... runcommand(server, ['id', '-R', 'repo2'])
678 ... runcommand(server, ['id', '-R', 'repo2'])
677 *** runcommand init repo2
679 *** runcommand init repo2
678 *** runcommand id -R repo2
680 *** runcommand id -R repo2
679 000000000000 tip
681 000000000000 tip
680
682
681
683
682 don't fall back to cwd if invalid -R path is specified (issue4805):
684 don't fall back to cwd if invalid -R path is specified (issue4805):
683
685
684 $ cd repo
686 $ cd repo
685 $ hg serve --cmdserver pipe -R ../nonexistent
687 $ hg serve --cmdserver pipe -R ../nonexistent
686 abort: repository ../nonexistent not found!
688 abort: repository ../nonexistent not found!
687 [255]
689 [255]
688 $ cd ..
690 $ cd ..
689
691
690
692
691 unix domain socket:
693 unix domain socket:
692
694
693 $ cd repo
695 $ cd repo
694 $ hg update -q
696 $ hg update -q
695
697
696 #if unix-socket unix-permissions
698 #if unix-socket unix-permissions
697
699
698 >>> from __future__ import print_function
700 >>> from __future__ import print_function
699 >>> from hgclient import unixserver, readchannel, runcommand, check, stringio
701 >>> from hgclient import unixserver, readchannel, runcommand, check, stringio
700 >>> server = unixserver('.hg/server.sock', '.hg/server.log')
702 >>> server = unixserver('.hg/server.sock', '.hg/server.log')
701 >>> def hellomessage(conn):
703 >>> def hellomessage(conn):
702 ... ch, data = readchannel(conn)
704 ... ch, data = readchannel(conn)
703 ... print('%c, %r' % (ch, data))
705 ... print('%c, %r' % (ch, data))
704 ... runcommand(conn, ['id'])
706 ... runcommand(conn, ['id'])
705 >>> check(hellomessage, server.connect)
707 >>> check(hellomessage, server.connect)
706 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
708 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
707 *** runcommand id
709 *** runcommand id
708 eff892de26ec tip bm1/bm2/bm3
710 eff892de26ec tip bm1/bm2/bm3
709 >>> def unknowncommand(conn):
711 >>> def unknowncommand(conn):
710 ... readchannel(conn)
712 ... readchannel(conn)
711 ... conn.stdin.write('unknowncommand\n')
713 ... conn.stdin.write('unknowncommand\n')
712 >>> check(unknowncommand, server.connect) # error sent to server.log
714 >>> check(unknowncommand, server.connect) # error sent to server.log
713 >>> def serverinput(conn):
715 >>> def serverinput(conn):
714 ... readchannel(conn)
716 ... readchannel(conn)
715 ... patch = """
717 ... patch = """
716 ... # HG changeset patch
718 ... # HG changeset patch
717 ... # User test
719 ... # User test
718 ... # Date 0 0
720 ... # Date 0 0
719 ... 2
721 ... 2
720 ...
722 ...
721 ... diff -r eff892de26ec -r 1ed24be7e7a0 a
723 ... diff -r eff892de26ec -r 1ed24be7e7a0 a
722 ... --- a/a
724 ... --- a/a
723 ... +++ b/a
725 ... +++ b/a
724 ... @@ -1,1 +1,2 @@
726 ... @@ -1,1 +1,2 @@
725 ... 1
727 ... 1
726 ... +2
728 ... +2
727 ... """
729 ... """
728 ... runcommand(conn, ['import', '-'], input=stringio(patch))
730 ... runcommand(conn, ['import', '-'], input=stringio(patch))
729 ... runcommand(conn, ['log', '-rtip', '-q'])
731 ... runcommand(conn, ['log', '-rtip', '-q'])
730 >>> check(serverinput, server.connect)
732 >>> check(serverinput, server.connect)
731 *** runcommand import -
733 *** runcommand import -
732 applying patch from stdin
734 applying patch from stdin
733 *** runcommand log -rtip -q
735 *** runcommand log -rtip -q
734 2:1ed24be7e7a0
736 2:1ed24be7e7a0
735 >>> server.shutdown()
737 >>> server.shutdown()
736
738
737 $ cat .hg/server.log
739 $ cat .hg/server.log
738 listening at .hg/server.sock
740 listening at .hg/server.sock
739 abort: unknown command unknowncommand
741 abort: unknown command unknowncommand
740 killed!
742 killed!
741 $ rm .hg/server.log
743 $ rm .hg/server.log
742
744
743 if server crashed before hello, traceback will be sent to 'e' channel as
745 if server crashed before hello, traceback will be sent to 'e' channel as
744 last ditch:
746 last ditch:
745
747
746 $ cat <<EOF >> .hg/hgrc
748 $ cat <<EOF >> .hg/hgrc
747 > [cmdserver]
749 > [cmdserver]
748 > log = inexistent/path.log
750 > log = inexistent/path.log
749 > EOF
751 > EOF
750 >>> from __future__ import print_function
752 >>> from __future__ import print_function
751 >>> from hgclient import unixserver, readchannel, check
753 >>> from hgclient import unixserver, readchannel, check
752 >>> server = unixserver('.hg/server.sock', '.hg/server.log')
754 >>> server = unixserver('.hg/server.sock', '.hg/server.log')
753 >>> def earlycrash(conn):
755 >>> def earlycrash(conn):
754 ... while True:
756 ... while True:
755 ... try:
757 ... try:
756 ... ch, data = readchannel(conn)
758 ... ch, data = readchannel(conn)
757 ... if not data.startswith(' '):
759 ... if not data.startswith(' '):
758 ... print('%c, %r' % (ch, data))
760 ... print('%c, %r' % (ch, data))
759 ... except EOFError:
761 ... except EOFError:
760 ... break
762 ... break
761 >>> check(earlycrash, server.connect)
763 >>> check(earlycrash, server.connect)
762 e, 'Traceback (most recent call last):\n'
764 e, 'Traceback (most recent call last):\n'
763 e, "IOError: *" (glob)
765 e, "IOError: *" (glob)
764 >>> server.shutdown()
766 >>> server.shutdown()
765
767
766 $ cat .hg/server.log | grep -v '^ '
768 $ cat .hg/server.log | grep -v '^ '
767 listening at .hg/server.sock
769 listening at .hg/server.sock
768 Traceback (most recent call last):
770 Traceback (most recent call last):
769 IOError: * (glob)
771 IOError: * (glob)
770 killed!
772 killed!
771 #endif
773 #endif
772 #if no-unix-socket
774 #if no-unix-socket
773
775
774 $ hg serve --cmdserver unix -a .hg/server.sock
776 $ hg serve --cmdserver unix -a .hg/server.sock
775 abort: unsupported platform
777 abort: unsupported platform
776 [255]
778 [255]
777
779
778 #endif
780 #endif
779
781
780 $ cd ..
782 $ cd ..
781
783
782 Test that accessing to invalid changelog cache is avoided at
784 Test that accessing to invalid changelog cache is avoided at
783 subsequent operations even if repo object is reused even after failure
785 subsequent operations even if repo object is reused even after failure
784 of transaction (see 0a7610758c42 also)
786 of transaction (see 0a7610758c42 also)
785
787
786 "hg log" after failure of transaction is needed to detect invalid
788 "hg log" after failure of transaction is needed to detect invalid
787 cache in repoview: this can't detect by "hg verify" only.
789 cache in repoview: this can't detect by "hg verify" only.
788
790
789 Combination of "finalization" and "empty-ness of changelog" (2 x 2 =
791 Combination of "finalization" and "empty-ness of changelog" (2 x 2 =
790 4) are tested, because '00changelog.i' are differently changed in each
792 4) are tested, because '00changelog.i' are differently changed in each
791 cases.
793 cases.
792
794
793 $ cat > $TESTTMP/failafterfinalize.py <<EOF
795 $ cat > $TESTTMP/failafterfinalize.py <<EOF
794 > # extension to abort transaction after finalization forcibly
796 > # extension to abort transaction after finalization forcibly
795 > from mercurial import commands, error, extensions, lock as lockmod
797 > from mercurial import commands, error, extensions, lock as lockmod
796 > def fail(tr):
798 > def fail(tr):
797 > raise error.Abort('fail after finalization')
799 > raise error.Abort('fail after finalization')
798 > def reposetup(ui, repo):
800 > def reposetup(ui, repo):
799 > class failrepo(repo.__class__):
801 > class failrepo(repo.__class__):
800 > def commitctx(self, ctx, error=False):
802 > def commitctx(self, ctx, error=False):
801 > if self.ui.configbool('failafterfinalize', 'fail'):
803 > if self.ui.configbool('failafterfinalize', 'fail'):
802 > # 'sorted()' by ASCII code on category names causes
804 > # 'sorted()' by ASCII code on category names causes
803 > # invoking 'fail' after finalization of changelog
805 > # invoking 'fail' after finalization of changelog
804 > # using "'cl-%i' % id(self)" as category name
806 > # using "'cl-%i' % id(self)" as category name
805 > self.currenttransaction().addfinalize('zzzzzzzz', fail)
807 > self.currenttransaction().addfinalize('zzzzzzzz', fail)
806 > return super(failrepo, self).commitctx(ctx, error)
808 > return super(failrepo, self).commitctx(ctx, error)
807 > repo.__class__ = failrepo
809 > repo.__class__ = failrepo
808 > EOF
810 > EOF
809
811
810 $ hg init repo3
812 $ hg init repo3
811 $ cd repo3
813 $ cd repo3
812
814
813 $ cat <<EOF >> $HGRCPATH
815 $ cat <<EOF >> $HGRCPATH
814 > [ui]
816 > [ui]
815 > logtemplate = {rev} {desc|firstline} ({files})\n
817 > logtemplate = {rev} {desc|firstline} ({files})\n
816 >
818 >
817 > [extensions]
819 > [extensions]
818 > failafterfinalize = $TESTTMP/failafterfinalize.py
820 > failafterfinalize = $TESTTMP/failafterfinalize.py
819 > EOF
821 > EOF
820
822
821 - test failure with "empty changelog"
823 - test failure with "empty changelog"
822
824
823 $ echo foo > foo
825 $ echo foo > foo
824 $ hg add foo
826 $ hg add foo
825
827
826 (failure before finalization)
828 (failure before finalization)
827
829
828 >>> from hgclient import readchannel, runcommand, check
830 >>> from hgclient import readchannel, runcommand, check
829 >>> @check
831 >>> @check
830 ... def abort(server):
832 ... def abort(server):
831 ... readchannel(server)
833 ... readchannel(server)
832 ... runcommand(server, ['commit',
834 ... runcommand(server, ['commit',
833 ... '--config', 'hooks.pretxncommit=false',
835 ... '--config', 'hooks.pretxncommit=false',
834 ... '-mfoo'])
836 ... '-mfoo'])
835 ... runcommand(server, ['log'])
837 ... runcommand(server, ['log'])
836 ... runcommand(server, ['verify', '-q'])
838 ... runcommand(server, ['verify', '-q'])
837 *** runcommand commit --config hooks.pretxncommit=false -mfoo
839 *** runcommand commit --config hooks.pretxncommit=false -mfoo
838 transaction abort!
840 transaction abort!
839 rollback completed
841 rollback completed
840 abort: pretxncommit hook exited with status 1
842 abort: pretxncommit hook exited with status 1
841 [255]
843 [255]
842 *** runcommand log
844 *** runcommand log
843 *** runcommand verify -q
845 *** runcommand verify -q
844
846
845 (failure after finalization)
847 (failure after finalization)
846
848
847 >>> from hgclient import readchannel, runcommand, check
849 >>> from hgclient import readchannel, runcommand, check
848 >>> @check
850 >>> @check
849 ... def abort(server):
851 ... def abort(server):
850 ... readchannel(server)
852 ... readchannel(server)
851 ... runcommand(server, ['commit',
853 ... runcommand(server, ['commit',
852 ... '--config', 'failafterfinalize.fail=true',
854 ... '--config', 'failafterfinalize.fail=true',
853 ... '-mfoo'])
855 ... '-mfoo'])
854 ... runcommand(server, ['log'])
856 ... runcommand(server, ['log'])
855 ... runcommand(server, ['verify', '-q'])
857 ... runcommand(server, ['verify', '-q'])
856 *** runcommand commit --config failafterfinalize.fail=true -mfoo
858 *** runcommand commit --config failafterfinalize.fail=true -mfoo
857 transaction abort!
859 transaction abort!
858 rollback completed
860 rollback completed
859 abort: fail after finalization
861 abort: fail after finalization
860 [255]
862 [255]
861 *** runcommand log
863 *** runcommand log
862 *** runcommand verify -q
864 *** runcommand verify -q
863
865
864 - test failure with "not-empty changelog"
866 - test failure with "not-empty changelog"
865
867
866 $ echo bar > bar
868 $ echo bar > bar
867 $ hg add bar
869 $ hg add bar
868 $ hg commit -mbar bar
870 $ hg commit -mbar bar
869
871
870 (failure before finalization)
872 (failure before finalization)
871
873
872 >>> from hgclient import readchannel, runcommand, check
874 >>> from hgclient import readchannel, runcommand, check
873 >>> @check
875 >>> @check
874 ... def abort(server):
876 ... def abort(server):
875 ... readchannel(server)
877 ... readchannel(server)
876 ... runcommand(server, ['commit',
878 ... runcommand(server, ['commit',
877 ... '--config', 'hooks.pretxncommit=false',
879 ... '--config', 'hooks.pretxncommit=false',
878 ... '-mfoo', 'foo'])
880 ... '-mfoo', 'foo'])
879 ... runcommand(server, ['log'])
881 ... runcommand(server, ['log'])
880 ... runcommand(server, ['verify', '-q'])
882 ... runcommand(server, ['verify', '-q'])
881 *** runcommand commit --config hooks.pretxncommit=false -mfoo foo
883 *** runcommand commit --config hooks.pretxncommit=false -mfoo foo
882 transaction abort!
884 transaction abort!
883 rollback completed
885 rollback completed
884 abort: pretxncommit hook exited with status 1
886 abort: pretxncommit hook exited with status 1
885 [255]
887 [255]
886 *** runcommand log
888 *** runcommand log
887 0 bar (bar)
889 0 bar (bar)
888 *** runcommand verify -q
890 *** runcommand verify -q
889
891
890 (failure after finalization)
892 (failure after finalization)
891
893
892 >>> from hgclient import readchannel, runcommand, check
894 >>> from hgclient import readchannel, runcommand, check
893 >>> @check
895 >>> @check
894 ... def abort(server):
896 ... def abort(server):
895 ... readchannel(server)
897 ... readchannel(server)
896 ... runcommand(server, ['commit',
898 ... runcommand(server, ['commit',
897 ... '--config', 'failafterfinalize.fail=true',
899 ... '--config', 'failafterfinalize.fail=true',
898 ... '-mfoo', 'foo'])
900 ... '-mfoo', 'foo'])
899 ... runcommand(server, ['log'])
901 ... runcommand(server, ['log'])
900 ... runcommand(server, ['verify', '-q'])
902 ... runcommand(server, ['verify', '-q'])
901 *** runcommand commit --config failafterfinalize.fail=true -mfoo foo
903 *** runcommand commit --config failafterfinalize.fail=true -mfoo foo
902 transaction abort!
904 transaction abort!
903 rollback completed
905 rollback completed
904 abort: fail after finalization
906 abort: fail after finalization
905 [255]
907 [255]
906 *** runcommand log
908 *** runcommand log
907 0 bar (bar)
909 0 bar (bar)
908 *** runcommand verify -q
910 *** runcommand verify -q
@@ -1,419 +1,427 b''
1 Init repo1:
1 Init repo1:
2
2
3 $ hg init repo1
3 $ hg init repo1
4 $ cd repo1
4 $ cd repo1
5 $ echo "some text" > a
5 $ echo "some text" > a
6 $ hg add
6 $ hg add
7 adding a
7 adding a
8 $ hg ci -m first
8 $ hg ci -m first
9 $ cat .hg/store/fncache | sort
9 $ cat .hg/store/fncache | sort
10 data/a.i
10 data/a.i
11
11
12 Testing a.i/b:
12 Testing a.i/b:
13
13
14 $ mkdir a.i
14 $ mkdir a.i
15 $ echo "some other text" > a.i/b
15 $ echo "some other text" > a.i/b
16 $ hg add
16 $ hg add
17 adding a.i/b (glob)
17 adding a.i/b (glob)
18 $ hg ci -m second
18 $ hg ci -m second
19 $ cat .hg/store/fncache | sort
19 $ cat .hg/store/fncache | sort
20 data/a.i
20 data/a.i
21 data/a.i.hg/b.i
21 data/a.i.hg/b.i
22
22
23 Testing a.i.hg/c:
23 Testing a.i.hg/c:
24
24
25 $ mkdir a.i.hg
25 $ mkdir a.i.hg
26 $ echo "yet another text" > a.i.hg/c
26 $ echo "yet another text" > a.i.hg/c
27 $ hg add
27 $ hg add
28 adding a.i.hg/c (glob)
28 adding a.i.hg/c (glob)
29 $ hg ci -m third
29 $ hg ci -m third
30 $ cat .hg/store/fncache | sort
30 $ cat .hg/store/fncache | sort
31 data/a.i
31 data/a.i
32 data/a.i.hg.hg/c.i
32 data/a.i.hg.hg/c.i
33 data/a.i.hg/b.i
33 data/a.i.hg/b.i
34
34
35 Testing verify:
35 Testing verify:
36
36
37 $ hg verify
37 $ hg verify
38 checking changesets
38 checking changesets
39 checking manifests
39 checking manifests
40 crosschecking files in changesets and manifests
40 crosschecking files in changesets and manifests
41 checking files
41 checking files
42 3 files, 3 changesets, 3 total revisions
42 3 files, 3 changesets, 3 total revisions
43
43
44 $ rm .hg/store/fncache
44 $ rm .hg/store/fncache
45
45
46 $ hg verify
46 $ hg verify
47 checking changesets
47 checking changesets
48 checking manifests
48 checking manifests
49 crosschecking files in changesets and manifests
49 crosschecking files in changesets and manifests
50 checking files
50 checking files
51 warning: revlog 'data/a.i' not in fncache!
51 warning: revlog 'data/a.i' not in fncache!
52 warning: revlog 'data/a.i.hg/c.i' not in fncache!
52 warning: revlog 'data/a.i.hg/c.i' not in fncache!
53 warning: revlog 'data/a.i/b.i' not in fncache!
53 warning: revlog 'data/a.i/b.i' not in fncache!
54 3 files, 3 changesets, 3 total revisions
54 3 files, 3 changesets, 3 total revisions
55 3 warnings encountered!
55 3 warnings encountered!
56 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
56 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
57
57
58 Follow the hint to make sure it works
58 Follow the hint to make sure it works
59
59
60 $ hg debugrebuildfncache
60 $ hg debugrebuildfncache
61 adding data/a.i
61 adding data/a.i
62 adding data/a.i.hg/c.i
62 adding data/a.i.hg/c.i
63 adding data/a.i/b.i
63 adding data/a.i/b.i
64 3 items added, 0 removed from fncache
64 3 items added, 0 removed from fncache
65
65
66 $ hg verify
66 $ hg verify
67 checking changesets
67 checking changesets
68 checking manifests
68 checking manifests
69 crosschecking files in changesets and manifests
69 crosschecking files in changesets and manifests
70 checking files
70 checking files
71 3 files, 3 changesets, 3 total revisions
71 3 files, 3 changesets, 3 total revisions
72
72
73 $ cd ..
73 $ cd ..
74
74
75 Non store repo:
75 Non store repo:
76
76
77 $ hg --config format.usestore=False init foo
77 $ hg --config format.usestore=False init foo
78 $ cd foo
78 $ cd foo
79 $ mkdir tst.d
79 $ mkdir tst.d
80 $ echo foo > tst.d/foo
80 $ echo foo > tst.d/foo
81 $ hg ci -Amfoo
81 $ hg ci -Amfoo
82 adding tst.d/foo
82 adding tst.d/foo
83 $ find .hg | sort
83 $ find .hg | sort
84 .hg
84 .hg
85 .hg/00changelog.i
85 .hg/00changelog.i
86 .hg/00manifest.i
86 .hg/00manifest.i
87 .hg/cache
87 .hg/cache
88 .hg/cache/branch2-served
88 .hg/cache/branch2-served
89 .hg/cache/rbc-names-v1
89 .hg/cache/rbc-names-v1
90 .hg/cache/rbc-revs-v1
90 .hg/cache/rbc-revs-v1
91 .hg/data
91 .hg/data
92 .hg/data/tst.d.hg
92 .hg/data/tst.d.hg
93 .hg/data/tst.d.hg/foo.i
93 .hg/data/tst.d.hg/foo.i
94 .hg/dirstate
94 .hg/dirstate
95 .hg/fsmonitor.state (fsmonitor !)
95 .hg/fsmonitor.state (fsmonitor !)
96 .hg/last-message.txt
96 .hg/last-message.txt
97 .hg/phaseroots
97 .hg/phaseroots
98 .hg/requires
98 .hg/requires
99 .hg/undo
99 .hg/undo
100 .hg/undo.backup.dirstate
100 .hg/undo.backup.dirstate
101 .hg/undo.backupfiles
101 .hg/undo.backupfiles
102 .hg/undo.bookmarks
102 .hg/undo.bookmarks
103 .hg/undo.branch
103 .hg/undo.branch
104 .hg/undo.desc
104 .hg/undo.desc
105 .hg/undo.dirstate
105 .hg/undo.dirstate
106 .hg/undo.phaseroots
106 .hg/undo.phaseroots
107 $ cd ..
107 $ cd ..
108
108
109 Non fncache repo:
109 Non fncache repo:
110
110
111 $ hg --config format.usefncache=False init bar
111 $ hg --config format.usefncache=False init bar
112 $ cd bar
112 $ cd bar
113 $ mkdir tst.d
113 $ mkdir tst.d
114 $ echo foo > tst.d/Foo
114 $ echo foo > tst.d/Foo
115 $ hg ci -Amfoo
115 $ hg ci -Amfoo
116 adding tst.d/Foo
116 adding tst.d/Foo
117 $ find .hg | sort
117 $ find .hg | sort
118 .hg
118 .hg
119 .hg/00changelog.i
119 .hg/00changelog.i
120 .hg/cache
120 .hg/cache
121 .hg/cache/branch2-served
121 .hg/cache/branch2-served
122 .hg/cache/rbc-names-v1
122 .hg/cache/rbc-names-v1
123 .hg/cache/rbc-revs-v1
123 .hg/cache/rbc-revs-v1
124 .hg/dirstate
124 .hg/dirstate
125 .hg/fsmonitor.state (fsmonitor !)
125 .hg/fsmonitor.state (fsmonitor !)
126 .hg/last-message.txt
126 .hg/last-message.txt
127 .hg/requires
127 .hg/requires
128 .hg/store
128 .hg/store
129 .hg/store/00changelog.i
129 .hg/store/00changelog.i
130 .hg/store/00manifest.i
130 .hg/store/00manifest.i
131 .hg/store/data
131 .hg/store/data
132 .hg/store/data/tst.d.hg
132 .hg/store/data/tst.d.hg
133 .hg/store/data/tst.d.hg/_foo.i
133 .hg/store/data/tst.d.hg/_foo.i
134 .hg/store/phaseroots
134 .hg/store/phaseroots
135 .hg/store/undo
135 .hg/store/undo
136 .hg/store/undo.backupfiles
136 .hg/store/undo.backupfiles
137 .hg/store/undo.phaseroots
137 .hg/store/undo.phaseroots
138 .hg/undo.backup.dirstate
138 .hg/undo.backup.dirstate
139 .hg/undo.bookmarks
139 .hg/undo.bookmarks
140 .hg/undo.branch
140 .hg/undo.branch
141 .hg/undo.desc
141 .hg/undo.desc
142 .hg/undo.dirstate
142 .hg/undo.dirstate
143 $ cd ..
143 $ cd ..
144
144
145 Encoding of reserved / long paths in the store
145 Encoding of reserved / long paths in the store
146
146
147 $ hg init r2
147 $ hg init r2
148 $ cd r2
148 $ cd r2
149 $ cat <<EOF > .hg/hgrc
149 $ cat <<EOF > .hg/hgrc
150 > [ui]
150 > [ui]
151 > portablefilenames = ignore
151 > portablefilenames = ignore
152 > EOF
152 > EOF
153
153
154 $ hg import -q --bypass - <<EOF
154 $ hg import -q --bypass - <<EOF
155 > # HG changeset patch
155 > # HG changeset patch
156 > # User test
156 > # User test
157 > # Date 0 0
157 > # Date 0 0
158 > # Node ID 1c7a2f7cb77be1a0def34e4c7cabc562ad98fbd7
158 > # Node ID 1c7a2f7cb77be1a0def34e4c7cabc562ad98fbd7
159 > # Parent 0000000000000000000000000000000000000000
159 > # Parent 0000000000000000000000000000000000000000
160 > 1
160 > 1
161 >
161 >
162 > diff --git a/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3456789-12345-ABCDEFGHIJKLMNOPRSTUVWXYZ-abcdefghjiklmnopqrstuvwxyz b/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3456789-12345-ABCDEFGHIJKLMNOPRSTUVWXYZ-abcdefghjiklmnopqrstuvwxyz
162 > diff --git a/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3456789-12345-ABCDEFGHIJKLMNOPRSTUVWXYZ-abcdefghjiklmnopqrstuvwxyz b/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3456789-12345-ABCDEFGHIJKLMNOPRSTUVWXYZ-abcdefghjiklmnopqrstuvwxyz
163 > new file mode 100644
163 > new file mode 100644
164 > --- /dev/null
164 > --- /dev/null
165 > +++ b/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3456789-12345-ABCDEFGHIJKLMNOPRSTUVWXYZ-abcdefghjiklmnopqrstuvwxyz
165 > +++ b/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3456789-12345-ABCDEFGHIJKLMNOPRSTUVWXYZ-abcdefghjiklmnopqrstuvwxyz
166 > @@ -0,0 +1,1 @@
166 > @@ -0,0 +1,1 @@
167 > +foo
167 > +foo
168 > diff --git a/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH/LOREMIPSUM.TXT b/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH/LOREMIPSUM.TXT
168 > diff --git a/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH/LOREMIPSUM.TXT b/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH/LOREMIPSUM.TXT
169 > new file mode 100644
169 > new file mode 100644
170 > --- /dev/null
170 > --- /dev/null
171 > +++ b/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH/LOREMIPSUM.TXT
171 > +++ b/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH/LOREMIPSUM.TXT
172 > @@ -0,0 +1,1 @@
172 > @@ -0,0 +1,1 @@
173 > +foo
173 > +foo
174 > diff --git a/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt b/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt
174 > diff --git a/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt b/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt
175 > new file mode 100644
175 > new file mode 100644
176 > --- /dev/null
176 > --- /dev/null
177 > +++ b/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt
177 > +++ b/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt
178 > @@ -0,0 +1,1 @@
178 > @@ -0,0 +1,1 @@
179 > +foo
179 > +foo
180 > diff --git a/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c b/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c
180 > diff --git a/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c b/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c
181 > new file mode 100644
181 > new file mode 100644
182 > --- /dev/null
182 > --- /dev/null
183 > +++ b/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c
183 > +++ b/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c
184 > @@ -0,0 +1,1 @@
184 > @@ -0,0 +1,1 @@
185 > +foo
185 > +foo
186 > diff --git a/enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/wsdlExtension/src/main/java/META-INF/services/org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider b/enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/wsdlExtension/src/main/java/META-INF/services/org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider
186 > diff --git a/enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/wsdlExtension/src/main/java/META-INF/services/org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider b/enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/wsdlExtension/src/main/java/META-INF/services/org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider
187 > new file mode 100644
187 > new file mode 100644
188 > --- /dev/null
188 > --- /dev/null
189 > +++ b/enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/wsdlExtension/src/main/java/META-INF/services/org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider
189 > +++ b/enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/wsdlExtension/src/main/java/META-INF/services/org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider
190 > @@ -0,0 +1,1 @@
190 > @@ -0,0 +1,1 @@
191 > +foo
191 > +foo
192 > EOF
192 > EOF
193
193
194 $ find .hg/store -name *.i | sort
194 $ find .hg/store -name *.i | sort
195 .hg/store/00changelog.i
195 .hg/store/00changelog.i
196 .hg/store/00manifest.i
196 .hg/store/00manifest.i
197 .hg/store/data/bla.aux/pr~6e/_p_r_n/lpt/co~6d3/nu~6c/coma/foo._n_u_l/normal.c.i
197 .hg/store/data/bla.aux/pr~6e/_p_r_n/lpt/co~6d3/nu~6c/coma/foo._n_u_l/normal.c.i
198 .hg/store/dh/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxx168e07b38e65eff86ab579afaaa8e30bfbe0f35f.i
198 .hg/store/dh/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxx168e07b38e65eff86ab579afaaa8e30bfbe0f35f.i
199 .hg/store/dh/au~78/second/x.prn/fourth/fi~3afth/sixth/seventh/eighth/nineth/tenth/loremia20419e358ddff1bf8751e38288aff1d7c32ec05.i
199 .hg/store/dh/au~78/second/x.prn/fourth/fi~3afth/sixth/seventh/eighth/nineth/tenth/loremia20419e358ddff1bf8751e38288aff1d7c32ec05.i
200 .hg/store/dh/enterpri/openesba/contrib-/corba-bc/netbeans/wsdlexte/src/main/java/org.net7018f27961fdf338a598a40c4683429e7ffb9743.i
200 .hg/store/dh/enterpri/openesba/contrib-/corba-bc/netbeans/wsdlexte/src/main/java/org.net7018f27961fdf338a598a40c4683429e7ffb9743.i
201 .hg/store/dh/project_/resource/anotherl/followed/andanoth/andthenanextremelylongfilename0d8e1f4187c650e2f1fdca9fd90f786bc0976b6b.i
201 .hg/store/dh/project_/resource/anotherl/followed/andanoth/andthenanextremelylongfilename0d8e1f4187c650e2f1fdca9fd90f786bc0976b6b.i
202
202
203 $ cd ..
203 $ cd ..
204
204
205 Aborting lock does not prevent fncache writes
205 Aborting lock does not prevent fncache writes
206
206
207 $ cat > exceptionext.py <<EOF
207 $ cat > exceptionext.py <<EOF
208 > import os
208 > import os
209 > from mercurial import commands, error
209 > from mercurial import commands, error
210 > from mercurial.extensions import wrapcommand, wrapfunction
210 > from mercurial.extensions import wrapcommand, wrapfunction
211 >
211 >
212 > def lockexception(orig, vfs, lockname, wait, releasefn, *args, **kwargs):
212 > def lockexception(orig, vfs, lockname, wait, releasefn, *args, **kwargs):
213 > def releasewrap():
213 > def releasewrap():
214 > l.held = False # ensure __del__ is a noop
214 > l.held = False # ensure __del__ is a noop
215 > raise error.Abort("forced lock failure")
215 > raise error.Abort("forced lock failure")
216 > l = orig(vfs, lockname, wait, releasewrap, *args, **kwargs)
216 > l = orig(vfs, lockname, wait, releasewrap, *args, **kwargs)
217 > return l
217 > return l
218 >
218 >
219 > def reposetup(ui, repo):
219 > def reposetup(ui, repo):
220 > wrapfunction(repo, '_lock', lockexception)
220 > wrapfunction(repo, '_lock', lockexception)
221 >
221 >
222 > cmdtable = {}
222 > cmdtable = {}
223 >
223 >
224 > # wrap "commit" command to prevent wlock from being '__del__()'-ed
224 > # wrap "commit" command to prevent wlock from being '__del__()'-ed
225 > # at the end of dispatching (for intentional "forced lcok failure")
225 > # at the end of dispatching (for intentional "forced lcok failure")
226 > def commitwrap(orig, ui, repo, *pats, **opts):
226 > def commitwrap(orig, ui, repo, *pats, **opts):
227 > repo = repo.unfiltered() # to use replaced repo._lock certainly
227 > repo = repo.unfiltered() # to use replaced repo._lock certainly
228 > wlock = repo.wlock()
228 > wlock = repo.wlock()
229 > try:
229 > try:
230 > return orig(ui, repo, *pats, **opts)
230 > return orig(ui, repo, *pats, **opts)
231 > finally:
231 > finally:
232 > # multiple 'relase()' is needed for complete releasing wlock,
232 > # multiple 'relase()' is needed for complete releasing wlock,
233 > # because "forced" abort at last releasing store lock
233 > # because "forced" abort at last releasing store lock
234 > # prevents wlock from being released at same 'lockmod.release()'
234 > # prevents wlock from being released at same 'lockmod.release()'
235 > for i in range(wlock.held):
235 > for i in range(wlock.held):
236 > wlock.release()
236 > wlock.release()
237 >
237 >
238 > def extsetup(ui):
238 > def extsetup(ui):
239 > wrapcommand(commands.table, "commit", commitwrap)
239 > wrapcommand(commands.table, "commit", commitwrap)
240 > EOF
240 > EOF
241 $ extpath=`pwd`/exceptionext.py
241 $ extpath=`pwd`/exceptionext.py
242 $ hg init fncachetxn
242 $ hg init fncachetxn
243 $ cd fncachetxn
243 $ cd fncachetxn
244 $ printf "[extensions]\nexceptionext=$extpath\n" >> .hg/hgrc
244 $ printf "[extensions]\nexceptionext=$extpath\n" >> .hg/hgrc
245 $ touch y
245 $ touch y
246 $ hg ci -qAm y
246 $ hg ci -qAm y
247 abort: forced lock failure
247 abort: forced lock failure
248 [255]
248 [255]
249 $ cat .hg/store/fncache
249 $ cat .hg/store/fncache
250 data/y.i
250 data/y.i
251
251
252 Aborting transaction prevents fncache change
252 Aborting transaction prevents fncache change
253
253
254 $ cat > ../exceptionext.py <<EOF
254 $ cat > ../exceptionext.py <<EOF
255 > import os
255 > import os
256 > from mercurial import commands, error, localrepo
256 > from mercurial import commands, error, localrepo
257 > from mercurial.extensions import wrapfunction
257 > from mercurial.extensions import wrapfunction
258 >
258 >
259 > def wrapper(orig, self, *args, **kwargs):
259 > def wrapper(orig, self, *args, **kwargs):
260 > tr = orig(self, *args, **kwargs)
260 > tr = orig(self, *args, **kwargs)
261 > def fail(tr):
261 > def fail(tr):
262 > raise error.Abort("forced transaction failure")
262 > raise error.Abort("forced transaction failure")
263 > # zzz prefix to ensure it sorted after store.write
263 > # zzz prefix to ensure it sorted after store.write
264 > tr.addfinalize('zzz-forcefails', fail)
264 > tr.addfinalize('zzz-forcefails', fail)
265 > return tr
265 > return tr
266 >
266 >
267 > def uisetup(ui):
267 > def uisetup(ui):
268 > wrapfunction(localrepo.localrepository, 'transaction', wrapper)
268 > wrapfunction(localrepo.localrepository, 'transaction', wrapper)
269 >
269 >
270 > cmdtable = {}
270 > cmdtable = {}
271 >
271 >
272 > EOF
272 > EOF
273
274 Clean cached version
273 $ rm -f "${extpath}c"
275 $ rm -f "${extpath}c"
276 $ rm -Rf "`dirname $extpath`/__pycache__"
277
274 $ touch z
278 $ touch z
275 $ hg ci -qAm z
279 $ hg ci -qAm z
276 transaction abort!
280 transaction abort!
277 rollback completed
281 rollback completed
278 abort: forced transaction failure
282 abort: forced transaction failure
279 [255]
283 [255]
280 $ cat .hg/store/fncache
284 $ cat .hg/store/fncache
281 data/y.i
285 data/y.i
282
286
283 Aborted transactions can be recovered later
287 Aborted transactions can be recovered later
284
288
285 $ cat > ../exceptionext.py <<EOF
289 $ cat > ../exceptionext.py <<EOF
286 > import os
290 > import os
287 > from mercurial import commands, error, transaction, localrepo
291 > from mercurial import commands, error, transaction, localrepo
288 > from mercurial.extensions import wrapfunction
292 > from mercurial.extensions import wrapfunction
289 >
293 >
290 > def trwrapper(orig, self, *args, **kwargs):
294 > def trwrapper(orig, self, *args, **kwargs):
291 > tr = orig(self, *args, **kwargs)
295 > tr = orig(self, *args, **kwargs)
292 > def fail(tr):
296 > def fail(tr):
293 > raise error.Abort("forced transaction failure")
297 > raise error.Abort("forced transaction failure")
294 > # zzz prefix to ensure it sorted after store.write
298 > # zzz prefix to ensure it sorted after store.write
295 > tr.addfinalize('zzz-forcefails', fail)
299 > tr.addfinalize('zzz-forcefails', fail)
296 > return tr
300 > return tr
297 >
301 >
298 > def abortwrapper(orig, self, *args, **kwargs):
302 > def abortwrapper(orig, self, *args, **kwargs):
299 > raise error.Abort("forced transaction failure")
303 > raise error.Abort("forced transaction failure")
300 >
304 >
301 > def uisetup(ui):
305 > def uisetup(ui):
302 > wrapfunction(localrepo.localrepository, 'transaction', trwrapper)
306 > wrapfunction(localrepo.localrepository, 'transaction', trwrapper)
303 > wrapfunction(transaction.transaction, '_abort', abortwrapper)
307 > wrapfunction(transaction.transaction, '_abort', abortwrapper)
304 >
308 >
305 > cmdtable = {}
309 > cmdtable = {}
306 >
310 >
307 > EOF
311 > EOF
312
313 Clean cached versions
308 $ rm -f "${extpath}c"
314 $ rm -f "${extpath}c"
315 $ rm -Rf "`dirname $extpath`/__pycache__"
316
309 $ hg up -q 1
317 $ hg up -q 1
310 $ touch z
318 $ touch z
311 $ hg ci -qAm z 2>/dev/null
319 $ hg ci -qAm z 2>/dev/null
312 [255]
320 [255]
313 $ cat .hg/store/fncache | sort
321 $ cat .hg/store/fncache | sort
314 data/y.i
322 data/y.i
315 data/z.i
323 data/z.i
316 $ hg recover
324 $ hg recover
317 rolling back interrupted transaction
325 rolling back interrupted transaction
318 checking changesets
326 checking changesets
319 checking manifests
327 checking manifests
320 crosschecking files in changesets and manifests
328 crosschecking files in changesets and manifests
321 checking files
329 checking files
322 1 files, 1 changesets, 1 total revisions
330 1 files, 1 changesets, 1 total revisions
323 $ cat .hg/store/fncache
331 $ cat .hg/store/fncache
324 data/y.i
332 data/y.i
325
333
326 $ cd ..
334 $ cd ..
327
335
328 debugrebuildfncache does nothing unless repo has fncache requirement
336 debugrebuildfncache does nothing unless repo has fncache requirement
329
337
330 $ hg --config format.usefncache=false init nofncache
338 $ hg --config format.usefncache=false init nofncache
331 $ cd nofncache
339 $ cd nofncache
332 $ hg debugrebuildfncache
340 $ hg debugrebuildfncache
333 (not rebuilding fncache because repository does not support fncache)
341 (not rebuilding fncache because repository does not support fncache)
334
342
335 $ cd ..
343 $ cd ..
336
344
337 debugrebuildfncache works on empty repository
345 debugrebuildfncache works on empty repository
338
346
339 $ hg init empty
347 $ hg init empty
340 $ cd empty
348 $ cd empty
341 $ hg debugrebuildfncache
349 $ hg debugrebuildfncache
342 fncache already up to date
350 fncache already up to date
343 $ cd ..
351 $ cd ..
344
352
345 debugrebuildfncache on an up to date repository no-ops
353 debugrebuildfncache on an up to date repository no-ops
346
354
347 $ hg init repo
355 $ hg init repo
348 $ cd repo
356 $ cd repo
349 $ echo initial > foo
357 $ echo initial > foo
350 $ echo initial > .bar
358 $ echo initial > .bar
351 $ hg commit -A -m initial
359 $ hg commit -A -m initial
352 adding .bar
360 adding .bar
353 adding foo
361 adding foo
354
362
355 $ cat .hg/store/fncache | sort
363 $ cat .hg/store/fncache | sort
356 data/.bar.i
364 data/.bar.i
357 data/foo.i
365 data/foo.i
358
366
359 $ hg debugrebuildfncache
367 $ hg debugrebuildfncache
360 fncache already up to date
368 fncache already up to date
361
369
362 debugrebuildfncache restores deleted fncache file
370 debugrebuildfncache restores deleted fncache file
363
371
364 $ rm -f .hg/store/fncache
372 $ rm -f .hg/store/fncache
365 $ hg debugrebuildfncache
373 $ hg debugrebuildfncache
366 adding data/.bar.i
374 adding data/.bar.i
367 adding data/foo.i
375 adding data/foo.i
368 2 items added, 0 removed from fncache
376 2 items added, 0 removed from fncache
369
377
370 $ cat .hg/store/fncache | sort
378 $ cat .hg/store/fncache | sort
371 data/.bar.i
379 data/.bar.i
372 data/foo.i
380 data/foo.i
373
381
374 Rebuild after rebuild should no-op
382 Rebuild after rebuild should no-op
375
383
376 $ hg debugrebuildfncache
384 $ hg debugrebuildfncache
377 fncache already up to date
385 fncache already up to date
378
386
379 A single missing file should get restored, an extra file should be removed
387 A single missing file should get restored, an extra file should be removed
380
388
381 $ cat > .hg/store/fncache << EOF
389 $ cat > .hg/store/fncache << EOF
382 > data/foo.i
390 > data/foo.i
383 > data/bad-entry.i
391 > data/bad-entry.i
384 > EOF
392 > EOF
385
393
386 $ hg debugrebuildfncache
394 $ hg debugrebuildfncache
387 removing data/bad-entry.i
395 removing data/bad-entry.i
388 adding data/.bar.i
396 adding data/.bar.i
389 1 items added, 1 removed from fncache
397 1 items added, 1 removed from fncache
390
398
391 $ cat .hg/store/fncache | sort
399 $ cat .hg/store/fncache | sort
392 data/.bar.i
400 data/.bar.i
393 data/foo.i
401 data/foo.i
394
402
395 $ cd ..
403 $ cd ..
396
404
397 Try a simple variation without dotencode to ensure fncache is ignorant of encoding
405 Try a simple variation without dotencode to ensure fncache is ignorant of encoding
398
406
399 $ hg --config format.dotencode=false init nodotencode
407 $ hg --config format.dotencode=false init nodotencode
400 $ cd nodotencode
408 $ cd nodotencode
401 $ echo initial > foo
409 $ echo initial > foo
402 $ echo initial > .bar
410 $ echo initial > .bar
403 $ hg commit -A -m initial
411 $ hg commit -A -m initial
404 adding .bar
412 adding .bar
405 adding foo
413 adding foo
406
414
407 $ cat .hg/store/fncache | sort
415 $ cat .hg/store/fncache | sort
408 data/.bar.i
416 data/.bar.i
409 data/foo.i
417 data/foo.i
410
418
411 $ rm .hg/store/fncache
419 $ rm .hg/store/fncache
412 $ hg debugrebuildfncache
420 $ hg debugrebuildfncache
413 adding data/.bar.i
421 adding data/.bar.i
414 adding data/foo.i
422 adding data/foo.i
415 2 items added, 0 removed from fncache
423 2 items added, 0 removed from fncache
416
424
417 $ cat .hg/store/fncache | sort
425 $ cat .hg/store/fncache | sort
418 data/.bar.i
426 data/.bar.i
419 data/foo.i
427 data/foo.i
General Comments 0
You need to be logged in to leave comments. Login now