Show More
@@ -1,1004 +1,1012 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 absolute_import, print_function |
|
16 | >>> from __future__ import absolute_import, print_function | |
17 | >>> import os |
|
17 | >>> import os | |
18 | >>> import sys |
|
18 | >>> import sys | |
19 | >>> from hgclient import check, readchannel, runcommand |
|
19 | >>> from hgclient import check, readchannel, runcommand | |
20 | >>> @check |
|
20 | >>> @check | |
21 | ... def hellomessage(server): |
|
21 | ... def hellomessage(server): | |
22 | ... ch, data = readchannel(server) |
|
22 | ... ch, data = readchannel(server) | |
23 | ... print('%c, %r' % (ch, data)) |
|
23 | ... print('%c, %r' % (ch, data)) | |
24 | ... # run an arbitrary command to make sure the next thing the server |
|
24 | ... # run an arbitrary command to make sure the next thing the server | |
25 | ... # sends isn't part of the hello message |
|
25 | ... # sends isn't part of the hello message | |
26 | ... runcommand(server, ['id']) |
|
26 | ... runcommand(server, ['id']) | |
27 | o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob) |
|
27 | o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob) | |
28 | *** runcommand id |
|
28 | *** runcommand id | |
29 | 000000000000 tip |
|
29 | 000000000000 tip | |
30 |
|
30 | |||
31 | >>> from hgclient import check |
|
31 | >>> from hgclient import check | |
32 | >>> @check |
|
32 | >>> @check | |
33 | ... def unknowncommand(server): |
|
33 | ... def unknowncommand(server): | |
34 | ... server.stdin.write('unknowncommand\n') |
|
34 | ... server.stdin.write('unknowncommand\n') | |
35 | abort: unknown command unknowncommand |
|
35 | abort: unknown command unknowncommand | |
36 |
|
36 | |||
37 | >>> from hgclient import check, readchannel, runcommand |
|
37 | >>> from hgclient import check, readchannel, runcommand | |
38 | >>> @check |
|
38 | >>> @check | |
39 | ... def checkruncommand(server): |
|
39 | ... def checkruncommand(server): | |
40 | ... # hello block |
|
40 | ... # hello block | |
41 | ... readchannel(server) |
|
41 | ... readchannel(server) | |
42 | ... |
|
42 | ... | |
43 | ... # no args |
|
43 | ... # no args | |
44 | ... runcommand(server, []) |
|
44 | ... runcommand(server, []) | |
45 | ... |
|
45 | ... | |
46 | ... # global options |
|
46 | ... # global options | |
47 | ... runcommand(server, ['id', '--quiet']) |
|
47 | ... runcommand(server, ['id', '--quiet']) | |
48 | ... |
|
48 | ... | |
49 | ... # make sure global options don't stick through requests |
|
49 | ... # make sure global options don't stick through requests | |
50 | ... runcommand(server, ['id']) |
|
50 | ... runcommand(server, ['id']) | |
51 | ... |
|
51 | ... | |
52 | ... # --config |
|
52 | ... # --config | |
53 | ... runcommand(server, ['id', '--config', 'ui.quiet=True']) |
|
53 | ... runcommand(server, ['id', '--config', 'ui.quiet=True']) | |
54 | ... |
|
54 | ... | |
55 | ... # make sure --config doesn't stick |
|
55 | ... # make sure --config doesn't stick | |
56 | ... runcommand(server, ['id']) |
|
56 | ... runcommand(server, ['id']) | |
57 | ... |
|
57 | ... | |
58 | ... # negative return code should be masked |
|
58 | ... # negative return code should be masked | |
59 | ... runcommand(server, ['id', '-runknown']) |
|
59 | ... runcommand(server, ['id', '-runknown']) | |
60 | *** runcommand |
|
60 | *** runcommand | |
61 | Mercurial Distributed SCM |
|
61 | Mercurial Distributed SCM | |
62 |
|
62 | |||
63 | basic commands: |
|
63 | basic commands: | |
64 |
|
64 | |||
65 | add add the specified files on the next commit |
|
65 | add add the specified files on the next commit | |
66 | annotate show changeset information by line for each file |
|
66 | annotate show changeset information by line for each file | |
67 | clone make a copy of an existing repository |
|
67 | clone make a copy of an existing repository | |
68 | commit commit the specified files or all outstanding changes |
|
68 | commit commit the specified files or all outstanding changes | |
69 | diff diff repository (or selected files) |
|
69 | diff diff repository (or selected files) | |
70 | export dump the header and diffs for one or more changesets |
|
70 | export dump the header and diffs for one or more changesets | |
71 | forget forget the specified files on the next commit |
|
71 | forget forget the specified files on the next commit | |
72 | init create a new repository in the given directory |
|
72 | init create a new repository in the given directory | |
73 | log show revision history of entire repository or files |
|
73 | log show revision history of entire repository or files | |
74 | merge merge another revision into working directory |
|
74 | merge merge another revision into working directory | |
75 | pull pull changes from the specified source |
|
75 | pull pull changes from the specified source | |
76 | push push changes to the specified destination |
|
76 | push push changes to the specified destination | |
77 | remove remove the specified files on the next commit |
|
77 | remove remove the specified files on the next commit | |
78 | serve start stand-alone webserver |
|
78 | serve start stand-alone webserver | |
79 | status show changed files in the working directory |
|
79 | status show changed files in the working directory | |
80 | summary summarize working directory state |
|
80 | summary summarize working directory state | |
81 | update update working directory (or switch revisions) |
|
81 | update update working directory (or switch revisions) | |
82 |
|
82 | |||
83 | (use 'hg help' for the full list of commands or 'hg -v' for details) |
|
83 | (use 'hg help' for the full list of commands or 'hg -v' for details) | |
84 | *** runcommand id --quiet |
|
84 | *** runcommand id --quiet | |
85 | 000000000000 |
|
85 | 000000000000 | |
86 | *** runcommand id |
|
86 | *** runcommand id | |
87 | 000000000000 tip |
|
87 | 000000000000 tip | |
88 | *** runcommand id --config ui.quiet=True |
|
88 | *** runcommand id --config ui.quiet=True | |
89 | 000000000000 |
|
89 | 000000000000 | |
90 | *** runcommand id |
|
90 | *** runcommand id | |
91 | 000000000000 tip |
|
91 | 000000000000 tip | |
92 | *** runcommand id -runknown |
|
92 | *** runcommand id -runknown | |
93 | abort: unknown revision 'unknown'! |
|
93 | abort: unknown revision 'unknown'! | |
94 | [255] |
|
94 | [255] | |
95 |
|
95 | |||
96 | >>> from hgclient import check, readchannel |
|
96 | >>> from hgclient import check, readchannel | |
97 | >>> @check |
|
97 | >>> @check | |
98 | ... def inputeof(server): |
|
98 | ... def inputeof(server): | |
99 | ... readchannel(server) |
|
99 | ... readchannel(server) | |
100 | ... server.stdin.write('runcommand\n') |
|
100 | ... server.stdin.write('runcommand\n') | |
101 | ... # close stdin while server is waiting for input |
|
101 | ... # close stdin while server is waiting for input | |
102 | ... server.stdin.close() |
|
102 | ... server.stdin.close() | |
103 | ... |
|
103 | ... | |
104 | ... # server exits with 1 if the pipe closed while reading the command |
|
104 | ... # server exits with 1 if the pipe closed while reading the command | |
105 | ... print('server exit code =', server.wait()) |
|
105 | ... print('server exit code =', server.wait()) | |
106 | server exit code = 1 |
|
106 | server exit code = 1 | |
107 |
|
107 | |||
108 | >>> from hgclient import check, readchannel, runcommand, stringio |
|
108 | >>> from hgclient import check, readchannel, runcommand, stringio | |
109 | >>> @check |
|
109 | >>> @check | |
110 | ... def serverinput(server): |
|
110 | ... def serverinput(server): | |
111 | ... readchannel(server) |
|
111 | ... readchannel(server) | |
112 | ... |
|
112 | ... | |
113 | ... patch = """ |
|
113 | ... patch = """ | |
114 | ... # HG changeset patch |
|
114 | ... # HG changeset patch | |
115 | ... # User test |
|
115 | ... # User test | |
116 | ... # Date 0 0 |
|
116 | ... # Date 0 0 | |
117 | ... # Node ID c103a3dec114d882c98382d684d8af798d09d857 |
|
117 | ... # Node ID c103a3dec114d882c98382d684d8af798d09d857 | |
118 | ... # Parent 0000000000000000000000000000000000000000 |
|
118 | ... # Parent 0000000000000000000000000000000000000000 | |
119 | ... 1 |
|
119 | ... 1 | |
120 | ... |
|
120 | ... | |
121 | ... diff -r 000000000000 -r c103a3dec114 a |
|
121 | ... diff -r 000000000000 -r c103a3dec114 a | |
122 | ... --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
122 | ... --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
123 | ... +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
123 | ... +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
124 | ... @@ -0,0 +1,1 @@ |
|
124 | ... @@ -0,0 +1,1 @@ | |
125 | ... +1 |
|
125 | ... +1 | |
126 | ... """ |
|
126 | ... """ | |
127 | ... |
|
127 | ... | |
128 | ... runcommand(server, ['import', '-'], input=stringio(patch)) |
|
128 | ... runcommand(server, ['import', '-'], input=stringio(patch)) | |
129 | ... runcommand(server, ['log']) |
|
129 | ... runcommand(server, ['log']) | |
130 | *** runcommand import - |
|
130 | *** runcommand import - | |
131 | applying patch from stdin |
|
131 | applying patch from stdin | |
132 | *** runcommand log |
|
132 | *** runcommand log | |
133 | changeset: 0:eff892de26ec |
|
133 | changeset: 0:eff892de26ec | |
134 | tag: tip |
|
134 | tag: tip | |
135 | user: test |
|
135 | user: test | |
136 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
136 | date: Thu Jan 01 00:00:00 1970 +0000 | |
137 | summary: 1 |
|
137 | summary: 1 | |
138 |
|
138 | |||
139 |
|
139 | |||
140 | check that "histedit --commands=-" can read rules from the input channel: |
|
140 | check that "histedit --commands=-" can read rules from the input channel: | |
141 |
|
141 | |||
142 | >>> import cStringIO |
|
142 | >>> import cStringIO | |
143 | >>> from hgclient import check, readchannel, runcommand |
|
143 | >>> from hgclient import check, readchannel, runcommand | |
144 | >>> @check |
|
144 | >>> @check | |
145 | ... def serverinput(server): |
|
145 | ... def serverinput(server): | |
146 | ... readchannel(server) |
|
146 | ... readchannel(server) | |
147 | ... rules = 'pick eff892de26ec\n' |
|
147 | ... rules = 'pick eff892de26ec\n' | |
148 | ... runcommand(server, ['histedit', '0', '--commands=-', |
|
148 | ... runcommand(server, ['histedit', '0', '--commands=-', | |
149 | ... '--config', 'extensions.histedit='], |
|
149 | ... '--config', 'extensions.histedit='], | |
150 | ... input=cStringIO.StringIO(rules)) |
|
150 | ... input=cStringIO.StringIO(rules)) | |
151 | *** runcommand histedit 0 --commands=- --config extensions.histedit= |
|
151 | *** runcommand histedit 0 --commands=- --config extensions.histedit= | |
152 |
|
152 | |||
153 | check that --cwd doesn't persist between requests: |
|
153 | check that --cwd doesn't persist between requests: | |
154 |
|
154 | |||
155 | $ mkdir foo |
|
155 | $ mkdir foo | |
156 | $ touch foo/bar |
|
156 | $ touch foo/bar | |
157 | >>> from hgclient import check, readchannel, runcommand |
|
157 | >>> from hgclient import check, readchannel, runcommand | |
158 | >>> @check |
|
158 | >>> @check | |
159 | ... def cwd(server): |
|
159 | ... def cwd(server): | |
160 | ... readchannel(server) |
|
160 | ... readchannel(server) | |
161 | ... runcommand(server, ['--cwd', 'foo', 'st', 'bar']) |
|
161 | ... runcommand(server, ['--cwd', 'foo', 'st', 'bar']) | |
162 | ... runcommand(server, ['st', 'foo/bar']) |
|
162 | ... runcommand(server, ['st', 'foo/bar']) | |
163 | *** runcommand --cwd foo st bar |
|
163 | *** runcommand --cwd foo st bar | |
164 | ? bar |
|
164 | ? bar | |
165 | *** runcommand st foo/bar |
|
165 | *** runcommand st foo/bar | |
166 | ? foo/bar |
|
166 | ? foo/bar | |
167 |
|
167 | |||
168 | $ rm foo/bar |
|
168 | $ rm foo/bar | |
169 |
|
169 | |||
170 |
|
170 | |||
171 | check that local configs for the cached repo aren't inherited when -R is used: |
|
171 | check that local configs for the cached repo aren't inherited when -R is used: | |
172 |
|
172 | |||
173 | $ cat <<EOF >> .hg/hgrc |
|
173 | $ cat <<EOF >> .hg/hgrc | |
174 | > [ui] |
|
174 | > [ui] | |
175 | > foo = bar |
|
175 | > foo = bar | |
176 | > EOF |
|
176 | > EOF | |
177 |
|
177 | |||
178 | >>> from hgclient import check, readchannel, runcommand, sep |
|
178 | >>> from hgclient import check, readchannel, runcommand, sep | |
179 | >>> @check |
|
179 | >>> @check | |
180 | ... def localhgrc(server): |
|
180 | ... def localhgrc(server): | |
181 | ... readchannel(server) |
|
181 | ... readchannel(server) | |
182 | ... |
|
182 | ... | |
183 | ... # the cached repo local hgrc contains ui.foo=bar, so showconfig should |
|
183 | ... # the cached repo local hgrc contains ui.foo=bar, so showconfig should | |
184 | ... # show it |
|
184 | ... # show it | |
185 | ... runcommand(server, ['showconfig'], outfilter=sep) |
|
185 | ... runcommand(server, ['showconfig'], outfilter=sep) | |
186 | ... |
|
186 | ... | |
187 | ... # but not for this repo |
|
187 | ... # but not for this repo | |
188 | ... runcommand(server, ['init', 'foo']) |
|
188 | ... runcommand(server, ['init', 'foo']) | |
189 | ... runcommand(server, ['-R', 'foo', 'showconfig', 'ui', 'defaults']) |
|
189 | ... runcommand(server, ['-R', 'foo', 'showconfig', 'ui', 'defaults']) | |
190 | *** runcommand showconfig |
|
190 | *** runcommand showconfig | |
191 | bundle.mainreporoot=$TESTTMP/repo |
|
191 | bundle.mainreporoot=$TESTTMP/repo | |
192 | devel.all-warnings=true |
|
192 | devel.all-warnings=true | |
193 | devel.default-date=0 0 |
|
193 | devel.default-date=0 0 | |
194 | extensions.fsmonitor= (fsmonitor !) |
|
194 | extensions.fsmonitor= (fsmonitor !) | |
195 | largefiles.usercache=$TESTTMP/.cache/largefiles |
|
195 | largefiles.usercache=$TESTTMP/.cache/largefiles | |
196 | ui.slash=True |
|
196 | ui.slash=True | |
197 | ui.interactive=False |
|
197 | ui.interactive=False | |
198 | ui.mergemarkers=detailed |
|
198 | ui.mergemarkers=detailed | |
199 | ui.usehttp2=true (?) |
|
199 | ui.usehttp2=true (?) | |
200 | ui.foo=bar |
|
200 | ui.foo=bar | |
201 | ui.nontty=true |
|
201 | ui.nontty=true | |
202 | web.address=localhost |
|
202 | web.address=localhost | |
203 | web\.ipv6=(?:True|False) (re) |
|
203 | web\.ipv6=(?:True|False) (re) | |
204 | *** runcommand init foo |
|
204 | *** runcommand init foo | |
205 | *** runcommand -R foo showconfig ui defaults |
|
205 | *** runcommand -R foo showconfig ui defaults | |
206 | ui.slash=True |
|
206 | ui.slash=True | |
207 | ui.interactive=False |
|
207 | ui.interactive=False | |
208 | ui.mergemarkers=detailed |
|
208 | ui.mergemarkers=detailed | |
209 | ui.usehttp2=true (?) |
|
209 | ui.usehttp2=true (?) | |
210 | ui.nontty=true |
|
210 | ui.nontty=true | |
211 |
|
211 | |||
212 | $ rm -R foo |
|
212 | $ rm -R foo | |
213 |
|
213 | |||
214 | #if windows |
|
214 | #if windows | |
215 | $ PYTHONPATH="$TESTTMP/repo;$PYTHONPATH" |
|
215 | $ PYTHONPATH="$TESTTMP/repo;$PYTHONPATH" | |
216 | #else |
|
216 | #else | |
217 | $ PYTHONPATH="$TESTTMP/repo:$PYTHONPATH" |
|
217 | $ PYTHONPATH="$TESTTMP/repo:$PYTHONPATH" | |
218 | #endif |
|
218 | #endif | |
219 |
|
219 | |||
220 | $ cat <<EOF > hook.py |
|
220 | $ cat <<EOF > hook.py | |
221 | > from __future__ import print_function |
|
221 | > from __future__ import print_function | |
222 | > import sys |
|
222 | > import sys | |
223 | > def hook(**args): |
|
223 | > def hook(**args): | |
224 | > print('hook talking') |
|
224 | > print('hook talking') | |
225 | > print('now try to read something: %r' % sys.stdin.read()) |
|
225 | > print('now try to read something: %r' % sys.stdin.read()) | |
226 | > EOF |
|
226 | > EOF | |
227 |
|
227 | |||
228 | >>> from hgclient import check, readchannel, runcommand, stringio |
|
228 | >>> from hgclient import check, readchannel, runcommand, stringio | |
229 | >>> @check |
|
229 | >>> @check | |
230 | ... def hookoutput(server): |
|
230 | ... def hookoutput(server): | |
231 | ... readchannel(server) |
|
231 | ... readchannel(server) | |
232 | ... runcommand(server, ['--config', |
|
232 | ... runcommand(server, ['--config', | |
233 | ... 'hooks.pre-identify=python:hook.hook', |
|
233 | ... 'hooks.pre-identify=python:hook.hook', | |
234 | ... 'id'], |
|
234 | ... 'id'], | |
235 | ... input=stringio('some input')) |
|
235 | ... input=stringio('some input')) | |
236 | *** runcommand --config hooks.pre-identify=python:hook.hook id |
|
236 | *** runcommand --config hooks.pre-identify=python:hook.hook id | |
237 | eff892de26ec tip |
|
237 | eff892de26ec tip | |
238 |
|
238 | |||
239 | Clean hook cached version |
|
239 | Clean hook cached version | |
240 | $ rm hook.py* |
|
240 | $ rm hook.py* | |
241 | $ rm -Rf __pycache__ |
|
241 | $ rm -Rf __pycache__ | |
242 |
|
242 | |||
243 | $ echo a >> a |
|
243 | $ echo a >> a | |
244 | >>> import os |
|
244 | >>> import os | |
245 | >>> from hgclient import check, readchannel, runcommand |
|
245 | >>> from hgclient import check, readchannel, runcommand | |
246 | >>> @check |
|
246 | >>> @check | |
247 | ... def outsidechanges(server): |
|
247 | ... def outsidechanges(server): | |
248 | ... readchannel(server) |
|
248 | ... readchannel(server) | |
249 | ... runcommand(server, ['status']) |
|
249 | ... runcommand(server, ['status']) | |
250 | ... os.system('hg ci -Am2') |
|
250 | ... os.system('hg ci -Am2') | |
251 | ... runcommand(server, ['tip']) |
|
251 | ... runcommand(server, ['tip']) | |
252 | ... runcommand(server, ['status']) |
|
252 | ... runcommand(server, ['status']) | |
253 | *** runcommand status |
|
253 | *** runcommand status | |
254 | M a |
|
254 | M a | |
255 | *** runcommand tip |
|
255 | *** runcommand tip | |
256 | changeset: 1:d3a0a68be6de |
|
256 | changeset: 1:d3a0a68be6de | |
257 | tag: tip |
|
257 | tag: tip | |
258 | user: test |
|
258 | user: test | |
259 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
259 | date: Thu Jan 01 00:00:00 1970 +0000 | |
260 | summary: 2 |
|
260 | summary: 2 | |
261 |
|
261 | |||
262 | *** runcommand status |
|
262 | *** runcommand status | |
263 |
|
263 | |||
264 | >>> import os |
|
264 | >>> import os | |
265 | >>> from hgclient import check, readchannel, runcommand |
|
265 | >>> from hgclient import check, readchannel, runcommand | |
266 | >>> @check |
|
266 | >>> @check | |
267 | ... def bookmarks(server): |
|
267 | ... def bookmarks(server): | |
268 | ... readchannel(server) |
|
268 | ... readchannel(server) | |
269 | ... runcommand(server, ['bookmarks']) |
|
269 | ... runcommand(server, ['bookmarks']) | |
270 | ... |
|
270 | ... | |
271 | ... # changes .hg/bookmarks |
|
271 | ... # changes .hg/bookmarks | |
272 | ... os.system('hg bookmark -i bm1') |
|
272 | ... os.system('hg bookmark -i bm1') | |
273 | ... os.system('hg bookmark -i bm2') |
|
273 | ... os.system('hg bookmark -i bm2') | |
274 | ... runcommand(server, ['bookmarks']) |
|
274 | ... runcommand(server, ['bookmarks']) | |
275 | ... |
|
275 | ... | |
276 | ... # changes .hg/bookmarks.current |
|
276 | ... # changes .hg/bookmarks.current | |
277 | ... os.system('hg upd bm1 -q') |
|
277 | ... os.system('hg upd bm1 -q') | |
278 | ... runcommand(server, ['bookmarks']) |
|
278 | ... runcommand(server, ['bookmarks']) | |
279 | ... |
|
279 | ... | |
280 | ... runcommand(server, ['bookmarks', 'bm3']) |
|
280 | ... runcommand(server, ['bookmarks', 'bm3']) | |
281 | ... f = open('a', 'ab') |
|
281 | ... f = open('a', 'ab') | |
282 | ... f.write('a\n') |
|
282 | ... f.write('a\n') | |
283 | ... f.close() |
|
283 | ... f.close() | |
284 | ... runcommand(server, ['commit', '-Amm']) |
|
284 | ... runcommand(server, ['commit', '-Amm']) | |
285 | ... runcommand(server, ['bookmarks']) |
|
285 | ... runcommand(server, ['bookmarks']) | |
286 | ... print('') |
|
286 | ... print('') | |
287 | *** runcommand bookmarks |
|
287 | *** runcommand bookmarks | |
288 | no bookmarks set |
|
288 | no bookmarks set | |
289 | *** runcommand bookmarks |
|
289 | *** runcommand bookmarks | |
290 | bm1 1:d3a0a68be6de |
|
290 | bm1 1:d3a0a68be6de | |
291 | bm2 1:d3a0a68be6de |
|
291 | bm2 1:d3a0a68be6de | |
292 | *** runcommand bookmarks |
|
292 | *** runcommand bookmarks | |
293 | * bm1 1:d3a0a68be6de |
|
293 | * bm1 1:d3a0a68be6de | |
294 | bm2 1:d3a0a68be6de |
|
294 | bm2 1:d3a0a68be6de | |
295 | *** runcommand bookmarks bm3 |
|
295 | *** runcommand bookmarks bm3 | |
296 | *** runcommand commit -Amm |
|
296 | *** runcommand commit -Amm | |
297 | *** runcommand bookmarks |
|
297 | *** runcommand bookmarks | |
298 | bm1 1:d3a0a68be6de |
|
298 | bm1 1:d3a0a68be6de | |
299 | bm2 1:d3a0a68be6de |
|
299 | bm2 1:d3a0a68be6de | |
300 | * bm3 2:aef17e88f5f0 |
|
300 | * bm3 2:aef17e88f5f0 | |
301 |
|
301 | |||
302 |
|
302 | |||
303 | >>> import os |
|
303 | >>> import os | |
304 | >>> from hgclient import check, readchannel, runcommand |
|
304 | >>> from hgclient import check, readchannel, runcommand | |
305 | >>> @check |
|
305 | >>> @check | |
306 | ... def tagscache(server): |
|
306 | ... def tagscache(server): | |
307 | ... readchannel(server) |
|
307 | ... readchannel(server) | |
308 | ... runcommand(server, ['id', '-t', '-r', '0']) |
|
308 | ... runcommand(server, ['id', '-t', '-r', '0']) | |
309 | ... os.system('hg tag -r 0 foo') |
|
309 | ... os.system('hg tag -r 0 foo') | |
310 | ... runcommand(server, ['id', '-t', '-r', '0']) |
|
310 | ... runcommand(server, ['id', '-t', '-r', '0']) | |
311 | *** runcommand id -t -r 0 |
|
311 | *** runcommand id -t -r 0 | |
312 |
|
312 | |||
313 | *** runcommand id -t -r 0 |
|
313 | *** runcommand id -t -r 0 | |
314 | foo |
|
314 | foo | |
315 |
|
315 | |||
316 | >>> import os |
|
316 | >>> import os | |
317 | >>> from hgclient import check, readchannel, runcommand |
|
317 | >>> from hgclient import check, readchannel, runcommand | |
318 | >>> @check |
|
318 | >>> @check | |
319 | ... def setphase(server): |
|
319 | ... def setphase(server): | |
320 | ... readchannel(server) |
|
320 | ... readchannel(server) | |
321 | ... runcommand(server, ['phase', '-r', '.']) |
|
321 | ... runcommand(server, ['phase', '-r', '.']) | |
322 | ... os.system('hg phase -r . -p') |
|
322 | ... os.system('hg phase -r . -p') | |
323 | ... runcommand(server, ['phase', '-r', '.']) |
|
323 | ... runcommand(server, ['phase', '-r', '.']) | |
324 | *** runcommand phase -r . |
|
324 | *** runcommand phase -r . | |
325 | 3: draft |
|
325 | 3: draft | |
326 | *** runcommand phase -r . |
|
326 | *** runcommand phase -r . | |
327 | 3: public |
|
327 | 3: public | |
328 |
|
328 | |||
329 | $ echo a >> a |
|
329 | $ echo a >> a | |
330 | >>> from hgclient import check, readchannel, runcommand |
|
330 | >>> from hgclient import check, readchannel, runcommand | |
331 | >>> @check |
|
331 | >>> @check | |
332 | ... def rollback(server): |
|
332 | ... def rollback(server): | |
333 | ... readchannel(server) |
|
333 | ... readchannel(server) | |
334 | ... runcommand(server, ['phase', '-r', '.', '-p']) |
|
334 | ... runcommand(server, ['phase', '-r', '.', '-p']) | |
335 | ... runcommand(server, ['commit', '-Am.']) |
|
335 | ... runcommand(server, ['commit', '-Am.']) | |
336 | ... runcommand(server, ['rollback']) |
|
336 | ... runcommand(server, ['rollback']) | |
337 | ... runcommand(server, ['phase', '-r', '.']) |
|
337 | ... runcommand(server, ['phase', '-r', '.']) | |
338 | ... print('') |
|
338 | ... print('') | |
339 | *** runcommand phase -r . -p |
|
339 | *** runcommand phase -r . -p | |
340 | no phases changed |
|
340 | no phases changed | |
341 | *** runcommand commit -Am. |
|
341 | *** runcommand commit -Am. | |
342 | *** runcommand rollback |
|
342 | *** runcommand rollback | |
343 | repository tip rolled back to revision 3 (undo commit) |
|
343 | repository tip rolled back to revision 3 (undo commit) | |
344 | working directory now based on revision 3 |
|
344 | working directory now based on revision 3 | |
345 | *** runcommand phase -r . |
|
345 | *** runcommand phase -r . | |
346 | 3: public |
|
346 | 3: public | |
347 |
|
347 | |||
348 |
|
348 | |||
349 | >>> import os |
|
349 | >>> import os | |
350 | >>> from hgclient import check, readchannel, runcommand |
|
350 | >>> from hgclient import check, readchannel, runcommand | |
351 | >>> @check |
|
351 | >>> @check | |
352 | ... def branch(server): |
|
352 | ... def branch(server): | |
353 | ... readchannel(server) |
|
353 | ... readchannel(server) | |
354 | ... runcommand(server, ['branch']) |
|
354 | ... runcommand(server, ['branch']) | |
355 | ... os.system('hg branch foo') |
|
355 | ... os.system('hg branch foo') | |
356 | ... runcommand(server, ['branch']) |
|
356 | ... runcommand(server, ['branch']) | |
357 | ... os.system('hg branch default') |
|
357 | ... os.system('hg branch default') | |
358 | *** runcommand branch |
|
358 | *** runcommand branch | |
359 | default |
|
359 | default | |
360 | marked working directory as branch foo |
|
360 | marked working directory as branch foo | |
361 | (branches are permanent and global, did you want a bookmark?) |
|
361 | (branches are permanent and global, did you want a bookmark?) | |
362 | *** runcommand branch |
|
362 | *** runcommand branch | |
363 | foo |
|
363 | foo | |
364 | marked working directory as branch default |
|
364 | marked working directory as branch default | |
365 | (branches are permanent and global, did you want a bookmark?) |
|
365 | (branches are permanent and global, did you want a bookmark?) | |
366 |
|
366 | |||
367 | $ touch .hgignore |
|
367 | $ touch .hgignore | |
368 | >>> import os |
|
368 | >>> import os | |
369 | >>> from hgclient import check, readchannel, runcommand |
|
369 | >>> from hgclient import check, readchannel, runcommand | |
370 | >>> @check |
|
370 | >>> @check | |
371 | ... def hgignore(server): |
|
371 | ... def hgignore(server): | |
372 | ... readchannel(server) |
|
372 | ... readchannel(server) | |
373 | ... runcommand(server, ['commit', '-Am.']) |
|
373 | ... runcommand(server, ['commit', '-Am.']) | |
374 | ... f = open('ignored-file', 'ab') |
|
374 | ... f = open('ignored-file', 'ab') | |
375 | ... f.write('') |
|
375 | ... f.write('') | |
376 | ... f.close() |
|
376 | ... f.close() | |
377 | ... f = open('.hgignore', 'ab') |
|
377 | ... f = open('.hgignore', 'ab') | |
378 | ... f.write('ignored-file') |
|
378 | ... f.write('ignored-file') | |
379 | ... f.close() |
|
379 | ... f.close() | |
380 | ... runcommand(server, ['status', '-i', '-u']) |
|
380 | ... runcommand(server, ['status', '-i', '-u']) | |
381 | ... print('') |
|
381 | ... print('') | |
382 | *** runcommand commit -Am. |
|
382 | *** runcommand commit -Am. | |
383 | adding .hgignore |
|
383 | adding .hgignore | |
384 | *** runcommand status -i -u |
|
384 | *** runcommand status -i -u | |
385 | I ignored-file |
|
385 | I ignored-file | |
386 |
|
386 | |||
387 |
|
387 | |||
388 | cache of non-public revisions should be invalidated on repository change |
|
388 | cache of non-public revisions should be invalidated on repository change | |
389 | (issue4855): |
|
389 | (issue4855): | |
390 |
|
390 | |||
391 | >>> import os |
|
391 | >>> import os | |
392 | >>> from hgclient import check, readchannel, runcommand |
|
392 | >>> from hgclient import check, readchannel, runcommand | |
393 | >>> @check |
|
393 | >>> @check | |
394 | ... def phasesetscacheaftercommit(server): |
|
394 | ... def phasesetscacheaftercommit(server): | |
395 | ... readchannel(server) |
|
395 | ... readchannel(server) | |
396 | ... # load _phasecache._phaserevs and _phasesets |
|
396 | ... # load _phasecache._phaserevs and _phasesets | |
397 | ... runcommand(server, ['log', '-qr', 'draft()']) |
|
397 | ... runcommand(server, ['log', '-qr', 'draft()']) | |
398 | ... # create draft commits by another process |
|
398 | ... # create draft commits by another process | |
399 | ... for i in xrange(5, 7): |
|
399 | ... for i in xrange(5, 7): | |
400 | ... f = open('a', 'ab') |
|
400 | ... f = open('a', 'ab') | |
401 | ... f.seek(0, os.SEEK_END) |
|
401 | ... f.seek(0, os.SEEK_END) | |
402 | ... f.write('a\n') |
|
402 | ... f.write('a\n') | |
403 | ... f.close() |
|
403 | ... f.close() | |
404 | ... os.system('hg commit -Aqm%d' % i) |
|
404 | ... os.system('hg commit -Aqm%d' % i) | |
405 | ... # new commits should be listed as draft revisions |
|
405 | ... # new commits should be listed as draft revisions | |
406 | ... runcommand(server, ['log', '-qr', 'draft()']) |
|
406 | ... runcommand(server, ['log', '-qr', 'draft()']) | |
407 | ... print('') |
|
407 | ... print('') | |
408 | *** runcommand log -qr draft() |
|
408 | *** runcommand log -qr draft() | |
409 | 4:7966c8e3734d |
|
409 | 4:7966c8e3734d | |
410 | *** runcommand log -qr draft() |
|
410 | *** runcommand log -qr draft() | |
411 | 4:7966c8e3734d |
|
411 | 4:7966c8e3734d | |
412 | 5:41f6602d1c4f |
|
412 | 5:41f6602d1c4f | |
413 | 6:10501e202c35 |
|
413 | 6:10501e202c35 | |
414 |
|
414 | |||
415 |
|
415 | |||
416 | >>> import os |
|
416 | >>> import os | |
417 | >>> from hgclient import check, readchannel, runcommand |
|
417 | >>> from hgclient import check, readchannel, runcommand | |
418 | >>> @check |
|
418 | >>> @check | |
419 | ... def phasesetscacheafterstrip(server): |
|
419 | ... def phasesetscacheafterstrip(server): | |
420 | ... readchannel(server) |
|
420 | ... readchannel(server) | |
421 | ... # load _phasecache._phaserevs and _phasesets |
|
421 | ... # load _phasecache._phaserevs and _phasesets | |
422 | ... runcommand(server, ['log', '-qr', 'draft()']) |
|
422 | ... runcommand(server, ['log', '-qr', 'draft()']) | |
423 | ... # strip cached revisions by another process |
|
423 | ... # strip cached revisions by another process | |
424 | ... os.system('hg --config extensions.strip= strip -q 5') |
|
424 | ... os.system('hg --config extensions.strip= strip -q 5') | |
425 | ... # shouldn't abort by "unknown revision '6'" |
|
425 | ... # shouldn't abort by "unknown revision '6'" | |
426 | ... runcommand(server, ['log', '-qr', 'draft()']) |
|
426 | ... runcommand(server, ['log', '-qr', 'draft()']) | |
427 | ... print('') |
|
427 | ... print('') | |
428 | *** runcommand log -qr draft() |
|
428 | *** runcommand log -qr draft() | |
429 | 4:7966c8e3734d |
|
429 | 4:7966c8e3734d | |
430 | 5:41f6602d1c4f |
|
430 | 5:41f6602d1c4f | |
431 | 6:10501e202c35 |
|
431 | 6:10501e202c35 | |
432 | *** runcommand log -qr draft() |
|
432 | *** runcommand log -qr draft() | |
433 | 4:7966c8e3734d |
|
433 | 4:7966c8e3734d | |
434 |
|
434 | |||
435 |
|
435 | |||
436 | cache of phase roots should be invalidated on strip (issue3827): |
|
436 | cache of phase roots should be invalidated on strip (issue3827): | |
437 |
|
437 | |||
438 | >>> import os |
|
438 | >>> import os | |
439 | >>> from hgclient import check, readchannel, runcommand, sep |
|
439 | >>> from hgclient import check, readchannel, runcommand, sep | |
440 | >>> @check |
|
440 | >>> @check | |
441 | ... def phasecacheafterstrip(server): |
|
441 | ... def phasecacheafterstrip(server): | |
442 | ... readchannel(server) |
|
442 | ... readchannel(server) | |
443 | ... |
|
443 | ... | |
444 | ... # create new head, 5:731265503d86 |
|
444 | ... # create new head, 5:731265503d86 | |
445 | ... runcommand(server, ['update', '-C', '0']) |
|
445 | ... runcommand(server, ['update', '-C', '0']) | |
446 | ... f = open('a', 'ab') |
|
446 | ... f = open('a', 'ab') | |
447 | ... f.write('a\n') |
|
447 | ... f.write('a\n') | |
448 | ... f.close() |
|
448 | ... f.close() | |
449 | ... runcommand(server, ['commit', '-Am.', 'a']) |
|
449 | ... runcommand(server, ['commit', '-Am.', 'a']) | |
450 | ... runcommand(server, ['log', '-Gq']) |
|
450 | ... runcommand(server, ['log', '-Gq']) | |
451 | ... |
|
451 | ... | |
452 | ... # make it public; draft marker moves to 4:7966c8e3734d |
|
452 | ... # make it public; draft marker moves to 4:7966c8e3734d | |
453 | ... runcommand(server, ['phase', '-p', '.']) |
|
453 | ... runcommand(server, ['phase', '-p', '.']) | |
454 | ... # load _phasecache.phaseroots |
|
454 | ... # load _phasecache.phaseroots | |
455 | ... runcommand(server, ['phase', '.'], outfilter=sep) |
|
455 | ... runcommand(server, ['phase', '.'], outfilter=sep) | |
456 | ... |
|
456 | ... | |
457 | ... # strip 1::4 outside server |
|
457 | ... # strip 1::4 outside server | |
458 | ... os.system('hg -q --config extensions.mq= strip 1') |
|
458 | ... os.system('hg -q --config extensions.mq= strip 1') | |
459 | ... |
|
459 | ... | |
460 | ... # shouldn't raise "7966c8e3734d: no node!" |
|
460 | ... # shouldn't raise "7966c8e3734d: no node!" | |
461 | ... runcommand(server, ['branches']) |
|
461 | ... runcommand(server, ['branches']) | |
462 | *** runcommand update -C 0 |
|
462 | *** runcommand update -C 0 | |
463 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
463 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
464 | (leaving bookmark bm3) |
|
464 | (leaving bookmark bm3) | |
465 | *** runcommand commit -Am. a |
|
465 | *** runcommand commit -Am. a | |
466 | created new head |
|
466 | created new head | |
467 | *** runcommand log -Gq |
|
467 | *** runcommand log -Gq | |
468 | @ 5:731265503d86 |
|
468 | @ 5:731265503d86 | |
469 | | |
|
469 | | | |
470 | | o 4:7966c8e3734d |
|
470 | | o 4:7966c8e3734d | |
471 | | | |
|
471 | | | | |
472 | | o 3:b9b85890c400 |
|
472 | | o 3:b9b85890c400 | |
473 | | | |
|
473 | | | | |
474 | | o 2:aef17e88f5f0 |
|
474 | | o 2:aef17e88f5f0 | |
475 | | | |
|
475 | | | | |
476 | | o 1:d3a0a68be6de |
|
476 | | o 1:d3a0a68be6de | |
477 | |/ |
|
477 | |/ | |
478 | o 0:eff892de26ec |
|
478 | o 0:eff892de26ec | |
479 |
|
479 | |||
480 | *** runcommand phase -p . |
|
480 | *** runcommand phase -p . | |
481 | *** runcommand phase . |
|
481 | *** runcommand phase . | |
482 | 5: public |
|
482 | 5: public | |
483 | *** runcommand branches |
|
483 | *** runcommand branches | |
484 | default 1:731265503d86 |
|
484 | default 1:731265503d86 | |
485 |
|
485 | |||
486 | in-memory cache must be reloaded if transaction is aborted. otherwise |
|
486 | in-memory cache must be reloaded if transaction is aborted. otherwise | |
487 | changelog and manifest would have invalid node: |
|
487 | changelog and manifest would have invalid node: | |
488 |
|
488 | |||
489 | $ echo a >> a |
|
489 | $ echo a >> a | |
490 | >>> from hgclient import check, readchannel, runcommand |
|
490 | >>> from hgclient import check, readchannel, runcommand | |
491 | >>> @check |
|
491 | >>> @check | |
492 | ... def txabort(server): |
|
492 | ... def txabort(server): | |
493 | ... readchannel(server) |
|
493 | ... readchannel(server) | |
494 | ... runcommand(server, ['commit', '--config', 'hooks.pretxncommit=false', |
|
494 | ... runcommand(server, ['commit', '--config', 'hooks.pretxncommit=false', | |
495 | ... '-mfoo']) |
|
495 | ... '-mfoo']) | |
496 | ... runcommand(server, ['verify']) |
|
496 | ... runcommand(server, ['verify']) | |
497 | *** runcommand commit --config hooks.pretxncommit=false -mfoo |
|
497 | *** runcommand commit --config hooks.pretxncommit=false -mfoo | |
498 | transaction abort! |
|
498 | transaction abort! | |
499 | rollback completed |
|
499 | rollback completed | |
500 | abort: pretxncommit hook exited with status 1 |
|
500 | abort: pretxncommit hook exited with status 1 | |
501 | [255] |
|
501 | [255] | |
502 | *** runcommand verify |
|
502 | *** runcommand verify | |
503 | checking changesets |
|
503 | checking changesets | |
504 | checking manifests |
|
504 | checking manifests | |
505 | crosschecking files in changesets and manifests |
|
505 | crosschecking files in changesets and manifests | |
506 | checking files |
|
506 | checking files | |
507 | 1 files, 2 changesets, 2 total revisions |
|
507 | 1 files, 2 changesets, 2 total revisions | |
508 | $ hg revert --no-backup -aq |
|
508 | $ hg revert --no-backup -aq | |
509 |
|
509 | |||
510 | $ cat >> .hg/hgrc << EOF |
|
510 | $ cat >> .hg/hgrc << EOF | |
511 | > [experimental] |
|
511 | > [experimental] | |
512 | > stabilization=createmarkers |
|
512 | > stabilization=createmarkers | |
513 | > EOF |
|
513 | > EOF | |
514 |
|
514 | |||
515 | >>> import os |
|
515 | >>> import os | |
516 | >>> from hgclient import check, readchannel, runcommand |
|
516 | >>> from hgclient import check, readchannel, runcommand | |
517 | >>> @check |
|
517 | >>> @check | |
518 | ... def obsolete(server): |
|
518 | ... def obsolete(server): | |
519 | ... readchannel(server) |
|
519 | ... readchannel(server) | |
520 | ... |
|
520 | ... | |
521 | ... runcommand(server, ['up', 'null']) |
|
521 | ... runcommand(server, ['up', 'null']) | |
522 | ... runcommand(server, ['phase', '-df', 'tip']) |
|
522 | ... runcommand(server, ['phase', '-df', 'tip']) | |
523 | ... cmd = 'hg debugobsolete `hg log -r tip --template {node}`' |
|
523 | ... cmd = 'hg debugobsolete `hg log -r tip --template {node}`' | |
524 | ... if os.name == 'nt': |
|
524 | ... if os.name == 'nt': | |
525 | ... cmd = 'sh -c "%s"' % cmd # run in sh, not cmd.exe |
|
525 | ... cmd = 'sh -c "%s"' % cmd # run in sh, not cmd.exe | |
526 | ... os.system(cmd) |
|
526 | ... os.system(cmd) | |
527 | ... runcommand(server, ['log', '--hidden']) |
|
527 | ... runcommand(server, ['log', '--hidden']) | |
528 | ... runcommand(server, ['log']) |
|
528 | ... runcommand(server, ['log']) | |
529 | *** runcommand up null |
|
529 | *** runcommand up null | |
530 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
530 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
531 | *** runcommand phase -df tip |
|
531 | *** runcommand phase -df tip | |
532 | obsoleted 1 changesets |
|
532 | obsoleted 1 changesets | |
533 | *** runcommand log --hidden |
|
533 | *** runcommand log --hidden | |
534 | changeset: 1:731265503d86 |
|
534 | changeset: 1:731265503d86 | |
535 | tag: tip |
|
535 | tag: tip | |
536 | user: test |
|
536 | user: test | |
537 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
537 | date: Thu Jan 01 00:00:00 1970 +0000 | |
538 | summary: . |
|
538 | summary: . | |
539 |
|
539 | |||
540 | changeset: 0:eff892de26ec |
|
540 | changeset: 0:eff892de26ec | |
541 | bookmark: bm1 |
|
541 | bookmark: bm1 | |
542 | bookmark: bm2 |
|
542 | bookmark: bm2 | |
543 | bookmark: bm3 |
|
543 | bookmark: bm3 | |
544 | user: test |
|
544 | user: test | |
545 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
545 | date: Thu Jan 01 00:00:00 1970 +0000 | |
546 | summary: 1 |
|
546 | summary: 1 | |
547 |
|
547 | |||
548 | *** runcommand log |
|
548 | *** runcommand log | |
549 | changeset: 0:eff892de26ec |
|
549 | changeset: 0:eff892de26ec | |
550 | bookmark: bm1 |
|
550 | bookmark: bm1 | |
551 | bookmark: bm2 |
|
551 | bookmark: bm2 | |
552 | bookmark: bm3 |
|
552 | bookmark: bm3 | |
553 | tag: tip |
|
553 | tag: tip | |
554 | user: test |
|
554 | user: test | |
555 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
555 | date: Thu Jan 01 00:00:00 1970 +0000 | |
556 | summary: 1 |
|
556 | summary: 1 | |
557 |
|
557 | |||
558 |
|
558 | |||
559 | $ cat <<EOF >> .hg/hgrc |
|
559 | $ cat <<EOF >> .hg/hgrc | |
560 | > [extensions] |
|
560 | > [extensions] | |
561 | > mq = |
|
561 | > mq = | |
562 | > EOF |
|
562 | > EOF | |
563 |
|
563 | |||
564 | >>> import os |
|
564 | >>> import os | |
565 | >>> from hgclient import check, readchannel, runcommand |
|
565 | >>> from hgclient import check, readchannel, runcommand | |
566 | >>> @check |
|
566 | >>> @check | |
567 | ... def mqoutsidechanges(server): |
|
567 | ... def mqoutsidechanges(server): | |
568 | ... readchannel(server) |
|
568 | ... readchannel(server) | |
569 | ... |
|
569 | ... | |
570 | ... # load repo.mq |
|
570 | ... # load repo.mq | |
571 | ... runcommand(server, ['qapplied']) |
|
571 | ... runcommand(server, ['qapplied']) | |
572 | ... os.system('hg qnew 0.diff') |
|
572 | ... os.system('hg qnew 0.diff') | |
573 | ... # repo.mq should be invalidated |
|
573 | ... # repo.mq should be invalidated | |
574 | ... runcommand(server, ['qapplied']) |
|
574 | ... runcommand(server, ['qapplied']) | |
575 | ... |
|
575 | ... | |
576 | ... runcommand(server, ['qpop', '--all']) |
|
576 | ... runcommand(server, ['qpop', '--all']) | |
577 | ... os.system('hg qqueue --create foo') |
|
577 | ... os.system('hg qqueue --create foo') | |
578 | ... # repo.mq should be recreated to point to new queue |
|
578 | ... # repo.mq should be recreated to point to new queue | |
579 | ... runcommand(server, ['qqueue', '--active']) |
|
579 | ... runcommand(server, ['qqueue', '--active']) | |
580 | *** runcommand qapplied |
|
580 | *** runcommand qapplied | |
581 | *** runcommand qapplied |
|
581 | *** runcommand qapplied | |
582 | 0.diff |
|
582 | 0.diff | |
583 | *** runcommand qpop --all |
|
583 | *** runcommand qpop --all | |
584 | popping 0.diff |
|
584 | popping 0.diff | |
585 | patch queue now empty |
|
585 | patch queue now empty | |
586 | *** runcommand qqueue --active |
|
586 | *** runcommand qqueue --active | |
587 | foo |
|
587 | foo | |
588 |
|
588 | |||
589 | $ cat <<EOF > dbgui.py |
|
589 | $ cat <<EOF > dbgui.py | |
590 | > import os |
|
590 | > import os | |
591 | > import sys |
|
591 | > import sys | |
592 | > from mercurial import commands, registrar |
|
592 | > from mercurial import commands, registrar | |
593 | > cmdtable = {} |
|
593 | > cmdtable = {} | |
594 | > command = registrar.command(cmdtable) |
|
594 | > command = registrar.command(cmdtable) | |
595 | > @command(b"debuggetpass", norepo=True) |
|
595 | > @command(b"debuggetpass", norepo=True) | |
596 | > def debuggetpass(ui): |
|
596 | > def debuggetpass(ui): | |
597 | > ui.write("%s\\n" % ui.getpass()) |
|
597 | > ui.write("%s\\n" % ui.getpass()) | |
598 | > @command(b"debugprompt", norepo=True) |
|
598 | > @command(b"debugprompt", norepo=True) | |
599 | > def debugprompt(ui): |
|
599 | > def debugprompt(ui): | |
600 | > ui.write("%s\\n" % ui.prompt("prompt:")) |
|
600 | > ui.write("%s\\n" % ui.prompt("prompt:")) | |
601 | > @command(b"debugreadstdin", norepo=True) |
|
601 | > @command(b"debugreadstdin", norepo=True) | |
602 | > def debugreadstdin(ui): |
|
602 | > def debugreadstdin(ui): | |
603 | > ui.write("read: %r\n" % sys.stdin.read(1)) |
|
603 | > ui.write("read: %r\n" % sys.stdin.read(1)) | |
604 | > @command(b"debugwritestdout", norepo=True) |
|
604 | > @command(b"debugwritestdout", norepo=True) | |
605 | > def debugwritestdout(ui): |
|
605 | > def debugwritestdout(ui): | |
606 | > os.write(1, "low-level stdout fd and\n") |
|
606 | > os.write(1, "low-level stdout fd and\n") | |
607 | > sys.stdout.write("stdout should be redirected to /dev/null\n") |
|
607 | > sys.stdout.write("stdout should be redirected to /dev/null\n") | |
608 | > sys.stdout.flush() |
|
608 | > sys.stdout.flush() | |
609 | > EOF |
|
609 | > EOF | |
610 | $ cat <<EOF >> .hg/hgrc |
|
610 | $ cat <<EOF >> .hg/hgrc | |
611 | > [extensions] |
|
611 | > [extensions] | |
612 | > dbgui = dbgui.py |
|
612 | > dbgui = dbgui.py | |
613 | > EOF |
|
613 | > EOF | |
614 |
|
614 | |||
615 | >>> from hgclient import check, readchannel, runcommand, stringio |
|
615 | >>> from hgclient import check, readchannel, runcommand, stringio | |
616 | >>> @check |
|
616 | >>> @check | |
617 | ... def getpass(server): |
|
617 | ... def getpass(server): | |
618 | ... readchannel(server) |
|
618 | ... readchannel(server) | |
619 | ... runcommand(server, ['debuggetpass', '--config', |
|
619 | ... runcommand(server, ['debuggetpass', '--config', | |
620 | ... 'ui.interactive=True'], |
|
620 | ... 'ui.interactive=True'], | |
621 | ... input=stringio('1234\n')) |
|
621 | ... input=stringio('1234\n')) | |
622 | ... runcommand(server, ['debuggetpass', '--config', |
|
622 | ... runcommand(server, ['debuggetpass', '--config', | |
623 | ... 'ui.interactive=True'], |
|
623 | ... 'ui.interactive=True'], | |
624 | ... input=stringio('\n')) |
|
624 | ... input=stringio('\n')) | |
625 | ... runcommand(server, ['debuggetpass', '--config', |
|
625 | ... runcommand(server, ['debuggetpass', '--config', | |
626 | ... 'ui.interactive=True'], |
|
626 | ... 'ui.interactive=True'], | |
627 | ... input=stringio('')) |
|
627 | ... input=stringio('')) | |
628 | ... runcommand(server, ['debugprompt', '--config', |
|
628 | ... runcommand(server, ['debugprompt', '--config', | |
629 | ... 'ui.interactive=True'], |
|
629 | ... 'ui.interactive=True'], | |
630 | ... input=stringio('5678\n')) |
|
630 | ... input=stringio('5678\n')) | |
631 | ... runcommand(server, ['debugreadstdin']) |
|
631 | ... runcommand(server, ['debugreadstdin']) | |
632 | ... runcommand(server, ['debugwritestdout']) |
|
632 | ... runcommand(server, ['debugwritestdout']) | |
633 | *** runcommand debuggetpass --config ui.interactive=True |
|
633 | *** runcommand debuggetpass --config ui.interactive=True | |
634 | password: 1234 |
|
634 | password: 1234 | |
635 | *** runcommand debuggetpass --config ui.interactive=True |
|
635 | *** runcommand debuggetpass --config ui.interactive=True | |
636 | password: |
|
636 | password: | |
637 | *** runcommand debuggetpass --config ui.interactive=True |
|
637 | *** runcommand debuggetpass --config ui.interactive=True | |
638 | password: abort: response expected |
|
638 | password: abort: response expected | |
639 | [255] |
|
639 | [255] | |
640 | *** runcommand debugprompt --config ui.interactive=True |
|
640 | *** runcommand debugprompt --config ui.interactive=True | |
641 | prompt: 5678 |
|
641 | prompt: 5678 | |
642 | *** runcommand debugreadstdin |
|
642 | *** runcommand debugreadstdin | |
643 | read: '' |
|
643 | read: '' | |
644 | *** runcommand debugwritestdout |
|
644 | *** runcommand debugwritestdout | |
645 |
|
645 | |||
646 |
|
646 | |||
647 | run commandserver in commandserver, which is silly but should work: |
|
647 | run commandserver in commandserver, which is silly but should work: | |
648 |
|
648 | |||
649 | >>> from __future__ import print_function |
|
649 | >>> from __future__ import print_function | |
650 | >>> from hgclient import check, readchannel, runcommand, stringio |
|
650 | >>> from hgclient import check, readchannel, runcommand, stringio | |
651 | >>> @check |
|
651 | >>> @check | |
652 | ... def nested(server): |
|
652 | ... def nested(server): | |
653 | ... print('%c, %r' % readchannel(server)) |
|
653 | ... print('%c, %r' % readchannel(server)) | |
654 | ... class nestedserver(object): |
|
654 | ... class nestedserver(object): | |
655 | ... stdin = stringio('getencoding\n') |
|
655 | ... stdin = stringio('getencoding\n') | |
656 | ... stdout = stringio() |
|
656 | ... stdout = stringio() | |
657 | ... runcommand(server, ['serve', '--cmdserver', 'pipe'], |
|
657 | ... runcommand(server, ['serve', '--cmdserver', 'pipe'], | |
658 | ... output=nestedserver.stdout, input=nestedserver.stdin) |
|
658 | ... output=nestedserver.stdout, input=nestedserver.stdin) | |
659 | ... nestedserver.stdout.seek(0) |
|
659 | ... nestedserver.stdout.seek(0) | |
660 | ... print('%c, %r' % readchannel(nestedserver)) # hello |
|
660 | ... print('%c, %r' % readchannel(nestedserver)) # hello | |
661 | ... print('%c, %r' % readchannel(nestedserver)) # getencoding |
|
661 | ... print('%c, %r' % readchannel(nestedserver)) # getencoding | |
662 | o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob) |
|
662 | o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob) | |
663 | *** runcommand serve --cmdserver pipe |
|
663 | *** runcommand serve --cmdserver pipe | |
664 | o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob) |
|
664 | o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob) | |
665 | r, '*' (glob) |
|
665 | r, '*' (glob) | |
666 |
|
666 | |||
667 |
|
667 | |||
668 | start without repository: |
|
668 | start without repository: | |
669 |
|
669 | |||
670 | $ cd .. |
|
670 | $ cd .. | |
671 |
|
671 | |||
672 | >>> from __future__ import print_function |
|
672 | >>> from __future__ import print_function | |
673 | >>> from hgclient import check, readchannel, runcommand |
|
673 | >>> from hgclient import check, readchannel, runcommand | |
674 | >>> @check |
|
674 | >>> @check | |
675 | ... def hellomessage(server): |
|
675 | ... def hellomessage(server): | |
676 | ... ch, data = readchannel(server) |
|
676 | ... ch, data = readchannel(server) | |
677 | ... print('%c, %r' % (ch, data)) |
|
677 | ... print('%c, %r' % (ch, data)) | |
678 | ... # run an arbitrary command to make sure the next thing the server |
|
678 | ... # run an arbitrary command to make sure the next thing the server | |
679 | ... # sends isn't part of the hello message |
|
679 | ... # sends isn't part of the hello message | |
680 | ... runcommand(server, ['id']) |
|
680 | ... runcommand(server, ['id']) | |
681 | o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob) |
|
681 | o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob) | |
682 | *** runcommand id |
|
682 | *** runcommand id | |
683 | abort: there is no Mercurial repository here (.hg not found) |
|
683 | abort: there is no Mercurial repository here (.hg not found) | |
684 | [255] |
|
684 | [255] | |
685 |
|
685 | |||
686 | >>> from hgclient import check, readchannel, runcommand |
|
686 | >>> from hgclient import check, readchannel, runcommand | |
687 | >>> @check |
|
687 | >>> @check | |
688 | ... def startwithoutrepo(server): |
|
688 | ... def startwithoutrepo(server): | |
689 | ... readchannel(server) |
|
689 | ... readchannel(server) | |
690 | ... runcommand(server, ['init', 'repo2']) |
|
690 | ... runcommand(server, ['init', 'repo2']) | |
691 | ... runcommand(server, ['id', '-R', 'repo2']) |
|
691 | ... runcommand(server, ['id', '-R', 'repo2']) | |
692 | *** runcommand init repo2 |
|
692 | *** runcommand init repo2 | |
693 | *** runcommand id -R repo2 |
|
693 | *** runcommand id -R repo2 | |
694 | 000000000000 tip |
|
694 | 000000000000 tip | |
695 |
|
695 | |||
696 |
|
696 | |||
697 | don't fall back to cwd if invalid -R path is specified (issue4805): |
|
697 | don't fall back to cwd if invalid -R path is specified (issue4805): | |
698 |
|
698 | |||
699 | $ cd repo |
|
699 | $ cd repo | |
700 | $ hg serve --cmdserver pipe -R ../nonexistent |
|
700 | $ hg serve --cmdserver pipe -R ../nonexistent | |
701 | abort: repository ../nonexistent not found! |
|
701 | abort: repository ../nonexistent not found! | |
702 | [255] |
|
702 | [255] | |
703 | $ cd .. |
|
703 | $ cd .. | |
704 |
|
704 | |||
705 |
|
705 | |||
706 | unix domain socket: |
|
706 | unix domain socket: | |
707 |
|
707 | |||
708 | $ cd repo |
|
708 | $ cd repo | |
709 | $ hg update -q |
|
709 | $ hg update -q | |
710 |
|
710 | |||
711 | #if unix-socket unix-permissions |
|
711 | #if unix-socket unix-permissions | |
712 |
|
712 | |||
713 | >>> from __future__ import print_function |
|
713 | >>> from __future__ import print_function | |
714 | >>> from hgclient import check, readchannel, runcommand, stringio, unixserver |
|
714 | >>> from hgclient import check, readchannel, runcommand, stringio, unixserver | |
715 | >>> server = unixserver('.hg/server.sock', '.hg/server.log') |
|
715 | >>> server = unixserver('.hg/server.sock', '.hg/server.log') | |
716 | >>> def hellomessage(conn): |
|
716 | >>> def hellomessage(conn): | |
717 | ... ch, data = readchannel(conn) |
|
717 | ... ch, data = readchannel(conn) | |
718 | ... print('%c, %r' % (ch, data)) |
|
718 | ... print('%c, %r' % (ch, data)) | |
719 | ... runcommand(conn, ['id']) |
|
719 | ... runcommand(conn, ['id']) | |
720 | >>> check(hellomessage, server.connect) |
|
720 | >>> check(hellomessage, server.connect) | |
721 | o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob) |
|
721 | o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob) | |
722 | *** runcommand id |
|
722 | *** runcommand id | |
723 | eff892de26ec tip bm1/bm2/bm3 |
|
723 | eff892de26ec tip bm1/bm2/bm3 | |
724 | >>> def unknowncommand(conn): |
|
724 | >>> def unknowncommand(conn): | |
725 | ... readchannel(conn) |
|
725 | ... readchannel(conn) | |
726 | ... conn.stdin.write('unknowncommand\n') |
|
726 | ... conn.stdin.write('unknowncommand\n') | |
727 | >>> check(unknowncommand, server.connect) # error sent to server.log |
|
727 | >>> check(unknowncommand, server.connect) # error sent to server.log | |
728 | >>> def serverinput(conn): |
|
728 | >>> def serverinput(conn): | |
729 | ... readchannel(conn) |
|
729 | ... readchannel(conn) | |
730 | ... patch = """ |
|
730 | ... patch = """ | |
731 | ... # HG changeset patch |
|
731 | ... # HG changeset patch | |
732 | ... # User test |
|
732 | ... # User test | |
733 | ... # Date 0 0 |
|
733 | ... # Date 0 0 | |
734 | ... 2 |
|
734 | ... 2 | |
735 | ... |
|
735 | ... | |
736 | ... diff -r eff892de26ec -r 1ed24be7e7a0 a |
|
736 | ... diff -r eff892de26ec -r 1ed24be7e7a0 a | |
737 | ... --- a/a |
|
737 | ... --- a/a | |
738 | ... +++ b/a |
|
738 | ... +++ b/a | |
739 | ... @@ -1,1 +1,2 @@ |
|
739 | ... @@ -1,1 +1,2 @@ | |
740 | ... 1 |
|
740 | ... 1 | |
741 | ... +2 |
|
741 | ... +2 | |
742 | ... """ |
|
742 | ... """ | |
743 | ... runcommand(conn, ['import', '-'], input=stringio(patch)) |
|
743 | ... runcommand(conn, ['import', '-'], input=stringio(patch)) | |
744 | ... runcommand(conn, ['log', '-rtip', '-q']) |
|
744 | ... runcommand(conn, ['log', '-rtip', '-q']) | |
745 | >>> check(serverinput, server.connect) |
|
745 | >>> check(serverinput, server.connect) | |
746 | *** runcommand import - |
|
746 | *** runcommand import - | |
747 | applying patch from stdin |
|
747 | applying patch from stdin | |
748 | *** runcommand log -rtip -q |
|
748 | *** runcommand log -rtip -q | |
749 | 2:1ed24be7e7a0 |
|
749 | 2:1ed24be7e7a0 | |
750 | >>> server.shutdown() |
|
750 | >>> server.shutdown() | |
751 |
|
751 | |||
752 | $ cat .hg/server.log |
|
752 | $ cat .hg/server.log | |
753 | listening at .hg/server.sock |
|
753 | listening at .hg/server.sock | |
754 | abort: unknown command unknowncommand |
|
754 | abort: unknown command unknowncommand | |
755 | killed! |
|
755 | killed! | |
756 | $ rm .hg/server.log |
|
756 | $ rm .hg/server.log | |
757 |
|
757 | |||
758 | if server crashed before hello, traceback will be sent to 'e' channel as |
|
758 | if server crashed before hello, traceback will be sent to 'e' channel as | |
759 | last ditch: |
|
759 | last ditch: | |
760 |
|
760 | |||
761 | $ cat <<EOF >> .hg/hgrc |
|
761 | $ cat <<EOF >> .hg/hgrc | |
762 | > [cmdserver] |
|
762 | > [cmdserver] | |
763 | > log = inexistent/path.log |
|
763 | > log = inexistent/path.log | |
764 | > EOF |
|
764 | > EOF | |
765 | >>> from __future__ import print_function |
|
765 | >>> from __future__ import print_function | |
766 | >>> from hgclient import check, readchannel, unixserver |
|
766 | >>> from hgclient import check, readchannel, unixserver | |
767 | >>> server = unixserver('.hg/server.sock', '.hg/server.log') |
|
767 | >>> server = unixserver('.hg/server.sock', '.hg/server.log') | |
768 | >>> def earlycrash(conn): |
|
768 | >>> def earlycrash(conn): | |
769 | ... while True: |
|
769 | ... while True: | |
770 | ... try: |
|
770 | ... try: | |
771 | ... ch, data = readchannel(conn) |
|
771 | ... ch, data = readchannel(conn) | |
772 | ... if not data.startswith(' '): |
|
772 | ... if not data.startswith(' '): | |
773 | ... print('%c, %r' % (ch, data)) |
|
773 | ... print('%c, %r' % (ch, data)) | |
774 | ... except EOFError: |
|
774 | ... except EOFError: | |
775 | ... break |
|
775 | ... break | |
776 | >>> check(earlycrash, server.connect) |
|
776 | >>> check(earlycrash, server.connect) | |
777 | e, 'Traceback (most recent call last):\n' |
|
777 | e, 'Traceback (most recent call last):\n' | |
778 | e, "IOError: *" (glob) |
|
778 | e, "IOError: *" (glob) | |
779 | >>> server.shutdown() |
|
779 | >>> server.shutdown() | |
780 |
|
780 | |||
781 | $ cat .hg/server.log | grep -v '^ ' |
|
781 | $ cat .hg/server.log | grep -v '^ ' | |
782 | listening at .hg/server.sock |
|
782 | listening at .hg/server.sock | |
783 | Traceback (most recent call last): |
|
783 | Traceback (most recent call last): | |
784 | IOError: * (glob) |
|
784 | IOError: * (glob) | |
785 | killed! |
|
785 | killed! | |
786 | #endif |
|
786 | #endif | |
787 | #if no-unix-socket |
|
787 | #if no-unix-socket | |
788 |
|
788 | |||
789 | $ hg serve --cmdserver unix -a .hg/server.sock |
|
789 | $ hg serve --cmdserver unix -a .hg/server.sock | |
790 | abort: unsupported platform |
|
790 | abort: unsupported platform | |
791 | [255] |
|
791 | [255] | |
792 |
|
792 | |||
793 | #endif |
|
793 | #endif | |
794 |
|
794 | |||
795 | $ cd .. |
|
795 | $ cd .. | |
796 |
|
796 | |||
797 | Test that accessing to invalid changelog cache is avoided at |
|
797 | Test that accessing to invalid changelog cache is avoided at | |
798 | subsequent operations even if repo object is reused even after failure |
|
798 | subsequent operations even if repo object is reused even after failure | |
799 | of transaction (see 0a7610758c42 also) |
|
799 | of transaction (see 0a7610758c42 also) | |
800 |
|
800 | |||
801 | "hg log" after failure of transaction is needed to detect invalid |
|
801 | "hg log" after failure of transaction is needed to detect invalid | |
802 | cache in repoview: this can't detect by "hg verify" only. |
|
802 | cache in repoview: this can't detect by "hg verify" only. | |
803 |
|
803 | |||
804 | Combination of "finalization" and "empty-ness of changelog" (2 x 2 = |
|
804 | Combination of "finalization" and "empty-ness of changelog" (2 x 2 = | |
805 | 4) are tested, because '00changelog.i' are differently changed in each |
|
805 | 4) are tested, because '00changelog.i' are differently changed in each | |
806 | cases. |
|
806 | cases. | |
807 |
|
807 | |||
808 | $ cat > $TESTTMP/failafterfinalize.py <<EOF |
|
808 | $ cat > $TESTTMP/failafterfinalize.py <<EOF | |
809 | > # extension to abort transaction after finalization forcibly |
|
809 | > # extension to abort transaction after finalization forcibly | |
810 | > from mercurial import commands, error, extensions, lock as lockmod |
|
810 | > from mercurial import commands, error, extensions, lock as lockmod | |
|
811 | > from mercurial import registrar | |||
|
812 | > cmdtable = {} | |||
|
813 | > command = registrar.command(cmdtable) | |||
|
814 | > configtable = {} | |||
|
815 | > configitem = registrar.configitem(configtable) | |||
|
816 | > configitem('failafterfinalize', 'fail', | |||
|
817 | > default=None, | |||
|
818 | > ) | |||
811 | > def fail(tr): |
|
819 | > def fail(tr): | |
812 | > raise error.Abort('fail after finalization') |
|
820 | > raise error.Abort('fail after finalization') | |
813 | > def reposetup(ui, repo): |
|
821 | > def reposetup(ui, repo): | |
814 | > class failrepo(repo.__class__): |
|
822 | > class failrepo(repo.__class__): | |
815 | > def commitctx(self, ctx, error=False): |
|
823 | > def commitctx(self, ctx, error=False): | |
816 | > if self.ui.configbool('failafterfinalize', 'fail'): |
|
824 | > if self.ui.configbool('failafterfinalize', 'fail'): | |
817 | > # 'sorted()' by ASCII code on category names causes |
|
825 | > # 'sorted()' by ASCII code on category names causes | |
818 | > # invoking 'fail' after finalization of changelog |
|
826 | > # invoking 'fail' after finalization of changelog | |
819 | > # using "'cl-%i' % id(self)" as category name |
|
827 | > # using "'cl-%i' % id(self)" as category name | |
820 | > self.currenttransaction().addfinalize('zzzzzzzz', fail) |
|
828 | > self.currenttransaction().addfinalize('zzzzzzzz', fail) | |
821 | > return super(failrepo, self).commitctx(ctx, error) |
|
829 | > return super(failrepo, self).commitctx(ctx, error) | |
822 | > repo.__class__ = failrepo |
|
830 | > repo.__class__ = failrepo | |
823 | > EOF |
|
831 | > EOF | |
824 |
|
832 | |||
825 | $ hg init repo3 |
|
833 | $ hg init repo3 | |
826 | $ cd repo3 |
|
834 | $ cd repo3 | |
827 |
|
835 | |||
828 | $ cat <<EOF >> $HGRCPATH |
|
836 | $ cat <<EOF >> $HGRCPATH | |
829 | > [ui] |
|
837 | > [ui] | |
830 | > logtemplate = {rev} {desc|firstline} ({files})\n |
|
838 | > logtemplate = {rev} {desc|firstline} ({files})\n | |
831 | > |
|
839 | > | |
832 | > [extensions] |
|
840 | > [extensions] | |
833 | > failafterfinalize = $TESTTMP/failafterfinalize.py |
|
841 | > failafterfinalize = $TESTTMP/failafterfinalize.py | |
834 | > EOF |
|
842 | > EOF | |
835 |
|
843 | |||
836 | - test failure with "empty changelog" |
|
844 | - test failure with "empty changelog" | |
837 |
|
845 | |||
838 | $ echo foo > foo |
|
846 | $ echo foo > foo | |
839 | $ hg add foo |
|
847 | $ hg add foo | |
840 |
|
848 | |||
841 | (failure before finalization) |
|
849 | (failure before finalization) | |
842 |
|
850 | |||
843 | >>> from hgclient import check, readchannel, runcommand |
|
851 | >>> from hgclient import check, readchannel, runcommand | |
844 | >>> @check |
|
852 | >>> @check | |
845 | ... def abort(server): |
|
853 | ... def abort(server): | |
846 | ... readchannel(server) |
|
854 | ... readchannel(server) | |
847 | ... runcommand(server, ['commit', |
|
855 | ... runcommand(server, ['commit', | |
848 | ... '--config', 'hooks.pretxncommit=false', |
|
856 | ... '--config', 'hooks.pretxncommit=false', | |
849 | ... '-mfoo']) |
|
857 | ... '-mfoo']) | |
850 | ... runcommand(server, ['log']) |
|
858 | ... runcommand(server, ['log']) | |
851 | ... runcommand(server, ['verify', '-q']) |
|
859 | ... runcommand(server, ['verify', '-q']) | |
852 | *** runcommand commit --config hooks.pretxncommit=false -mfoo |
|
860 | *** runcommand commit --config hooks.pretxncommit=false -mfoo | |
853 | transaction abort! |
|
861 | transaction abort! | |
854 | rollback completed |
|
862 | rollback completed | |
855 | abort: pretxncommit hook exited with status 1 |
|
863 | abort: pretxncommit hook exited with status 1 | |
856 | [255] |
|
864 | [255] | |
857 | *** runcommand log |
|
865 | *** runcommand log | |
858 | *** runcommand verify -q |
|
866 | *** runcommand verify -q | |
859 |
|
867 | |||
860 | (failure after finalization) |
|
868 | (failure after finalization) | |
861 |
|
869 | |||
862 | >>> from hgclient import check, readchannel, runcommand |
|
870 | >>> from hgclient import check, readchannel, runcommand | |
863 | >>> @check |
|
871 | >>> @check | |
864 | ... def abort(server): |
|
872 | ... def abort(server): | |
865 | ... readchannel(server) |
|
873 | ... readchannel(server) | |
866 | ... runcommand(server, ['commit', |
|
874 | ... runcommand(server, ['commit', | |
867 | ... '--config', 'failafterfinalize.fail=true', |
|
875 | ... '--config', 'failafterfinalize.fail=true', | |
868 | ... '-mfoo']) |
|
876 | ... '-mfoo']) | |
869 | ... runcommand(server, ['log']) |
|
877 | ... runcommand(server, ['log']) | |
870 | ... runcommand(server, ['verify', '-q']) |
|
878 | ... runcommand(server, ['verify', '-q']) | |
871 | *** runcommand commit --config failafterfinalize.fail=true -mfoo |
|
879 | *** runcommand commit --config failafterfinalize.fail=true -mfoo | |
872 | transaction abort! |
|
880 | transaction abort! | |
873 | rollback completed |
|
881 | rollback completed | |
874 | abort: fail after finalization |
|
882 | abort: fail after finalization | |
875 | [255] |
|
883 | [255] | |
876 | *** runcommand log |
|
884 | *** runcommand log | |
877 | *** runcommand verify -q |
|
885 | *** runcommand verify -q | |
878 |
|
886 | |||
879 | - test failure with "not-empty changelog" |
|
887 | - test failure with "not-empty changelog" | |
880 |
|
888 | |||
881 | $ echo bar > bar |
|
889 | $ echo bar > bar | |
882 | $ hg add bar |
|
890 | $ hg add bar | |
883 | $ hg commit -mbar bar |
|
891 | $ hg commit -mbar bar | |
884 |
|
892 | |||
885 | (failure before finalization) |
|
893 | (failure before finalization) | |
886 |
|
894 | |||
887 | >>> from hgclient import check, readchannel, runcommand |
|
895 | >>> from hgclient import check, readchannel, runcommand | |
888 | >>> @check |
|
896 | >>> @check | |
889 | ... def abort(server): |
|
897 | ... def abort(server): | |
890 | ... readchannel(server) |
|
898 | ... readchannel(server) | |
891 | ... runcommand(server, ['commit', |
|
899 | ... runcommand(server, ['commit', | |
892 | ... '--config', 'hooks.pretxncommit=false', |
|
900 | ... '--config', 'hooks.pretxncommit=false', | |
893 | ... '-mfoo', 'foo']) |
|
901 | ... '-mfoo', 'foo']) | |
894 | ... runcommand(server, ['log']) |
|
902 | ... runcommand(server, ['log']) | |
895 | ... runcommand(server, ['verify', '-q']) |
|
903 | ... runcommand(server, ['verify', '-q']) | |
896 | *** runcommand commit --config hooks.pretxncommit=false -mfoo foo |
|
904 | *** runcommand commit --config hooks.pretxncommit=false -mfoo foo | |
897 | transaction abort! |
|
905 | transaction abort! | |
898 | rollback completed |
|
906 | rollback completed | |
899 | abort: pretxncommit hook exited with status 1 |
|
907 | abort: pretxncommit hook exited with status 1 | |
900 | [255] |
|
908 | [255] | |
901 | *** runcommand log |
|
909 | *** runcommand log | |
902 | 0 bar (bar) |
|
910 | 0 bar (bar) | |
903 | *** runcommand verify -q |
|
911 | *** runcommand verify -q | |
904 |
|
912 | |||
905 | (failure after finalization) |
|
913 | (failure after finalization) | |
906 |
|
914 | |||
907 | >>> from hgclient import check, readchannel, runcommand |
|
915 | >>> from hgclient import check, readchannel, runcommand | |
908 | >>> @check |
|
916 | >>> @check | |
909 | ... def abort(server): |
|
917 | ... def abort(server): | |
910 | ... readchannel(server) |
|
918 | ... readchannel(server) | |
911 | ... runcommand(server, ['commit', |
|
919 | ... runcommand(server, ['commit', | |
912 | ... '--config', 'failafterfinalize.fail=true', |
|
920 | ... '--config', 'failafterfinalize.fail=true', | |
913 | ... '-mfoo', 'foo']) |
|
921 | ... '-mfoo', 'foo']) | |
914 | ... runcommand(server, ['log']) |
|
922 | ... runcommand(server, ['log']) | |
915 | ... runcommand(server, ['verify', '-q']) |
|
923 | ... runcommand(server, ['verify', '-q']) | |
916 | *** runcommand commit --config failafterfinalize.fail=true -mfoo foo |
|
924 | *** runcommand commit --config failafterfinalize.fail=true -mfoo foo | |
917 | transaction abort! |
|
925 | transaction abort! | |
918 | rollback completed |
|
926 | rollback completed | |
919 | abort: fail after finalization |
|
927 | abort: fail after finalization | |
920 | [255] |
|
928 | [255] | |
921 | *** runcommand log |
|
929 | *** runcommand log | |
922 | 0 bar (bar) |
|
930 | 0 bar (bar) | |
923 | *** runcommand verify -q |
|
931 | *** runcommand verify -q | |
924 |
|
932 | |||
925 | $ cd .. |
|
933 | $ cd .. | |
926 |
|
934 | |||
927 | Test symlink traversal over cached audited paths: |
|
935 | Test symlink traversal over cached audited paths: | |
928 | ------------------------------------------------- |
|
936 | ------------------------------------------------- | |
929 |
|
937 | |||
930 | #if symlink |
|
938 | #if symlink | |
931 |
|
939 | |||
932 | set up symlink hell |
|
940 | set up symlink hell | |
933 |
|
941 | |||
934 | $ mkdir merge-symlink-out |
|
942 | $ mkdir merge-symlink-out | |
935 | $ hg init merge-symlink |
|
943 | $ hg init merge-symlink | |
936 | $ cd merge-symlink |
|
944 | $ cd merge-symlink | |
937 | $ touch base |
|
945 | $ touch base | |
938 | $ hg commit -qAm base |
|
946 | $ hg commit -qAm base | |
939 | $ ln -s ../merge-symlink-out a |
|
947 | $ ln -s ../merge-symlink-out a | |
940 | $ hg commit -qAm 'symlink a -> ../merge-symlink-out' |
|
948 | $ hg commit -qAm 'symlink a -> ../merge-symlink-out' | |
941 | $ hg up -q 0 |
|
949 | $ hg up -q 0 | |
942 | $ mkdir a |
|
950 | $ mkdir a | |
943 | $ touch a/poisoned |
|
951 | $ touch a/poisoned | |
944 | $ hg commit -qAm 'file a/poisoned' |
|
952 | $ hg commit -qAm 'file a/poisoned' | |
945 | $ hg log -G -T '{rev}: {desc}\n' |
|
953 | $ hg log -G -T '{rev}: {desc}\n' | |
946 | @ 2: file a/poisoned |
|
954 | @ 2: file a/poisoned | |
947 | | |
|
955 | | | |
948 | | o 1: symlink a -> ../merge-symlink-out |
|
956 | | o 1: symlink a -> ../merge-symlink-out | |
949 | |/ |
|
957 | |/ | |
950 | o 0: base |
|
958 | o 0: base | |
951 |
|
959 | |||
952 |
|
960 | |||
953 | try trivial merge after update: cache of audited paths should be discarded, |
|
961 | try trivial merge after update: cache of audited paths should be discarded, | |
954 | and the merge should fail (issue5628) |
|
962 | and the merge should fail (issue5628) | |
955 |
|
963 | |||
956 | $ hg up -q null |
|
964 | $ hg up -q null | |
957 | >>> from hgclient import check, readchannel, runcommand |
|
965 | >>> from hgclient import check, readchannel, runcommand | |
958 | >>> @check |
|
966 | >>> @check | |
959 | ... def merge(server): |
|
967 | ... def merge(server): | |
960 | ... readchannel(server) |
|
968 | ... readchannel(server) | |
961 | ... # audit a/poisoned as a good path |
|
969 | ... # audit a/poisoned as a good path | |
962 | ... runcommand(server, ['up', '-qC', '2']) |
|
970 | ... runcommand(server, ['up', '-qC', '2']) | |
963 | ... runcommand(server, ['up', '-qC', '1']) |
|
971 | ... runcommand(server, ['up', '-qC', '1']) | |
964 | ... # here a is a symlink, so a/poisoned is bad |
|
972 | ... # here a is a symlink, so a/poisoned is bad | |
965 | ... runcommand(server, ['merge', '2']) |
|
973 | ... runcommand(server, ['merge', '2']) | |
966 | *** runcommand up -qC 2 |
|
974 | *** runcommand up -qC 2 | |
967 | *** runcommand up -qC 1 |
|
975 | *** runcommand up -qC 1 | |
968 | *** runcommand merge 2 |
|
976 | *** runcommand merge 2 | |
969 | a: path conflict - a file or link has the same name as a directory |
|
977 | a: path conflict - a file or link has the same name as a directory | |
970 | the local file has been renamed to a~aa04623eb0c3 |
|
978 | the local file has been renamed to a~aa04623eb0c3 | |
971 | resolve manually then use 'hg resolve --mark a' |
|
979 | resolve manually then use 'hg resolve --mark a' | |
972 | 1 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
980 | 1 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
973 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
981 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | |
974 | [1] |
|
982 | [1] | |
975 | $ ls ../merge-symlink-out |
|
983 | $ ls ../merge-symlink-out | |
976 |
|
984 | |||
977 | cache of repo.auditor should be discarded, so matcher would never traverse |
|
985 | cache of repo.auditor should be discarded, so matcher would never traverse | |
978 | symlinks: |
|
986 | symlinks: | |
979 |
|
987 | |||
980 | $ hg up -qC 0 |
|
988 | $ hg up -qC 0 | |
981 | $ touch ../merge-symlink-out/poisoned |
|
989 | $ touch ../merge-symlink-out/poisoned | |
982 | >>> from hgclient import check, readchannel, runcommand |
|
990 | >>> from hgclient import check, readchannel, runcommand | |
983 | >>> @check |
|
991 | >>> @check | |
984 | ... def files(server): |
|
992 | ... def files(server): | |
985 | ... readchannel(server) |
|
993 | ... readchannel(server) | |
986 | ... runcommand(server, ['up', '-qC', '2']) |
|
994 | ... runcommand(server, ['up', '-qC', '2']) | |
987 | ... # audit a/poisoned as a good path |
|
995 | ... # audit a/poisoned as a good path | |
988 | ... runcommand(server, ['files', 'a/poisoned']) |
|
996 | ... runcommand(server, ['files', 'a/poisoned']) | |
989 | ... runcommand(server, ['up', '-qC', '0']) |
|
997 | ... runcommand(server, ['up', '-qC', '0']) | |
990 | ... runcommand(server, ['up', '-qC', '1']) |
|
998 | ... runcommand(server, ['up', '-qC', '1']) | |
991 | ... # here 'a' is a symlink, so a/poisoned should be warned |
|
999 | ... # here 'a' is a symlink, so a/poisoned should be warned | |
992 | ... runcommand(server, ['files', 'a/poisoned']) |
|
1000 | ... runcommand(server, ['files', 'a/poisoned']) | |
993 | *** runcommand up -qC 2 |
|
1001 | *** runcommand up -qC 2 | |
994 | *** runcommand files a/poisoned |
|
1002 | *** runcommand files a/poisoned | |
995 | a/poisoned |
|
1003 | a/poisoned | |
996 | *** runcommand up -qC 0 |
|
1004 | *** runcommand up -qC 0 | |
997 | *** runcommand up -qC 1 |
|
1005 | *** runcommand up -qC 1 | |
998 | *** runcommand files a/poisoned |
|
1006 | *** runcommand files a/poisoned | |
999 | abort: path 'a/poisoned' traverses symbolic link 'a' |
|
1007 | abort: path 'a/poisoned' traverses symbolic link 'a' | |
1000 | [255] |
|
1008 | [255] | |
1001 |
|
1009 | |||
1002 | $ cd .. |
|
1010 | $ cd .. | |
1003 |
|
1011 | |||
1004 | #endif |
|
1012 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now