Show More
@@ -1,1809 +1,1809 b'' | |||||
1 | Set up a repo |
|
1 | Set up a repo | |
2 |
|
2 | |||
3 | $ cat <<EOF >> $HGRCPATH |
|
3 | $ cat <<EOF >> $HGRCPATH | |
4 | > [ui] |
|
4 | > [ui] | |
5 | > interactive = true |
|
5 | > interactive = true | |
6 | > [extensions] |
|
6 | > [extensions] | |
7 | > record = |
|
7 | > record = | |
8 | > EOF |
|
8 | > EOF | |
9 |
|
9 | |||
10 | $ hg init a |
|
10 | $ hg init a | |
11 | $ cd a |
|
11 | $ cd a | |
12 |
|
12 | |||
13 | Select no files |
|
13 | Select no files | |
14 |
|
14 | |||
15 | $ touch empty-rw |
|
15 | $ touch empty-rw | |
16 | $ hg add empty-rw |
|
16 | $ hg add empty-rw | |
17 |
|
17 | |||
18 | $ hg record --config ui.interactive=false |
|
18 | $ hg record --config ui.interactive=false | |
19 | abort: running non-interactively, use commit instead |
|
19 | abort: running non-interactively, use commit instead | |
20 | [255] |
|
20 | [255] | |
21 | $ hg commit -i --config ui.interactive=false |
|
21 | $ hg commit -i --config ui.interactive=false | |
22 | abort: running non-interactively |
|
22 | abort: running non-interactively | |
23 | [255] |
|
23 | [255] | |
24 | $ hg commit -i empty-rw<<EOF |
|
24 | $ hg commit -i empty-rw<<EOF | |
25 | > n |
|
25 | > n | |
26 | > EOF |
|
26 | > EOF | |
27 | diff --git a/empty-rw b/empty-rw |
|
27 | diff --git a/empty-rw b/empty-rw | |
28 | new file mode 100644 |
|
28 | new file mode 100644 | |
29 | examine changes to 'empty-rw'? [Ynesfdaq?] n |
|
29 | examine changes to 'empty-rw'? [Ynesfdaq?] n | |
30 |
|
30 | |||
31 | no changes to record |
|
31 | no changes to record | |
32 | [1] |
|
32 | [1] | |
33 |
|
33 | |||
34 | $ hg tip -p |
|
34 | $ hg tip -p | |
35 | changeset: -1:000000000000 |
|
35 | changeset: -1:000000000000 | |
36 | tag: tip |
|
36 | tag: tip | |
37 | user: |
|
37 | user: | |
38 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
38 | date: Thu Jan 01 00:00:00 1970 +0000 | |
39 |
|
39 | |||
40 |
|
40 | |||
41 |
|
41 | |||
42 | Select files but no hunks |
|
42 | Select files but no hunks | |
43 |
|
43 | |||
44 | $ hg commit -i empty-rw<<EOF |
|
44 | $ hg commit -i empty-rw<<EOF | |
45 | > y |
|
45 | > y | |
46 | > n |
|
46 | > n | |
47 | > EOF |
|
47 | > EOF | |
48 | diff --git a/empty-rw b/empty-rw |
|
48 | diff --git a/empty-rw b/empty-rw | |
49 | new file mode 100644 |
|
49 | new file mode 100644 | |
50 | examine changes to 'empty-rw'? [Ynesfdaq?] y |
|
50 | examine changes to 'empty-rw'? [Ynesfdaq?] y | |
51 |
|
51 | |||
52 | abort: empty commit message |
|
52 | abort: empty commit message | |
53 | [255] |
|
53 | [255] | |
54 |
|
54 | |||
55 | $ hg tip -p |
|
55 | $ hg tip -p | |
56 | changeset: -1:000000000000 |
|
56 | changeset: -1:000000000000 | |
57 | tag: tip |
|
57 | tag: tip | |
58 | user: |
|
58 | user: | |
59 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
59 | date: Thu Jan 01 00:00:00 1970 +0000 | |
60 |
|
60 | |||
61 |
|
61 | |||
62 |
|
62 | |||
63 | Abort for untracked |
|
63 | Abort for untracked | |
64 |
|
64 | |||
65 | $ touch untracked |
|
65 | $ touch untracked | |
66 | $ hg commit -i -m should-fail empty-rw untracked |
|
66 | $ hg commit -i -m should-fail empty-rw untracked | |
67 | abort: untracked: file not tracked! |
|
67 | abort: untracked: file not tracked! | |
68 | [255] |
|
68 | [255] | |
69 | $ rm untracked |
|
69 | $ rm untracked | |
70 |
|
70 | |||
71 | Record empty file |
|
71 | Record empty file | |
72 |
|
72 | |||
73 | $ hg commit -i -d '0 0' -m empty empty-rw<<EOF |
|
73 | $ hg commit -i -d '0 0' -m empty empty-rw<<EOF | |
74 | > y |
|
74 | > y | |
75 | > y |
|
75 | > y | |
76 | > EOF |
|
76 | > EOF | |
77 | diff --git a/empty-rw b/empty-rw |
|
77 | diff --git a/empty-rw b/empty-rw | |
78 | new file mode 100644 |
|
78 | new file mode 100644 | |
79 | examine changes to 'empty-rw'? [Ynesfdaq?] y |
|
79 | examine changes to 'empty-rw'? [Ynesfdaq?] y | |
80 |
|
80 | |||
81 |
|
81 | |||
82 | $ hg tip -p |
|
82 | $ hg tip -p | |
83 | changeset: 0:c0708cf4e46e |
|
83 | changeset: 0:c0708cf4e46e | |
84 | tag: tip |
|
84 | tag: tip | |
85 | user: test |
|
85 | user: test | |
86 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
86 | date: Thu Jan 01 00:00:00 1970 +0000 | |
87 | summary: empty |
|
87 | summary: empty | |
88 |
|
88 | |||
89 |
|
89 | |||
90 |
|
90 | |||
91 | Summary shows we updated to the new cset |
|
91 | Summary shows we updated to the new cset | |
92 |
|
92 | |||
93 | $ hg summary |
|
93 | $ hg summary | |
94 | parent: 0:c0708cf4e46e tip |
|
94 | parent: 0:c0708cf4e46e tip | |
95 | empty |
|
95 | empty | |
96 | branch: default |
|
96 | branch: default | |
97 | commit: (clean) |
|
97 | commit: (clean) | |
98 | update: (current) |
|
98 | update: (current) | |
99 | phases: 1 draft |
|
99 | phases: 1 draft | |
100 |
|
100 | |||
101 | Rename empty file |
|
101 | Rename empty file | |
102 |
|
102 | |||
103 | $ hg mv empty-rw empty-rename |
|
103 | $ hg mv empty-rw empty-rename | |
104 | $ hg commit -i -d '1 0' -m rename<<EOF |
|
104 | $ hg commit -i -d '1 0' -m rename<<EOF | |
105 | > y |
|
105 | > y | |
106 | > EOF |
|
106 | > EOF | |
107 | diff --git a/empty-rw b/empty-rename |
|
107 | diff --git a/empty-rw b/empty-rename | |
108 | rename from empty-rw |
|
108 | rename from empty-rw | |
109 | rename to empty-rename |
|
109 | rename to empty-rename | |
110 | examine changes to 'empty-rw' and 'empty-rename'? [Ynesfdaq?] y |
|
110 | examine changes to 'empty-rw' and 'empty-rename'? [Ynesfdaq?] y | |
111 |
|
111 | |||
112 |
|
112 | |||
113 | $ hg tip -p |
|
113 | $ hg tip -p | |
114 | changeset: 1:d695e8dcb197 |
|
114 | changeset: 1:d695e8dcb197 | |
115 | tag: tip |
|
115 | tag: tip | |
116 | user: test |
|
116 | user: test | |
117 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
117 | date: Thu Jan 01 00:00:01 1970 +0000 | |
118 | summary: rename |
|
118 | summary: rename | |
119 |
|
119 | |||
120 |
|
120 | |||
121 |
|
121 | |||
122 | Copy empty file |
|
122 | Copy empty file | |
123 |
|
123 | |||
124 | $ hg cp empty-rename empty-copy |
|
124 | $ hg cp empty-rename empty-copy | |
125 | $ hg commit -i -d '2 0' -m copy<<EOF |
|
125 | $ hg commit -i -d '2 0' -m copy<<EOF | |
126 | > y |
|
126 | > y | |
127 | > EOF |
|
127 | > EOF | |
128 | diff --git a/empty-rename b/empty-copy |
|
128 | diff --git a/empty-rename b/empty-copy | |
129 | copy from empty-rename |
|
129 | copy from empty-rename | |
130 | copy to empty-copy |
|
130 | copy to empty-copy | |
131 | examine changes to 'empty-rename' and 'empty-copy'? [Ynesfdaq?] y |
|
131 | examine changes to 'empty-rename' and 'empty-copy'? [Ynesfdaq?] y | |
132 |
|
132 | |||
133 |
|
133 | |||
134 | $ hg tip -p |
|
134 | $ hg tip -p | |
135 | changeset: 2:1d4b90bea524 |
|
135 | changeset: 2:1d4b90bea524 | |
136 | tag: tip |
|
136 | tag: tip | |
137 | user: test |
|
137 | user: test | |
138 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
138 | date: Thu Jan 01 00:00:02 1970 +0000 | |
139 | summary: copy |
|
139 | summary: copy | |
140 |
|
140 | |||
141 |
|
141 | |||
142 |
|
142 | |||
143 | Delete empty file |
|
143 | Delete empty file | |
144 |
|
144 | |||
145 | $ hg rm empty-copy |
|
145 | $ hg rm empty-copy | |
146 | $ hg commit -i -d '3 0' -m delete<<EOF |
|
146 | $ hg commit -i -d '3 0' -m delete<<EOF | |
147 | > y |
|
147 | > y | |
148 | > EOF |
|
148 | > EOF | |
149 | diff --git a/empty-copy b/empty-copy |
|
149 | diff --git a/empty-copy b/empty-copy | |
150 | deleted file mode 100644 |
|
150 | deleted file mode 100644 | |
151 | examine changes to 'empty-copy'? [Ynesfdaq?] y |
|
151 | examine changes to 'empty-copy'? [Ynesfdaq?] y | |
152 |
|
152 | |||
153 |
|
153 | |||
154 | $ hg tip -p |
|
154 | $ hg tip -p | |
155 | changeset: 3:b39a238f01a1 |
|
155 | changeset: 3:b39a238f01a1 | |
156 | tag: tip |
|
156 | tag: tip | |
157 | user: test |
|
157 | user: test | |
158 | date: Thu Jan 01 00:00:03 1970 +0000 |
|
158 | date: Thu Jan 01 00:00:03 1970 +0000 | |
159 | summary: delete |
|
159 | summary: delete | |
160 |
|
160 | |||
161 |
|
161 | |||
162 |
|
162 | |||
163 | Add binary file |
|
163 | Add binary file | |
164 |
|
164 | |||
165 | $ hg bundle --type v1 --base -2 tip.bundle |
|
165 | $ hg bundle --type v1 --base -2 tip.bundle | |
166 | 1 changesets found |
|
166 | 1 changesets found | |
167 | $ hg add tip.bundle |
|
167 | $ hg add tip.bundle | |
168 | $ hg commit -i -d '4 0' -m binary<<EOF |
|
168 | $ hg commit -i -d '4 0' -m binary<<EOF | |
169 | > y |
|
169 | > y | |
170 | > EOF |
|
170 | > EOF | |
171 | diff --git a/tip.bundle b/tip.bundle |
|
171 | diff --git a/tip.bundle b/tip.bundle | |
172 | new file mode 100644 |
|
172 | new file mode 100644 | |
173 | this is a binary file |
|
173 | this is a binary file | |
174 | examine changes to 'tip.bundle'? [Ynesfdaq?] y |
|
174 | examine changes to 'tip.bundle'? [Ynesfdaq?] y | |
175 |
|
175 | |||
176 |
|
176 | |||
177 | $ hg tip -p |
|
177 | $ hg tip -p | |
178 | changeset: 4:ad816da3711e |
|
178 | changeset: 4:ad816da3711e | |
179 | tag: tip |
|
179 | tag: tip | |
180 | user: test |
|
180 | user: test | |
181 | date: Thu Jan 01 00:00:04 1970 +0000 |
|
181 | date: Thu Jan 01 00:00:04 1970 +0000 | |
182 | summary: binary |
|
182 | summary: binary | |
183 |
|
183 | |||
184 | diff -r b39a238f01a1 -r ad816da3711e tip.bundle |
|
184 | diff -r b39a238f01a1 -r ad816da3711e tip.bundle | |
185 | Binary file tip.bundle has changed |
|
185 | Binary file tip.bundle has changed | |
186 |
|
186 | |||
187 |
|
187 | |||
188 | Change binary file |
|
188 | Change binary file | |
189 |
|
189 | |||
190 | $ hg bundle --base -2 --type v1 tip.bundle |
|
190 | $ hg bundle --base -2 --type v1 tip.bundle | |
191 | 1 changesets found |
|
191 | 1 changesets found | |
192 | $ hg commit -i -d '5 0' -m binary-change<<EOF |
|
192 | $ hg commit -i -d '5 0' -m binary-change<<EOF | |
193 | > y |
|
193 | > y | |
194 | > EOF |
|
194 | > EOF | |
195 | diff --git a/tip.bundle b/tip.bundle |
|
195 | diff --git a/tip.bundle b/tip.bundle | |
196 | this modifies a binary file (all or nothing) |
|
196 | this modifies a binary file (all or nothing) | |
197 | examine changes to 'tip.bundle'? [Ynesfdaq?] y |
|
197 | examine changes to 'tip.bundle'? [Ynesfdaq?] y | |
198 |
|
198 | |||
199 |
|
199 | |||
200 | $ hg tip -p |
|
200 | $ hg tip -p | |
201 | changeset: 5:dccd6f3eb485 |
|
201 | changeset: 5:dccd6f3eb485 | |
202 | tag: tip |
|
202 | tag: tip | |
203 | user: test |
|
203 | user: test | |
204 | date: Thu Jan 01 00:00:05 1970 +0000 |
|
204 | date: Thu Jan 01 00:00:05 1970 +0000 | |
205 | summary: binary-change |
|
205 | summary: binary-change | |
206 |
|
206 | |||
207 | diff -r ad816da3711e -r dccd6f3eb485 tip.bundle |
|
207 | diff -r ad816da3711e -r dccd6f3eb485 tip.bundle | |
208 | Binary file tip.bundle has changed |
|
208 | Binary file tip.bundle has changed | |
209 |
|
209 | |||
210 |
|
210 | |||
211 | Rename and change binary file |
|
211 | Rename and change binary file | |
212 |
|
212 | |||
213 | $ hg mv tip.bundle top.bundle |
|
213 | $ hg mv tip.bundle top.bundle | |
214 | $ hg bundle --base -2 --type v1 top.bundle |
|
214 | $ hg bundle --base -2 --type v1 top.bundle | |
215 | 1 changesets found |
|
215 | 1 changesets found | |
216 | $ hg commit -i -d '6 0' -m binary-change-rename<<EOF |
|
216 | $ hg commit -i -d '6 0' -m binary-change-rename<<EOF | |
217 | > y |
|
217 | > y | |
218 | > EOF |
|
218 | > EOF | |
219 | diff --git a/tip.bundle b/top.bundle |
|
219 | diff --git a/tip.bundle b/top.bundle | |
220 | rename from tip.bundle |
|
220 | rename from tip.bundle | |
221 | rename to top.bundle |
|
221 | rename to top.bundle | |
222 | this modifies a binary file (all or nothing) |
|
222 | this modifies a binary file (all or nothing) | |
223 | examine changes to 'tip.bundle' and 'top.bundle'? [Ynesfdaq?] y |
|
223 | examine changes to 'tip.bundle' and 'top.bundle'? [Ynesfdaq?] y | |
224 |
|
224 | |||
225 |
|
225 | |||
226 | $ hg tip -p |
|
226 | $ hg tip -p | |
227 | changeset: 6:7fa44105f5b3 |
|
227 | changeset: 6:7fa44105f5b3 | |
228 | tag: tip |
|
228 | tag: tip | |
229 | user: test |
|
229 | user: test | |
230 | date: Thu Jan 01 00:00:06 1970 +0000 |
|
230 | date: Thu Jan 01 00:00:06 1970 +0000 | |
231 | summary: binary-change-rename |
|
231 | summary: binary-change-rename | |
232 |
|
232 | |||
233 | diff -r dccd6f3eb485 -r 7fa44105f5b3 tip.bundle |
|
233 | diff -r dccd6f3eb485 -r 7fa44105f5b3 tip.bundle | |
234 | Binary file tip.bundle has changed |
|
234 | Binary file tip.bundle has changed | |
235 | diff -r dccd6f3eb485 -r 7fa44105f5b3 top.bundle |
|
235 | diff -r dccd6f3eb485 -r 7fa44105f5b3 top.bundle | |
236 | Binary file top.bundle has changed |
|
236 | Binary file top.bundle has changed | |
237 |
|
237 | |||
238 |
|
238 | |||
239 | Add plain file |
|
239 | Add plain file | |
240 |
|
240 | |||
241 | $ for i in 1 2 3 4 5 6 7 8 9 10; do |
|
241 | $ for i in 1 2 3 4 5 6 7 8 9 10; do | |
242 | > echo $i >> plain |
|
242 | > echo $i >> plain | |
243 | > done |
|
243 | > done | |
244 |
|
244 | |||
245 | $ hg add plain |
|
245 | $ hg add plain | |
246 | $ hg commit -i -d '7 0' -m plain plain<<EOF |
|
246 | $ hg commit -i -d '7 0' -m plain plain<<EOF | |
247 | > y |
|
247 | > y | |
248 | > y |
|
248 | > y | |
249 | > EOF |
|
249 | > EOF | |
250 | diff --git a/plain b/plain |
|
250 | diff --git a/plain b/plain | |
251 | new file mode 100644 |
|
251 | new file mode 100644 | |
252 | examine changes to 'plain'? [Ynesfdaq?] y |
|
252 | examine changes to 'plain'? [Ynesfdaq?] y | |
253 |
|
253 | |||
254 | @@ -0,0 +1,10 @@ |
|
254 | @@ -0,0 +1,10 @@ | |
255 | +1 |
|
255 | +1 | |
256 | +2 |
|
256 | +2 | |
257 | +3 |
|
257 | +3 | |
258 | +4 |
|
258 | +4 | |
259 | +5 |
|
259 | +5 | |
260 | +6 |
|
260 | +6 | |
261 | +7 |
|
261 | +7 | |
262 | +8 |
|
262 | +8 | |
263 | +9 |
|
263 | +9 | |
264 | +10 |
|
264 | +10 | |
265 | record this change to 'plain'? [Ynesfdaq?] y |
|
265 | record this change to 'plain'? [Ynesfdaq?] y | |
266 |
|
266 | |||
267 | $ hg tip -p |
|
267 | $ hg tip -p | |
268 | changeset: 7:11fb457c1be4 |
|
268 | changeset: 7:11fb457c1be4 | |
269 | tag: tip |
|
269 | tag: tip | |
270 | user: test |
|
270 | user: test | |
271 | date: Thu Jan 01 00:00:07 1970 +0000 |
|
271 | date: Thu Jan 01 00:00:07 1970 +0000 | |
272 | summary: plain |
|
272 | summary: plain | |
273 |
|
273 | |||
274 | diff -r 7fa44105f5b3 -r 11fb457c1be4 plain |
|
274 | diff -r 7fa44105f5b3 -r 11fb457c1be4 plain | |
275 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
275 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
276 | +++ b/plain Thu Jan 01 00:00:07 1970 +0000 |
|
276 | +++ b/plain Thu Jan 01 00:00:07 1970 +0000 | |
277 | @@ -0,0 +1,10 @@ |
|
277 | @@ -0,0 +1,10 @@ | |
278 | +1 |
|
278 | +1 | |
279 | +2 |
|
279 | +2 | |
280 | +3 |
|
280 | +3 | |
281 | +4 |
|
281 | +4 | |
282 | +5 |
|
282 | +5 | |
283 | +6 |
|
283 | +6 | |
284 | +7 |
|
284 | +7 | |
285 | +8 |
|
285 | +8 | |
286 | +9 |
|
286 | +9 | |
287 | +10 |
|
287 | +10 | |
288 |
|
288 | |||
289 | Modify end of plain file with username unset |
|
289 | Modify end of plain file with username unset | |
290 |
|
290 | |||
291 | $ echo 11 >> plain |
|
291 | $ echo 11 >> plain | |
292 | $ unset HGUSER |
|
292 | $ unset HGUSER | |
293 | $ hg commit -i --config ui.username= -d '8 0' -m end plain |
|
293 | $ hg commit -i --config ui.username= -d '8 0' -m end plain | |
294 | abort: no username supplied |
|
294 | abort: no username supplied | |
295 | (use 'hg config --edit' to set your username) |
|
295 | (use 'hg config --edit' to set your username) | |
296 | [255] |
|
296 | [255] | |
297 |
|
297 | |||
298 |
|
298 | |||
299 | Modify end of plain file, also test that diffopts are accounted for |
|
299 | Modify end of plain file, also test that diffopts are accounted for | |
300 |
|
300 | |||
301 | $ HGUSER="test" |
|
301 | $ HGUSER="test" | |
302 | $ export HGUSER |
|
302 | $ export HGUSER | |
303 | $ hg commit -i --config diff.showfunc=true -d '8 0' -m end plain <<EOF |
|
303 | $ hg commit -i --config diff.showfunc=true -d '8 0' -m end plain <<EOF | |
304 | > y |
|
304 | > y | |
305 | > y |
|
305 | > y | |
306 | > EOF |
|
306 | > EOF | |
307 | diff --git a/plain b/plain |
|
307 | diff --git a/plain b/plain | |
308 | 1 hunks, 1 lines changed |
|
308 | 1 hunks, 1 lines changed | |
309 | examine changes to 'plain'? [Ynesfdaq?] y |
|
309 | examine changes to 'plain'? [Ynesfdaq?] y | |
310 |
|
310 | |||
311 | @@ -8,3 +8,4 @@ 7 |
|
311 | @@ -8,3 +8,4 @@ 7 | |
312 | 8 |
|
312 | 8 | |
313 | 9 |
|
313 | 9 | |
314 | 10 |
|
314 | 10 | |
315 | +11 |
|
315 | +11 | |
316 | record this change to 'plain'? [Ynesfdaq?] y |
|
316 | record this change to 'plain'? [Ynesfdaq?] y | |
317 |
|
317 | |||
318 |
|
318 | |||
319 | Modify end of plain file, no EOL |
|
319 | Modify end of plain file, no EOL | |
320 |
|
320 | |||
321 | $ hg tip --template '{node}' >> plain |
|
321 | $ hg tip --template '{node}' >> plain | |
322 | $ hg commit -i -d '9 0' -m noeol plain <<EOF |
|
322 | $ hg commit -i -d '9 0' -m noeol plain <<EOF | |
323 | > y |
|
323 | > y | |
324 | > y |
|
324 | > y | |
325 | > EOF |
|
325 | > EOF | |
326 | diff --git a/plain b/plain |
|
326 | diff --git a/plain b/plain | |
327 | 1 hunks, 1 lines changed |
|
327 | 1 hunks, 1 lines changed | |
328 | examine changes to 'plain'? [Ynesfdaq?] y |
|
328 | examine changes to 'plain'? [Ynesfdaq?] y | |
329 |
|
329 | |||
330 | @@ -9,3 +9,4 @@ 8 |
|
330 | @@ -9,3 +9,4 @@ 8 | |
331 | 9 |
|
331 | 9 | |
332 | 10 |
|
332 | 10 | |
333 | 11 |
|
333 | 11 | |
334 | +7264f99c5f5ff3261504828afa4fb4d406c3af54 |
|
334 | +7264f99c5f5ff3261504828afa4fb4d406c3af54 | |
335 | \ No newline at end of file |
|
335 | \ No newline at end of file | |
336 | record this change to 'plain'? [Ynesfdaq?] y |
|
336 | record this change to 'plain'? [Ynesfdaq?] y | |
337 |
|
337 | |||
338 |
|
338 | |||
339 | Record showfunc should preserve function across sections |
|
339 | Record showfunc should preserve function across sections | |
340 |
|
340 | |||
341 | $ cat > f1.py <<EOF |
|
341 | $ cat > f1.py <<NO_CHECK_EOF | |
342 | > def annotate(ui, repo, *pats, **opts): |
|
342 | > def annotate(ui, repo, *pats, **opts): | |
343 | > """show changeset information by line for each file |
|
343 | > """show changeset information by line for each file | |
344 | > |
|
344 | > | |
345 | > List changes in files, showing the revision id responsible for |
|
345 | > List changes in files, showing the revision id responsible for | |
346 | > each line. |
|
346 | > each line. | |
347 | > |
|
347 | > | |
348 | > This command is useful for discovering when a change was made and |
|
348 | > This command is useful for discovering when a change was made and | |
349 | > by whom. |
|
349 | > by whom. | |
350 | > |
|
350 | > | |
351 | > If you include -f/-u/-d, the revision number is suppressed unless |
|
351 | > If you include -f/-u/-d, the revision number is suppressed unless | |
352 | > you also include -the revision number is suppressed unless |
|
352 | > you also include -the revision number is suppressed unless | |
353 | > you also include -n. |
|
353 | > you also include -n. | |
354 | > |
|
354 | > | |
355 | > Without the -a/--text option, annotate will avoid processing files |
|
355 | > Without the -a/--text option, annotate will avoid processing files | |
356 | > it detects as binary. With -a, annotate will annotate the file |
|
356 | > it detects as binary. With -a, annotate will annotate the file | |
357 | > anyway, although the results will probably be neither useful |
|
357 | > anyway, although the results will probably be neither useful | |
358 | > nor desirable. |
|
358 | > nor desirable. | |
359 | > |
|
359 | > | |
360 | > Returns 0 on success. |
|
360 | > Returns 0 on success. | |
361 | > """ |
|
361 | > """ | |
362 | > return 0 |
|
362 | > return 0 | |
363 | > def archive(ui, repo, dest, **opts): |
|
363 | > def archive(ui, repo, dest, **opts): | |
364 | > '''create an unversioned archive of a repository revision |
|
364 | > '''create an unversioned archive of a repository revision | |
365 | > |
|
365 | > | |
366 | > By default, the revision used is the parent of the working |
|
366 | > By default, the revision used is the parent of the working | |
367 | > directory; use -r/--rev to specify a different revision. |
|
367 | > directory; use -r/--rev to specify a different revision. | |
368 | > |
|
368 | > | |
369 | > The archive type is automatically detected based on file |
|
369 | > The archive type is automatically detected based on file | |
370 | > extension (to override, use -t/--type). |
|
370 | > extension (to override, use -t/--type). | |
371 | > |
|
371 | > | |
372 | > .. container:: verbose |
|
372 | > .. container:: verbose | |
373 | > |
|
373 | > | |
374 | > Valid types are: |
|
374 | > Valid types are: | |
375 | > EOF |
|
375 | > NO_CHECK_EOF | |
376 | $ hg add f1.py |
|
376 | $ hg add f1.py | |
377 | $ hg commit -m funcs |
|
377 | $ hg commit -m funcs | |
378 | $ cat > f1.py <<EOF |
|
378 | $ cat > f1.py <<NO_CHECK_EOF | |
379 | > def annotate(ui, repo, *pats, **opts): |
|
379 | > def annotate(ui, repo, *pats, **opts): | |
380 | > """show changeset information by line for each file |
|
380 | > """show changeset information by line for each file | |
381 | > |
|
381 | > | |
382 | > List changes in files, showing the revision id responsible for |
|
382 | > List changes in files, showing the revision id responsible for | |
383 | > each line |
|
383 | > each line | |
384 | > |
|
384 | > | |
385 | > This command is useful for discovering when a change was made and |
|
385 | > This command is useful for discovering when a change was made and | |
386 | > by whom. |
|
386 | > by whom. | |
387 | > |
|
387 | > | |
388 | > Without the -a/--text option, annotate will avoid processing files |
|
388 | > Without the -a/--text option, annotate will avoid processing files | |
389 | > it detects as binary. With -a, annotate will annotate the file |
|
389 | > it detects as binary. With -a, annotate will annotate the file | |
390 | > anyway, although the results will probably be neither useful |
|
390 | > anyway, although the results will probably be neither useful | |
391 | > nor desirable. |
|
391 | > nor desirable. | |
392 | > |
|
392 | > | |
393 | > Returns 0 on success. |
|
393 | > Returns 0 on success. | |
394 | > """ |
|
394 | > """ | |
395 | > return 0 |
|
395 | > return 0 | |
396 | > def archive(ui, repo, dest, **opts): |
|
396 | > def archive(ui, repo, dest, **opts): | |
397 | > '''create an unversioned archive of a repository revision |
|
397 | > '''create an unversioned archive of a repository revision | |
398 | > |
|
398 | > | |
399 | > By default, the revision used is the parent of the working |
|
399 | > By default, the revision used is the parent of the working | |
400 | > directory; use -r/--rev to specify a different revision. |
|
400 | > directory; use -r/--rev to specify a different revision. | |
401 | > |
|
401 | > | |
402 | > The archive type is automatically detected based on file |
|
402 | > The archive type is automatically detected based on file | |
403 | > extension (or override using -t/--type). |
|
403 | > extension (or override using -t/--type). | |
404 | > |
|
404 | > | |
405 | > .. container:: verbose |
|
405 | > .. container:: verbose | |
406 | > |
|
406 | > | |
407 | > Valid types are: |
|
407 | > Valid types are: | |
408 | > EOF |
|
408 | > NO_CHECK_EOF | |
409 | $ hg commit -i -m interactive <<EOF |
|
409 | $ hg commit -i -m interactive <<EOF | |
410 | > y |
|
410 | > y | |
411 | > y |
|
411 | > y | |
412 | > y |
|
412 | > y | |
413 | > y |
|
413 | > y | |
414 | > EOF |
|
414 | > EOF | |
415 | diff --git a/f1.py b/f1.py |
|
415 | diff --git a/f1.py b/f1.py | |
416 | 3 hunks, 6 lines changed |
|
416 | 3 hunks, 6 lines changed | |
417 | examine changes to 'f1.py'? [Ynesfdaq?] y |
|
417 | examine changes to 'f1.py'? [Ynesfdaq?] y | |
418 |
|
418 | |||
419 | @@ -2,8 +2,8 @@ def annotate(ui, repo, *pats, **opts): |
|
419 | @@ -2,8 +2,8 @@ def annotate(ui, repo, *pats, **opts): | |
420 | """show changeset information by line for each file |
|
420 | """show changeset information by line for each file | |
421 |
|
421 | |||
422 | List changes in files, showing the revision id responsible for |
|
422 | List changes in files, showing the revision id responsible for | |
423 | - each line. |
|
423 | - each line. | |
424 | + each line |
|
424 | + each line | |
425 |
|
425 | |||
426 | This command is useful for discovering when a change was made and |
|
426 | This command is useful for discovering when a change was made and | |
427 | by whom. |
|
427 | by whom. | |
428 |
|
428 | |||
429 | record change 1/3 to 'f1.py'? [Ynesfdaq?] y |
|
429 | record change 1/3 to 'f1.py'? [Ynesfdaq?] y | |
430 |
|
430 | |||
431 | @@ -6,11 +6,7 @@ def annotate(ui, repo, *pats, **opts): |
|
431 | @@ -6,11 +6,7 @@ def annotate(ui, repo, *pats, **opts): | |
432 |
|
432 | |||
433 | This command is useful for discovering when a change was made and |
|
433 | This command is useful for discovering when a change was made and | |
434 | by whom. |
|
434 | by whom. | |
435 |
|
435 | |||
436 | - If you include -f/-u/-d, the revision number is suppressed unless |
|
436 | - If you include -f/-u/-d, the revision number is suppressed unless | |
437 | - you also include -the revision number is suppressed unless |
|
437 | - you also include -the revision number is suppressed unless | |
438 | - you also include -n. |
|
438 | - you also include -n. | |
439 | - |
|
439 | - | |
440 | Without the -a/--text option, annotate will avoid processing files |
|
440 | Without the -a/--text option, annotate will avoid processing files | |
441 | it detects as binary. With -a, annotate will annotate the file |
|
441 | it detects as binary. With -a, annotate will annotate the file | |
442 | anyway, although the results will probably be neither useful |
|
442 | anyway, although the results will probably be neither useful | |
443 | record change 2/3 to 'f1.py'? [Ynesfdaq?] y |
|
443 | record change 2/3 to 'f1.py'? [Ynesfdaq?] y | |
444 |
|
444 | |||
445 | @@ -26,7 +22,7 @@ def archive(ui, repo, dest, **opts): |
|
445 | @@ -26,7 +22,7 @@ def archive(ui, repo, dest, **opts): | |
446 | directory; use -r/--rev to specify a different revision. |
|
446 | directory; use -r/--rev to specify a different revision. | |
447 |
|
447 | |||
448 | The archive type is automatically detected based on file |
|
448 | The archive type is automatically detected based on file | |
449 | - extension (to override, use -t/--type). |
|
449 | - extension (to override, use -t/--type). | |
450 | + extension (or override using -t/--type). |
|
450 | + extension (or override using -t/--type). | |
451 |
|
451 | |||
452 | .. container:: verbose |
|
452 | .. container:: verbose | |
453 |
|
453 | |||
454 | record change 3/3 to 'f1.py'? [Ynesfdaq?] y |
|
454 | record change 3/3 to 'f1.py'? [Ynesfdaq?] y | |
455 |
|
455 | |||
456 |
|
456 | |||
457 | Modify end of plain file, add EOL |
|
457 | Modify end of plain file, add EOL | |
458 |
|
458 | |||
459 | $ echo >> plain |
|
459 | $ echo >> plain | |
460 | $ echo 1 > plain2 |
|
460 | $ echo 1 > plain2 | |
461 | $ hg add plain2 |
|
461 | $ hg add plain2 | |
462 | $ hg commit -i -d '10 0' -m eol plain plain2 <<EOF |
|
462 | $ hg commit -i -d '10 0' -m eol plain plain2 <<EOF | |
463 | > y |
|
463 | > y | |
464 | > y |
|
464 | > y | |
465 | > y |
|
465 | > y | |
466 | > y |
|
466 | > y | |
467 | > EOF |
|
467 | > EOF | |
468 | diff --git a/plain b/plain |
|
468 | diff --git a/plain b/plain | |
469 | 1 hunks, 1 lines changed |
|
469 | 1 hunks, 1 lines changed | |
470 | examine changes to 'plain'? [Ynesfdaq?] y |
|
470 | examine changes to 'plain'? [Ynesfdaq?] y | |
471 |
|
471 | |||
472 | @@ -9,4 +9,4 @@ 8 |
|
472 | @@ -9,4 +9,4 @@ 8 | |
473 | 9 |
|
473 | 9 | |
474 | 10 |
|
474 | 10 | |
475 | 11 |
|
475 | 11 | |
476 | -7264f99c5f5ff3261504828afa4fb4d406c3af54 |
|
476 | -7264f99c5f5ff3261504828afa4fb4d406c3af54 | |
477 | \ No newline at end of file |
|
477 | \ No newline at end of file | |
478 | +7264f99c5f5ff3261504828afa4fb4d406c3af54 |
|
478 | +7264f99c5f5ff3261504828afa4fb4d406c3af54 | |
479 | record change 1/2 to 'plain'? [Ynesfdaq?] y |
|
479 | record change 1/2 to 'plain'? [Ynesfdaq?] y | |
480 |
|
480 | |||
481 | diff --git a/plain2 b/plain2 |
|
481 | diff --git a/plain2 b/plain2 | |
482 | new file mode 100644 |
|
482 | new file mode 100644 | |
483 | examine changes to 'plain2'? [Ynesfdaq?] y |
|
483 | examine changes to 'plain2'? [Ynesfdaq?] y | |
484 |
|
484 | |||
485 | @@ -0,0 +1,1 @@ |
|
485 | @@ -0,0 +1,1 @@ | |
486 | +1 |
|
486 | +1 | |
487 | record change 2/2 to 'plain2'? [Ynesfdaq?] y |
|
487 | record change 2/2 to 'plain2'? [Ynesfdaq?] y | |
488 |
|
488 | |||
489 | Modify beginning, trim end, record both, add another file to test |
|
489 | Modify beginning, trim end, record both, add another file to test | |
490 | changes numbering |
|
490 | changes numbering | |
491 |
|
491 | |||
492 | $ rm plain |
|
492 | $ rm plain | |
493 | $ for i in 2 2 3 4 5 6 7 8 9 10; do |
|
493 | $ for i in 2 2 3 4 5 6 7 8 9 10; do | |
494 | > echo $i >> plain |
|
494 | > echo $i >> plain | |
495 | > done |
|
495 | > done | |
496 | $ echo 2 >> plain2 |
|
496 | $ echo 2 >> plain2 | |
497 |
|
497 | |||
498 | $ hg commit -i -d '10 0' -m begin-and-end plain plain2 <<EOF |
|
498 | $ hg commit -i -d '10 0' -m begin-and-end plain plain2 <<EOF | |
499 | > y |
|
499 | > y | |
500 | > y |
|
500 | > y | |
501 | > y |
|
501 | > y | |
502 | > y |
|
502 | > y | |
503 | > y |
|
503 | > y | |
504 | > EOF |
|
504 | > EOF | |
505 | diff --git a/plain b/plain |
|
505 | diff --git a/plain b/plain | |
506 | 2 hunks, 3 lines changed |
|
506 | 2 hunks, 3 lines changed | |
507 | examine changes to 'plain'? [Ynesfdaq?] y |
|
507 | examine changes to 'plain'? [Ynesfdaq?] y | |
508 |
|
508 | |||
509 | @@ -1,4 +1,4 @@ |
|
509 | @@ -1,4 +1,4 @@ | |
510 | -1 |
|
510 | -1 | |
511 | +2 |
|
511 | +2 | |
512 | 2 |
|
512 | 2 | |
513 | 3 |
|
513 | 3 | |
514 | 4 |
|
514 | 4 | |
515 | record change 1/3 to 'plain'? [Ynesfdaq?] y |
|
515 | record change 1/3 to 'plain'? [Ynesfdaq?] y | |
516 |
|
516 | |||
517 | @@ -8,5 +8,3 @@ 7 |
|
517 | @@ -8,5 +8,3 @@ 7 | |
518 | 8 |
|
518 | 8 | |
519 | 9 |
|
519 | 9 | |
520 | 10 |
|
520 | 10 | |
521 | -11 |
|
521 | -11 | |
522 | -7264f99c5f5ff3261504828afa4fb4d406c3af54 |
|
522 | -7264f99c5f5ff3261504828afa4fb4d406c3af54 | |
523 | record change 2/3 to 'plain'? [Ynesfdaq?] y |
|
523 | record change 2/3 to 'plain'? [Ynesfdaq?] y | |
524 |
|
524 | |||
525 | diff --git a/plain2 b/plain2 |
|
525 | diff --git a/plain2 b/plain2 | |
526 | 1 hunks, 1 lines changed |
|
526 | 1 hunks, 1 lines changed | |
527 | examine changes to 'plain2'? [Ynesfdaq?] y |
|
527 | examine changes to 'plain2'? [Ynesfdaq?] y | |
528 |
|
528 | |||
529 | @@ -1,1 +1,2 @@ |
|
529 | @@ -1,1 +1,2 @@ | |
530 | 1 |
|
530 | 1 | |
531 | +2 |
|
531 | +2 | |
532 | record change 3/3 to 'plain2'? [Ynesfdaq?] y |
|
532 | record change 3/3 to 'plain2'? [Ynesfdaq?] y | |
533 |
|
533 | |||
534 |
|
534 | |||
535 | $ hg tip -p |
|
535 | $ hg tip -p | |
536 | changeset: 13:f941910cff62 |
|
536 | changeset: 13:f941910cff62 | |
537 | tag: tip |
|
537 | tag: tip | |
538 | user: test |
|
538 | user: test | |
539 | date: Thu Jan 01 00:00:10 1970 +0000 |
|
539 | date: Thu Jan 01 00:00:10 1970 +0000 | |
540 | summary: begin-and-end |
|
540 | summary: begin-and-end | |
541 |
|
541 | |||
542 | diff -r 33abe24d946c -r f941910cff62 plain |
|
542 | diff -r 33abe24d946c -r f941910cff62 plain | |
543 | --- a/plain Thu Jan 01 00:00:10 1970 +0000 |
|
543 | --- a/plain Thu Jan 01 00:00:10 1970 +0000 | |
544 | +++ b/plain Thu Jan 01 00:00:10 1970 +0000 |
|
544 | +++ b/plain Thu Jan 01 00:00:10 1970 +0000 | |
545 | @@ -1,4 +1,4 @@ |
|
545 | @@ -1,4 +1,4 @@ | |
546 | -1 |
|
546 | -1 | |
547 | +2 |
|
547 | +2 | |
548 | 2 |
|
548 | 2 | |
549 | 3 |
|
549 | 3 | |
550 | 4 |
|
550 | 4 | |
551 | @@ -8,5 +8,3 @@ |
|
551 | @@ -8,5 +8,3 @@ | |
552 | 8 |
|
552 | 8 | |
553 | 9 |
|
553 | 9 | |
554 | 10 |
|
554 | 10 | |
555 | -11 |
|
555 | -11 | |
556 | -7264f99c5f5ff3261504828afa4fb4d406c3af54 |
|
556 | -7264f99c5f5ff3261504828afa4fb4d406c3af54 | |
557 | diff -r 33abe24d946c -r f941910cff62 plain2 |
|
557 | diff -r 33abe24d946c -r f941910cff62 plain2 | |
558 | --- a/plain2 Thu Jan 01 00:00:10 1970 +0000 |
|
558 | --- a/plain2 Thu Jan 01 00:00:10 1970 +0000 | |
559 | +++ b/plain2 Thu Jan 01 00:00:10 1970 +0000 |
|
559 | +++ b/plain2 Thu Jan 01 00:00:10 1970 +0000 | |
560 | @@ -1,1 +1,2 @@ |
|
560 | @@ -1,1 +1,2 @@ | |
561 | 1 |
|
561 | 1 | |
562 | +2 |
|
562 | +2 | |
563 |
|
563 | |||
564 |
|
564 | |||
565 | Trim beginning, modify end |
|
565 | Trim beginning, modify end | |
566 |
|
566 | |||
567 | $ rm plain |
|
567 | $ rm plain | |
568 | > for i in 4 5 6 7 8 9 10.new; do |
|
568 | > for i in 4 5 6 7 8 9 10.new; do | |
569 | > echo $i >> plain |
|
569 | > echo $i >> plain | |
570 | > done |
|
570 | > done | |
571 |
|
571 | |||
572 | Record end |
|
572 | Record end | |
573 |
|
573 | |||
574 | $ hg commit -i -d '11 0' -m end-only plain <<EOF |
|
574 | $ hg commit -i -d '11 0' -m end-only plain <<EOF | |
575 | > y |
|
575 | > y | |
576 | > n |
|
576 | > n | |
577 | > y |
|
577 | > y | |
578 | > EOF |
|
578 | > EOF | |
579 | diff --git a/plain b/plain |
|
579 | diff --git a/plain b/plain | |
580 | 2 hunks, 4 lines changed |
|
580 | 2 hunks, 4 lines changed | |
581 | examine changes to 'plain'? [Ynesfdaq?] y |
|
581 | examine changes to 'plain'? [Ynesfdaq?] y | |
582 |
|
582 | |||
583 | @@ -1,9 +1,6 @@ |
|
583 | @@ -1,9 +1,6 @@ | |
584 | -2 |
|
584 | -2 | |
585 | -2 |
|
585 | -2 | |
586 | -3 |
|
586 | -3 | |
587 | 4 |
|
587 | 4 | |
588 | 5 |
|
588 | 5 | |
589 | 6 |
|
589 | 6 | |
590 | 7 |
|
590 | 7 | |
591 | 8 |
|
591 | 8 | |
592 | 9 |
|
592 | 9 | |
593 | record change 1/2 to 'plain'? [Ynesfdaq?] n |
|
593 | record change 1/2 to 'plain'? [Ynesfdaq?] n | |
594 |
|
594 | |||
595 | @@ -4,7 +1,7 @@ |
|
595 | @@ -4,7 +1,7 @@ | |
596 | 4 |
|
596 | 4 | |
597 | 5 |
|
597 | 5 | |
598 | 6 |
|
598 | 6 | |
599 | 7 |
|
599 | 7 | |
600 | 8 |
|
600 | 8 | |
601 | 9 |
|
601 | 9 | |
602 | -10 |
|
602 | -10 | |
603 | +10.new |
|
603 | +10.new | |
604 | record change 2/2 to 'plain'? [Ynesfdaq?] y |
|
604 | record change 2/2 to 'plain'? [Ynesfdaq?] y | |
605 |
|
605 | |||
606 |
|
606 | |||
607 | $ hg tip -p |
|
607 | $ hg tip -p | |
608 | changeset: 14:4915f538659b |
|
608 | changeset: 14:4915f538659b | |
609 | tag: tip |
|
609 | tag: tip | |
610 | user: test |
|
610 | user: test | |
611 | date: Thu Jan 01 00:00:11 1970 +0000 |
|
611 | date: Thu Jan 01 00:00:11 1970 +0000 | |
612 | summary: end-only |
|
612 | summary: end-only | |
613 |
|
613 | |||
614 | diff -r f941910cff62 -r 4915f538659b plain |
|
614 | diff -r f941910cff62 -r 4915f538659b plain | |
615 | --- a/plain Thu Jan 01 00:00:10 1970 +0000 |
|
615 | --- a/plain Thu Jan 01 00:00:10 1970 +0000 | |
616 | +++ b/plain Thu Jan 01 00:00:11 1970 +0000 |
|
616 | +++ b/plain Thu Jan 01 00:00:11 1970 +0000 | |
617 | @@ -7,4 +7,4 @@ |
|
617 | @@ -7,4 +7,4 @@ | |
618 | 7 |
|
618 | 7 | |
619 | 8 |
|
619 | 8 | |
620 | 9 |
|
620 | 9 | |
621 | -10 |
|
621 | -10 | |
622 | +10.new |
|
622 | +10.new | |
623 |
|
623 | |||
624 |
|
624 | |||
625 | Record beginning |
|
625 | Record beginning | |
626 |
|
626 | |||
627 | $ hg commit -i -d '12 0' -m begin-only plain <<EOF |
|
627 | $ hg commit -i -d '12 0' -m begin-only plain <<EOF | |
628 | > y |
|
628 | > y | |
629 | > y |
|
629 | > y | |
630 | > EOF |
|
630 | > EOF | |
631 | diff --git a/plain b/plain |
|
631 | diff --git a/plain b/plain | |
632 | 1 hunks, 3 lines changed |
|
632 | 1 hunks, 3 lines changed | |
633 | examine changes to 'plain'? [Ynesfdaq?] y |
|
633 | examine changes to 'plain'? [Ynesfdaq?] y | |
634 |
|
634 | |||
635 | @@ -1,6 +1,3 @@ |
|
635 | @@ -1,6 +1,3 @@ | |
636 | -2 |
|
636 | -2 | |
637 | -2 |
|
637 | -2 | |
638 | -3 |
|
638 | -3 | |
639 | 4 |
|
639 | 4 | |
640 | 5 |
|
640 | 5 | |
641 | 6 |
|
641 | 6 | |
642 | record this change to 'plain'? [Ynesfdaq?] y |
|
642 | record this change to 'plain'? [Ynesfdaq?] y | |
643 |
|
643 | |||
644 |
|
644 | |||
645 | $ hg tip -p |
|
645 | $ hg tip -p | |
646 | changeset: 15:1b1f93d4b94b |
|
646 | changeset: 15:1b1f93d4b94b | |
647 | tag: tip |
|
647 | tag: tip | |
648 | user: test |
|
648 | user: test | |
649 | date: Thu Jan 01 00:00:12 1970 +0000 |
|
649 | date: Thu Jan 01 00:00:12 1970 +0000 | |
650 | summary: begin-only |
|
650 | summary: begin-only | |
651 |
|
651 | |||
652 | diff -r 4915f538659b -r 1b1f93d4b94b plain |
|
652 | diff -r 4915f538659b -r 1b1f93d4b94b plain | |
653 | --- a/plain Thu Jan 01 00:00:11 1970 +0000 |
|
653 | --- a/plain Thu Jan 01 00:00:11 1970 +0000 | |
654 | +++ b/plain Thu Jan 01 00:00:12 1970 +0000 |
|
654 | +++ b/plain Thu Jan 01 00:00:12 1970 +0000 | |
655 | @@ -1,6 +1,3 @@ |
|
655 | @@ -1,6 +1,3 @@ | |
656 | -2 |
|
656 | -2 | |
657 | -2 |
|
657 | -2 | |
658 | -3 |
|
658 | -3 | |
659 | 4 |
|
659 | 4 | |
660 | 5 |
|
660 | 5 | |
661 | 6 |
|
661 | 6 | |
662 |
|
662 | |||
663 |
|
663 | |||
664 | Add to beginning, trim from end |
|
664 | Add to beginning, trim from end | |
665 |
|
665 | |||
666 | $ rm plain |
|
666 | $ rm plain | |
667 | $ for i in 1 2 3 4 5 6 7 8 9; do |
|
667 | $ for i in 1 2 3 4 5 6 7 8 9; do | |
668 | > echo $i >> plain |
|
668 | > echo $i >> plain | |
669 | > done |
|
669 | > done | |
670 |
|
670 | |||
671 | Record end |
|
671 | Record end | |
672 |
|
672 | |||
673 | $ hg commit -i --traceback -d '13 0' -m end-again plain<<EOF |
|
673 | $ hg commit -i --traceback -d '13 0' -m end-again plain<<EOF | |
674 | > y |
|
674 | > y | |
675 | > n |
|
675 | > n | |
676 | > y |
|
676 | > y | |
677 | > EOF |
|
677 | > EOF | |
678 | diff --git a/plain b/plain |
|
678 | diff --git a/plain b/plain | |
679 | 2 hunks, 4 lines changed |
|
679 | 2 hunks, 4 lines changed | |
680 | examine changes to 'plain'? [Ynesfdaq?] y |
|
680 | examine changes to 'plain'? [Ynesfdaq?] y | |
681 |
|
681 | |||
682 | @@ -1,6 +1,9 @@ |
|
682 | @@ -1,6 +1,9 @@ | |
683 | +1 |
|
683 | +1 | |
684 | +2 |
|
684 | +2 | |
685 | +3 |
|
685 | +3 | |
686 | 4 |
|
686 | 4 | |
687 | 5 |
|
687 | 5 | |
688 | 6 |
|
688 | 6 | |
689 | 7 |
|
689 | 7 | |
690 | 8 |
|
690 | 8 | |
691 | 9 |
|
691 | 9 | |
692 | record change 1/2 to 'plain'? [Ynesfdaq?] n |
|
692 | record change 1/2 to 'plain'? [Ynesfdaq?] n | |
693 |
|
693 | |||
694 | @@ -1,7 +4,6 @@ |
|
694 | @@ -1,7 +4,6 @@ | |
695 | 4 |
|
695 | 4 | |
696 | 5 |
|
696 | 5 | |
697 | 6 |
|
697 | 6 | |
698 | 7 |
|
698 | 7 | |
699 | 8 |
|
699 | 8 | |
700 | 9 |
|
700 | 9 | |
701 | -10.new |
|
701 | -10.new | |
702 | record change 2/2 to 'plain'? [Ynesfdaq?] y |
|
702 | record change 2/2 to 'plain'? [Ynesfdaq?] y | |
703 |
|
703 | |||
704 |
|
704 | |||
705 | Add to beginning, middle, end |
|
705 | Add to beginning, middle, end | |
706 |
|
706 | |||
707 | $ rm plain |
|
707 | $ rm plain | |
708 | $ for i in 1 2 3 4 5 5.new 5.reallynew 6 7 8 9 10 11; do |
|
708 | $ for i in 1 2 3 4 5 5.new 5.reallynew 6 7 8 9 10 11; do | |
709 | > echo $i >> plain |
|
709 | > echo $i >> plain | |
710 | > done |
|
710 | > done | |
711 |
|
711 | |||
712 | Record beginning, middle, and test that format-breaking diffopts are ignored |
|
712 | Record beginning, middle, and test that format-breaking diffopts are ignored | |
713 |
|
713 | |||
714 | $ hg commit -i --config diff.noprefix=True -d '14 0' -m middle-only plain <<EOF |
|
714 | $ hg commit -i --config diff.noprefix=True -d '14 0' -m middle-only plain <<EOF | |
715 | > y |
|
715 | > y | |
716 | > y |
|
716 | > y | |
717 | > y |
|
717 | > y | |
718 | > n |
|
718 | > n | |
719 | > EOF |
|
719 | > EOF | |
720 | diff --git a/plain b/plain |
|
720 | diff --git a/plain b/plain | |
721 | 3 hunks, 7 lines changed |
|
721 | 3 hunks, 7 lines changed | |
722 | examine changes to 'plain'? [Ynesfdaq?] y |
|
722 | examine changes to 'plain'? [Ynesfdaq?] y | |
723 |
|
723 | |||
724 | @@ -1,2 +1,5 @@ |
|
724 | @@ -1,2 +1,5 @@ | |
725 | +1 |
|
725 | +1 | |
726 | +2 |
|
726 | +2 | |
727 | +3 |
|
727 | +3 | |
728 | 4 |
|
728 | 4 | |
729 | 5 |
|
729 | 5 | |
730 | record change 1/3 to 'plain'? [Ynesfdaq?] y |
|
730 | record change 1/3 to 'plain'? [Ynesfdaq?] y | |
731 |
|
731 | |||
732 | @@ -1,6 +4,8 @@ |
|
732 | @@ -1,6 +4,8 @@ | |
733 | 4 |
|
733 | 4 | |
734 | 5 |
|
734 | 5 | |
735 | +5.new |
|
735 | +5.new | |
736 | +5.reallynew |
|
736 | +5.reallynew | |
737 | 6 |
|
737 | 6 | |
738 | 7 |
|
738 | 7 | |
739 | 8 |
|
739 | 8 | |
740 | 9 |
|
740 | 9 | |
741 | record change 2/3 to 'plain'? [Ynesfdaq?] y |
|
741 | record change 2/3 to 'plain'? [Ynesfdaq?] y | |
742 |
|
742 | |||
743 | @@ -3,4 +8,6 @@ |
|
743 | @@ -3,4 +8,6 @@ | |
744 | 6 |
|
744 | 6 | |
745 | 7 |
|
745 | 7 | |
746 | 8 |
|
746 | 8 | |
747 | 9 |
|
747 | 9 | |
748 | +10 |
|
748 | +10 | |
749 | +11 |
|
749 | +11 | |
750 | record change 3/3 to 'plain'? [Ynesfdaq?] n |
|
750 | record change 3/3 to 'plain'? [Ynesfdaq?] n | |
751 |
|
751 | |||
752 |
|
752 | |||
753 | $ hg tip -p |
|
753 | $ hg tip -p | |
754 | changeset: 17:41cf3f5c55ae |
|
754 | changeset: 17:41cf3f5c55ae | |
755 | tag: tip |
|
755 | tag: tip | |
756 | user: test |
|
756 | user: test | |
757 | date: Thu Jan 01 00:00:14 1970 +0000 |
|
757 | date: Thu Jan 01 00:00:14 1970 +0000 | |
758 | summary: middle-only |
|
758 | summary: middle-only | |
759 |
|
759 | |||
760 | diff -r a69d252246e1 -r 41cf3f5c55ae plain |
|
760 | diff -r a69d252246e1 -r 41cf3f5c55ae plain | |
761 | --- a/plain Thu Jan 01 00:00:13 1970 +0000 |
|
761 | --- a/plain Thu Jan 01 00:00:13 1970 +0000 | |
762 | +++ b/plain Thu Jan 01 00:00:14 1970 +0000 |
|
762 | +++ b/plain Thu Jan 01 00:00:14 1970 +0000 | |
763 | @@ -1,5 +1,10 @@ |
|
763 | @@ -1,5 +1,10 @@ | |
764 | +1 |
|
764 | +1 | |
765 | +2 |
|
765 | +2 | |
766 | +3 |
|
766 | +3 | |
767 | 4 |
|
767 | 4 | |
768 | 5 |
|
768 | 5 | |
769 | +5.new |
|
769 | +5.new | |
770 | +5.reallynew |
|
770 | +5.reallynew | |
771 | 6 |
|
771 | 6 | |
772 | 7 |
|
772 | 7 | |
773 | 8 |
|
773 | 8 | |
774 |
|
774 | |||
775 |
|
775 | |||
776 | Record end |
|
776 | Record end | |
777 |
|
777 | |||
778 | $ hg commit -i -d '15 0' -m end-only plain <<EOF |
|
778 | $ hg commit -i -d '15 0' -m end-only plain <<EOF | |
779 | > y |
|
779 | > y | |
780 | > y |
|
780 | > y | |
781 | > EOF |
|
781 | > EOF | |
782 | diff --git a/plain b/plain |
|
782 | diff --git a/plain b/plain | |
783 | 1 hunks, 2 lines changed |
|
783 | 1 hunks, 2 lines changed | |
784 | examine changes to 'plain'? [Ynesfdaq?] y |
|
784 | examine changes to 'plain'? [Ynesfdaq?] y | |
785 |
|
785 | |||
786 | @@ -9,3 +9,5 @@ 6 |
|
786 | @@ -9,3 +9,5 @@ 6 | |
787 | 7 |
|
787 | 7 | |
788 | 8 |
|
788 | 8 | |
789 | 9 |
|
789 | 9 | |
790 | +10 |
|
790 | +10 | |
791 | +11 |
|
791 | +11 | |
792 | record this change to 'plain'? [Ynesfdaq?] y |
|
792 | record this change to 'plain'? [Ynesfdaq?] y | |
793 |
|
793 | |||
794 |
|
794 | |||
795 | $ hg tip -p |
|
795 | $ hg tip -p | |
796 | changeset: 18:58a72f46bc24 |
|
796 | changeset: 18:58a72f46bc24 | |
797 | tag: tip |
|
797 | tag: tip | |
798 | user: test |
|
798 | user: test | |
799 | date: Thu Jan 01 00:00:15 1970 +0000 |
|
799 | date: Thu Jan 01 00:00:15 1970 +0000 | |
800 | summary: end-only |
|
800 | summary: end-only | |
801 |
|
801 | |||
802 | diff -r 41cf3f5c55ae -r 58a72f46bc24 plain |
|
802 | diff -r 41cf3f5c55ae -r 58a72f46bc24 plain | |
803 | --- a/plain Thu Jan 01 00:00:14 1970 +0000 |
|
803 | --- a/plain Thu Jan 01 00:00:14 1970 +0000 | |
804 | +++ b/plain Thu Jan 01 00:00:15 1970 +0000 |
|
804 | +++ b/plain Thu Jan 01 00:00:15 1970 +0000 | |
805 | @@ -9,3 +9,5 @@ |
|
805 | @@ -9,3 +9,5 @@ | |
806 | 7 |
|
806 | 7 | |
807 | 8 |
|
807 | 8 | |
808 | 9 |
|
808 | 9 | |
809 | +10 |
|
809 | +10 | |
810 | +11 |
|
810 | +11 | |
811 |
|
811 | |||
812 |
|
812 | |||
813 | $ mkdir subdir |
|
813 | $ mkdir subdir | |
814 | $ cd subdir |
|
814 | $ cd subdir | |
815 | $ echo a > a |
|
815 | $ echo a > a | |
816 | $ hg ci -d '16 0' -Amsubdir |
|
816 | $ hg ci -d '16 0' -Amsubdir | |
817 | adding subdir/a |
|
817 | adding subdir/a | |
818 |
|
818 | |||
819 | $ echo a >> a |
|
819 | $ echo a >> a | |
820 | $ hg commit -i -d '16 0' -m subdir-change a <<EOF |
|
820 | $ hg commit -i -d '16 0' -m subdir-change a <<EOF | |
821 | > y |
|
821 | > y | |
822 | > y |
|
822 | > y | |
823 | > EOF |
|
823 | > EOF | |
824 | diff --git a/subdir/a b/subdir/a |
|
824 | diff --git a/subdir/a b/subdir/a | |
825 | 1 hunks, 1 lines changed |
|
825 | 1 hunks, 1 lines changed | |
826 | examine changes to 'subdir/a'? [Ynesfdaq?] y |
|
826 | examine changes to 'subdir/a'? [Ynesfdaq?] y | |
827 |
|
827 | |||
828 | @@ -1,1 +1,2 @@ |
|
828 | @@ -1,1 +1,2 @@ | |
829 | a |
|
829 | a | |
830 | +a |
|
830 | +a | |
831 | record this change to 'subdir/a'? [Ynesfdaq?] y |
|
831 | record this change to 'subdir/a'? [Ynesfdaq?] y | |
832 |
|
832 | |||
833 |
|
833 | |||
834 | $ hg tip -p |
|
834 | $ hg tip -p | |
835 | changeset: 20:e0f6b99f6c49 |
|
835 | changeset: 20:e0f6b99f6c49 | |
836 | tag: tip |
|
836 | tag: tip | |
837 | user: test |
|
837 | user: test | |
838 | date: Thu Jan 01 00:00:16 1970 +0000 |
|
838 | date: Thu Jan 01 00:00:16 1970 +0000 | |
839 | summary: subdir-change |
|
839 | summary: subdir-change | |
840 |
|
840 | |||
841 | diff -r abd26b51de37 -r e0f6b99f6c49 subdir/a |
|
841 | diff -r abd26b51de37 -r e0f6b99f6c49 subdir/a | |
842 | --- a/subdir/a Thu Jan 01 00:00:16 1970 +0000 |
|
842 | --- a/subdir/a Thu Jan 01 00:00:16 1970 +0000 | |
843 | +++ b/subdir/a Thu Jan 01 00:00:16 1970 +0000 |
|
843 | +++ b/subdir/a Thu Jan 01 00:00:16 1970 +0000 | |
844 | @@ -1,1 +1,2 @@ |
|
844 | @@ -1,1 +1,2 @@ | |
845 | a |
|
845 | a | |
846 | +a |
|
846 | +a | |
847 |
|
847 | |||
848 |
|
848 | |||
849 | $ echo a > f1 |
|
849 | $ echo a > f1 | |
850 | $ echo b > f2 |
|
850 | $ echo b > f2 | |
851 | $ hg add f1 f2 |
|
851 | $ hg add f1 f2 | |
852 |
|
852 | |||
853 | $ hg ci -mz -d '17 0' |
|
853 | $ hg ci -mz -d '17 0' | |
854 |
|
854 | |||
855 | $ echo a >> f1 |
|
855 | $ echo a >> f1 | |
856 | $ echo b >> f2 |
|
856 | $ echo b >> f2 | |
857 |
|
857 | |||
858 | Help, quit |
|
858 | Help, quit | |
859 |
|
859 | |||
860 | $ hg commit -i <<EOF |
|
860 | $ hg commit -i <<EOF | |
861 | > ? |
|
861 | > ? | |
862 | > q |
|
862 | > q | |
863 | > EOF |
|
863 | > EOF | |
864 | diff --git a/subdir/f1 b/subdir/f1 |
|
864 | diff --git a/subdir/f1 b/subdir/f1 | |
865 | 1 hunks, 1 lines changed |
|
865 | 1 hunks, 1 lines changed | |
866 | examine changes to 'subdir/f1'? [Ynesfdaq?] ? |
|
866 | examine changes to 'subdir/f1'? [Ynesfdaq?] ? | |
867 |
|
867 | |||
868 | y - yes, record this change |
|
868 | y - yes, record this change | |
869 | n - no, skip this change |
|
869 | n - no, skip this change | |
870 | e - edit this change manually |
|
870 | e - edit this change manually | |
871 | s - skip remaining changes to this file |
|
871 | s - skip remaining changes to this file | |
872 | f - record remaining changes to this file |
|
872 | f - record remaining changes to this file | |
873 | d - done, skip remaining changes and files |
|
873 | d - done, skip remaining changes and files | |
874 | a - record all changes to all remaining files |
|
874 | a - record all changes to all remaining files | |
875 | q - quit, recording no changes |
|
875 | q - quit, recording no changes | |
876 | ? - ? (display help) |
|
876 | ? - ? (display help) | |
877 | examine changes to 'subdir/f1'? [Ynesfdaq?] q |
|
877 | examine changes to 'subdir/f1'? [Ynesfdaq?] q | |
878 |
|
878 | |||
879 | abort: user quit |
|
879 | abort: user quit | |
880 | [255] |
|
880 | [255] | |
881 |
|
881 | |||
882 | #if gettext |
|
882 | #if gettext | |
883 |
|
883 | |||
884 | Test translated help message |
|
884 | Test translated help message | |
885 |
|
885 | |||
886 | str.lower() instead of encoding.lower(str) on translated message might |
|
886 | str.lower() instead of encoding.lower(str) on translated message might | |
887 | make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z) |
|
887 | make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z) | |
888 | as the second or later byte of multi-byte character. |
|
888 | as the second or later byte of multi-byte character. | |
889 |
|
889 | |||
890 | For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932) |
|
890 | For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932) | |
891 | contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this |
|
891 | contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this | |
892 | replacement makes message meaningless. |
|
892 | replacement makes message meaningless. | |
893 |
|
893 | |||
894 | This tests that translated help message is lower()-ed correctly. |
|
894 | This tests that translated help message is lower()-ed correctly. | |
895 |
|
895 | |||
896 | $ LANGUAGE=ja |
|
896 | $ LANGUAGE=ja | |
897 | $ export LANGUAGE |
|
897 | $ export LANGUAGE | |
898 |
|
898 | |||
899 | $ cat > $TESTTMP/escape.py <<EOF |
|
899 | $ cat > $TESTTMP/escape.py <<EOF | |
900 | > from __future__ import absolute_import |
|
900 | > from __future__ import absolute_import | |
901 | > from mercurial import ( |
|
901 | > from mercurial import ( | |
902 | > pycompat, |
|
902 | > pycompat, | |
903 | > ) |
|
903 | > ) | |
904 | > from mercurial.utils import ( |
|
904 | > from mercurial.utils import ( | |
905 | > procutil, |
|
905 | > procutil, | |
906 | > ) |
|
906 | > ) | |
907 | > def escape(c): |
|
907 | > def escape(c): | |
908 | > o = ord(c) |
|
908 | > o = ord(c) | |
909 | > if o < 0x80: |
|
909 | > if o < 0x80: | |
910 | > return c |
|
910 | > return c | |
911 | > else: |
|
911 | > else: | |
912 | > return br'\x%02x' % o # escape char setting MSB |
|
912 | > return br'\x%02x' % o # escape char setting MSB | |
913 | > for l in procutil.stdin: |
|
913 | > for l in procutil.stdin: | |
914 | > procutil.stdout.write( |
|
914 | > procutil.stdout.write( | |
915 | > b''.join(escape(c) for c in pycompat.iterbytestr(l))) |
|
915 | > b''.join(escape(c) for c in pycompat.iterbytestr(l))) | |
916 | > EOF |
|
916 | > EOF | |
917 |
|
917 | |||
918 | $ hg commit -i --encoding cp932 2>&1 <<EOF | "$PYTHON" $TESTTMP/escape.py | grep '^y - ' |
|
918 | $ hg commit -i --encoding cp932 2>&1 <<EOF | "$PYTHON" $TESTTMP/escape.py | grep '^y - ' | |
919 | > ? |
|
919 | > ? | |
920 | > q |
|
920 | > q | |
921 | > EOF |
|
921 | > EOF | |
922 | y - \x82\xb1\x82\xcc\x95\xcf\x8dX\x82\xf0\x8bL\x98^(yes) |
|
922 | y - \x82\xb1\x82\xcc\x95\xcf\x8dX\x82\xf0\x8bL\x98^(yes) | |
923 |
|
923 | |||
924 | $ LANGUAGE= |
|
924 | $ LANGUAGE= | |
925 | #endif |
|
925 | #endif | |
926 |
|
926 | |||
927 | Skip |
|
927 | Skip | |
928 |
|
928 | |||
929 | $ hg commit -i <<EOF |
|
929 | $ hg commit -i <<EOF | |
930 | > s |
|
930 | > s | |
931 | > EOF |
|
931 | > EOF | |
932 | diff --git a/subdir/f1 b/subdir/f1 |
|
932 | diff --git a/subdir/f1 b/subdir/f1 | |
933 | 1 hunks, 1 lines changed |
|
933 | 1 hunks, 1 lines changed | |
934 | examine changes to 'subdir/f1'? [Ynesfdaq?] s |
|
934 | examine changes to 'subdir/f1'? [Ynesfdaq?] s | |
935 |
|
935 | |||
936 | diff --git a/subdir/f2 b/subdir/f2 |
|
936 | diff --git a/subdir/f2 b/subdir/f2 | |
937 | 1 hunks, 1 lines changed |
|
937 | 1 hunks, 1 lines changed | |
938 | examine changes to 'subdir/f2'? [Ynesfdaq?] abort: response expected |
|
938 | examine changes to 'subdir/f2'? [Ynesfdaq?] abort: response expected | |
939 | [255] |
|
939 | [255] | |
940 |
|
940 | |||
941 | No |
|
941 | No | |
942 |
|
942 | |||
943 | $ hg commit -i <<EOF |
|
943 | $ hg commit -i <<EOF | |
944 | > n |
|
944 | > n | |
945 | > EOF |
|
945 | > EOF | |
946 | diff --git a/subdir/f1 b/subdir/f1 |
|
946 | diff --git a/subdir/f1 b/subdir/f1 | |
947 | 1 hunks, 1 lines changed |
|
947 | 1 hunks, 1 lines changed | |
948 | examine changes to 'subdir/f1'? [Ynesfdaq?] n |
|
948 | examine changes to 'subdir/f1'? [Ynesfdaq?] n | |
949 |
|
949 | |||
950 | diff --git a/subdir/f2 b/subdir/f2 |
|
950 | diff --git a/subdir/f2 b/subdir/f2 | |
951 | 1 hunks, 1 lines changed |
|
951 | 1 hunks, 1 lines changed | |
952 | examine changes to 'subdir/f2'? [Ynesfdaq?] abort: response expected |
|
952 | examine changes to 'subdir/f2'? [Ynesfdaq?] abort: response expected | |
953 | [255] |
|
953 | [255] | |
954 |
|
954 | |||
955 | f, quit |
|
955 | f, quit | |
956 |
|
956 | |||
957 | $ hg commit -i <<EOF |
|
957 | $ hg commit -i <<EOF | |
958 | > f |
|
958 | > f | |
959 | > q |
|
959 | > q | |
960 | > EOF |
|
960 | > EOF | |
961 | diff --git a/subdir/f1 b/subdir/f1 |
|
961 | diff --git a/subdir/f1 b/subdir/f1 | |
962 | 1 hunks, 1 lines changed |
|
962 | 1 hunks, 1 lines changed | |
963 | examine changes to 'subdir/f1'? [Ynesfdaq?] f |
|
963 | examine changes to 'subdir/f1'? [Ynesfdaq?] f | |
964 |
|
964 | |||
965 | diff --git a/subdir/f2 b/subdir/f2 |
|
965 | diff --git a/subdir/f2 b/subdir/f2 | |
966 | 1 hunks, 1 lines changed |
|
966 | 1 hunks, 1 lines changed | |
967 | examine changes to 'subdir/f2'? [Ynesfdaq?] q |
|
967 | examine changes to 'subdir/f2'? [Ynesfdaq?] q | |
968 |
|
968 | |||
969 | abort: user quit |
|
969 | abort: user quit | |
970 | [255] |
|
970 | [255] | |
971 |
|
971 | |||
972 | s, all |
|
972 | s, all | |
973 |
|
973 | |||
974 | $ hg commit -i -d '18 0' -mx <<EOF |
|
974 | $ hg commit -i -d '18 0' -mx <<EOF | |
975 | > s |
|
975 | > s | |
976 | > a |
|
976 | > a | |
977 | > EOF |
|
977 | > EOF | |
978 | diff --git a/subdir/f1 b/subdir/f1 |
|
978 | diff --git a/subdir/f1 b/subdir/f1 | |
979 | 1 hunks, 1 lines changed |
|
979 | 1 hunks, 1 lines changed | |
980 | examine changes to 'subdir/f1'? [Ynesfdaq?] s |
|
980 | examine changes to 'subdir/f1'? [Ynesfdaq?] s | |
981 |
|
981 | |||
982 | diff --git a/subdir/f2 b/subdir/f2 |
|
982 | diff --git a/subdir/f2 b/subdir/f2 | |
983 | 1 hunks, 1 lines changed |
|
983 | 1 hunks, 1 lines changed | |
984 | examine changes to 'subdir/f2'? [Ynesfdaq?] a |
|
984 | examine changes to 'subdir/f2'? [Ynesfdaq?] a | |
985 |
|
985 | |||
986 |
|
986 | |||
987 | $ hg tip -p |
|
987 | $ hg tip -p | |
988 | changeset: 22:6afbbefacf35 |
|
988 | changeset: 22:6afbbefacf35 | |
989 | tag: tip |
|
989 | tag: tip | |
990 | user: test |
|
990 | user: test | |
991 | date: Thu Jan 01 00:00:18 1970 +0000 |
|
991 | date: Thu Jan 01 00:00:18 1970 +0000 | |
992 | summary: x |
|
992 | summary: x | |
993 |
|
993 | |||
994 | diff -r b73c401c693c -r 6afbbefacf35 subdir/f2 |
|
994 | diff -r b73c401c693c -r 6afbbefacf35 subdir/f2 | |
995 | --- a/subdir/f2 Thu Jan 01 00:00:17 1970 +0000 |
|
995 | --- a/subdir/f2 Thu Jan 01 00:00:17 1970 +0000 | |
996 | +++ b/subdir/f2 Thu Jan 01 00:00:18 1970 +0000 |
|
996 | +++ b/subdir/f2 Thu Jan 01 00:00:18 1970 +0000 | |
997 | @@ -1,1 +1,2 @@ |
|
997 | @@ -1,1 +1,2 @@ | |
998 | b |
|
998 | b | |
999 | +b |
|
999 | +b | |
1000 |
|
1000 | |||
1001 |
|
1001 | |||
1002 | f |
|
1002 | f | |
1003 |
|
1003 | |||
1004 | $ hg commit -i -d '19 0' -my <<EOF |
|
1004 | $ hg commit -i -d '19 0' -my <<EOF | |
1005 | > f |
|
1005 | > f | |
1006 | > EOF |
|
1006 | > EOF | |
1007 | diff --git a/subdir/f1 b/subdir/f1 |
|
1007 | diff --git a/subdir/f1 b/subdir/f1 | |
1008 | 1 hunks, 1 lines changed |
|
1008 | 1 hunks, 1 lines changed | |
1009 | examine changes to 'subdir/f1'? [Ynesfdaq?] f |
|
1009 | examine changes to 'subdir/f1'? [Ynesfdaq?] f | |
1010 |
|
1010 | |||
1011 |
|
1011 | |||
1012 | $ hg tip -p |
|
1012 | $ hg tip -p | |
1013 | changeset: 23:715028a33949 |
|
1013 | changeset: 23:715028a33949 | |
1014 | tag: tip |
|
1014 | tag: tip | |
1015 | user: test |
|
1015 | user: test | |
1016 | date: Thu Jan 01 00:00:19 1970 +0000 |
|
1016 | date: Thu Jan 01 00:00:19 1970 +0000 | |
1017 | summary: y |
|
1017 | summary: y | |
1018 |
|
1018 | |||
1019 | diff -r 6afbbefacf35 -r 715028a33949 subdir/f1 |
|
1019 | diff -r 6afbbefacf35 -r 715028a33949 subdir/f1 | |
1020 | --- a/subdir/f1 Thu Jan 01 00:00:18 1970 +0000 |
|
1020 | --- a/subdir/f1 Thu Jan 01 00:00:18 1970 +0000 | |
1021 | +++ b/subdir/f1 Thu Jan 01 00:00:19 1970 +0000 |
|
1021 | +++ b/subdir/f1 Thu Jan 01 00:00:19 1970 +0000 | |
1022 | @@ -1,1 +1,2 @@ |
|
1022 | @@ -1,1 +1,2 @@ | |
1023 | a |
|
1023 | a | |
1024 | +a |
|
1024 | +a | |
1025 |
|
1025 | |||
1026 |
|
1026 | |||
1027 | #if execbit |
|
1027 | #if execbit | |
1028 |
|
1028 | |||
1029 | Preserve chmod +x |
|
1029 | Preserve chmod +x | |
1030 |
|
1030 | |||
1031 | $ chmod +x f1 |
|
1031 | $ chmod +x f1 | |
1032 | $ echo a >> f1 |
|
1032 | $ echo a >> f1 | |
1033 | $ hg commit -i -d '20 0' -mz <<EOF |
|
1033 | $ hg commit -i -d '20 0' -mz <<EOF | |
1034 | > y |
|
1034 | > y | |
1035 | > y |
|
1035 | > y | |
1036 | > y |
|
1036 | > y | |
1037 | > EOF |
|
1037 | > EOF | |
1038 | diff --git a/subdir/f1 b/subdir/f1 |
|
1038 | diff --git a/subdir/f1 b/subdir/f1 | |
1039 | old mode 100644 |
|
1039 | old mode 100644 | |
1040 | new mode 100755 |
|
1040 | new mode 100755 | |
1041 | 1 hunks, 1 lines changed |
|
1041 | 1 hunks, 1 lines changed | |
1042 | examine changes to 'subdir/f1'? [Ynesfdaq?] y |
|
1042 | examine changes to 'subdir/f1'? [Ynesfdaq?] y | |
1043 |
|
1043 | |||
1044 | @@ -1,2 +1,3 @@ |
|
1044 | @@ -1,2 +1,3 @@ | |
1045 | a |
|
1045 | a | |
1046 | a |
|
1046 | a | |
1047 | +a |
|
1047 | +a | |
1048 | record this change to 'subdir/f1'? [Ynesfdaq?] y |
|
1048 | record this change to 'subdir/f1'? [Ynesfdaq?] y | |
1049 |
|
1049 | |||
1050 |
|
1050 | |||
1051 | $ hg tip --config diff.git=True -p |
|
1051 | $ hg tip --config diff.git=True -p | |
1052 | changeset: 24:db967c1e5884 |
|
1052 | changeset: 24:db967c1e5884 | |
1053 | tag: tip |
|
1053 | tag: tip | |
1054 | user: test |
|
1054 | user: test | |
1055 | date: Thu Jan 01 00:00:20 1970 +0000 |
|
1055 | date: Thu Jan 01 00:00:20 1970 +0000 | |
1056 | summary: z |
|
1056 | summary: z | |
1057 |
|
1057 | |||
1058 | diff --git a/subdir/f1 b/subdir/f1 |
|
1058 | diff --git a/subdir/f1 b/subdir/f1 | |
1059 | old mode 100644 |
|
1059 | old mode 100644 | |
1060 | new mode 100755 |
|
1060 | new mode 100755 | |
1061 | --- a/subdir/f1 |
|
1061 | --- a/subdir/f1 | |
1062 | +++ b/subdir/f1 |
|
1062 | +++ b/subdir/f1 | |
1063 | @@ -1,2 +1,3 @@ |
|
1063 | @@ -1,2 +1,3 @@ | |
1064 | a |
|
1064 | a | |
1065 | a |
|
1065 | a | |
1066 | +a |
|
1066 | +a | |
1067 |
|
1067 | |||
1068 |
|
1068 | |||
1069 | Preserve execute permission on original |
|
1069 | Preserve execute permission on original | |
1070 |
|
1070 | |||
1071 | $ echo b >> f1 |
|
1071 | $ echo b >> f1 | |
1072 | $ hg commit -i -d '21 0' -maa <<EOF |
|
1072 | $ hg commit -i -d '21 0' -maa <<EOF | |
1073 | > y |
|
1073 | > y | |
1074 | > y |
|
1074 | > y | |
1075 | > y |
|
1075 | > y | |
1076 | > EOF |
|
1076 | > EOF | |
1077 | diff --git a/subdir/f1 b/subdir/f1 |
|
1077 | diff --git a/subdir/f1 b/subdir/f1 | |
1078 | 1 hunks, 1 lines changed |
|
1078 | 1 hunks, 1 lines changed | |
1079 | examine changes to 'subdir/f1'? [Ynesfdaq?] y |
|
1079 | examine changes to 'subdir/f1'? [Ynesfdaq?] y | |
1080 |
|
1080 | |||
1081 | @@ -1,3 +1,4 @@ |
|
1081 | @@ -1,3 +1,4 @@ | |
1082 | a |
|
1082 | a | |
1083 | a |
|
1083 | a | |
1084 | a |
|
1084 | a | |
1085 | +b |
|
1085 | +b | |
1086 | record this change to 'subdir/f1'? [Ynesfdaq?] y |
|
1086 | record this change to 'subdir/f1'? [Ynesfdaq?] y | |
1087 |
|
1087 | |||
1088 |
|
1088 | |||
1089 | $ hg tip --config diff.git=True -p |
|
1089 | $ hg tip --config diff.git=True -p | |
1090 | changeset: 25:88903aef81c3 |
|
1090 | changeset: 25:88903aef81c3 | |
1091 | tag: tip |
|
1091 | tag: tip | |
1092 | user: test |
|
1092 | user: test | |
1093 | date: Thu Jan 01 00:00:21 1970 +0000 |
|
1093 | date: Thu Jan 01 00:00:21 1970 +0000 | |
1094 | summary: aa |
|
1094 | summary: aa | |
1095 |
|
1095 | |||
1096 | diff --git a/subdir/f1 b/subdir/f1 |
|
1096 | diff --git a/subdir/f1 b/subdir/f1 | |
1097 | --- a/subdir/f1 |
|
1097 | --- a/subdir/f1 | |
1098 | +++ b/subdir/f1 |
|
1098 | +++ b/subdir/f1 | |
1099 | @@ -1,3 +1,4 @@ |
|
1099 | @@ -1,3 +1,4 @@ | |
1100 | a |
|
1100 | a | |
1101 | a |
|
1101 | a | |
1102 | a |
|
1102 | a | |
1103 | +b |
|
1103 | +b | |
1104 |
|
1104 | |||
1105 |
|
1105 | |||
1106 | Preserve chmod -x |
|
1106 | Preserve chmod -x | |
1107 |
|
1107 | |||
1108 | $ chmod -x f1 |
|
1108 | $ chmod -x f1 | |
1109 | $ echo c >> f1 |
|
1109 | $ echo c >> f1 | |
1110 | $ hg commit -i -d '22 0' -mab <<EOF |
|
1110 | $ hg commit -i -d '22 0' -mab <<EOF | |
1111 | > y |
|
1111 | > y | |
1112 | > y |
|
1112 | > y | |
1113 | > y |
|
1113 | > y | |
1114 | > EOF |
|
1114 | > EOF | |
1115 | diff --git a/subdir/f1 b/subdir/f1 |
|
1115 | diff --git a/subdir/f1 b/subdir/f1 | |
1116 | old mode 100755 |
|
1116 | old mode 100755 | |
1117 | new mode 100644 |
|
1117 | new mode 100644 | |
1118 | 1 hunks, 1 lines changed |
|
1118 | 1 hunks, 1 lines changed | |
1119 | examine changes to 'subdir/f1'? [Ynesfdaq?] y |
|
1119 | examine changes to 'subdir/f1'? [Ynesfdaq?] y | |
1120 |
|
1120 | |||
1121 | @@ -2,3 +2,4 @@ a |
|
1121 | @@ -2,3 +2,4 @@ a | |
1122 | a |
|
1122 | a | |
1123 | a |
|
1123 | a | |
1124 | b |
|
1124 | b | |
1125 | +c |
|
1125 | +c | |
1126 | record this change to 'subdir/f1'? [Ynesfdaq?] y |
|
1126 | record this change to 'subdir/f1'? [Ynesfdaq?] y | |
1127 |
|
1127 | |||
1128 |
|
1128 | |||
1129 | $ hg tip --config diff.git=True -p |
|
1129 | $ hg tip --config diff.git=True -p | |
1130 | changeset: 26:7af84b6cf560 |
|
1130 | changeset: 26:7af84b6cf560 | |
1131 | tag: tip |
|
1131 | tag: tip | |
1132 | user: test |
|
1132 | user: test | |
1133 | date: Thu Jan 01 00:00:22 1970 +0000 |
|
1133 | date: Thu Jan 01 00:00:22 1970 +0000 | |
1134 | summary: ab |
|
1134 | summary: ab | |
1135 |
|
1135 | |||
1136 | diff --git a/subdir/f1 b/subdir/f1 |
|
1136 | diff --git a/subdir/f1 b/subdir/f1 | |
1137 | old mode 100755 |
|
1137 | old mode 100755 | |
1138 | new mode 100644 |
|
1138 | new mode 100644 | |
1139 | --- a/subdir/f1 |
|
1139 | --- a/subdir/f1 | |
1140 | +++ b/subdir/f1 |
|
1140 | +++ b/subdir/f1 | |
1141 | @@ -2,3 +2,4 @@ |
|
1141 | @@ -2,3 +2,4 @@ | |
1142 | a |
|
1142 | a | |
1143 | a |
|
1143 | a | |
1144 | b |
|
1144 | b | |
1145 | +c |
|
1145 | +c | |
1146 |
|
1146 | |||
1147 |
|
1147 | |||
1148 | #else |
|
1148 | #else | |
1149 |
|
1149 | |||
1150 | Slightly bogus tests to get almost same repo structure as when x bit is used |
|
1150 | Slightly bogus tests to get almost same repo structure as when x bit is used | |
1151 | - but with different hashes. |
|
1151 | - but with different hashes. | |
1152 |
|
1152 | |||
1153 | Mock "Preserve chmod +x" |
|
1153 | Mock "Preserve chmod +x" | |
1154 |
|
1154 | |||
1155 | $ echo a >> f1 |
|
1155 | $ echo a >> f1 | |
1156 | $ hg commit -i -d '20 0' -mz <<EOF |
|
1156 | $ hg commit -i -d '20 0' -mz <<EOF | |
1157 | > y |
|
1157 | > y | |
1158 | > y |
|
1158 | > y | |
1159 | > y |
|
1159 | > y | |
1160 | > EOF |
|
1160 | > EOF | |
1161 | diff --git a/subdir/f1 b/subdir/f1 |
|
1161 | diff --git a/subdir/f1 b/subdir/f1 | |
1162 | 1 hunks, 1 lines changed |
|
1162 | 1 hunks, 1 lines changed | |
1163 | examine changes to 'subdir/f1'? [Ynesfdaq?] y |
|
1163 | examine changes to 'subdir/f1'? [Ynesfdaq?] y | |
1164 |
|
1164 | |||
1165 | @@ -1,2 +1,3 @@ |
|
1165 | @@ -1,2 +1,3 @@ | |
1166 | a |
|
1166 | a | |
1167 | a |
|
1167 | a | |
1168 | +a |
|
1168 | +a | |
1169 | record this change to 'subdir/f1'? [Ynesfdaq?] y |
|
1169 | record this change to 'subdir/f1'? [Ynesfdaq?] y | |
1170 |
|
1170 | |||
1171 |
|
1171 | |||
1172 | $ hg tip --config diff.git=True -p |
|
1172 | $ hg tip --config diff.git=True -p | |
1173 | changeset: 24:c26cfe2c4eb0 |
|
1173 | changeset: 24:c26cfe2c4eb0 | |
1174 | tag: tip |
|
1174 | tag: tip | |
1175 | user: test |
|
1175 | user: test | |
1176 | date: Thu Jan 01 00:00:20 1970 +0000 |
|
1176 | date: Thu Jan 01 00:00:20 1970 +0000 | |
1177 | summary: z |
|
1177 | summary: z | |
1178 |
|
1178 | |||
1179 | diff --git a/subdir/f1 b/subdir/f1 |
|
1179 | diff --git a/subdir/f1 b/subdir/f1 | |
1180 | --- a/subdir/f1 |
|
1180 | --- a/subdir/f1 | |
1181 | +++ b/subdir/f1 |
|
1181 | +++ b/subdir/f1 | |
1182 | @@ -1,2 +1,3 @@ |
|
1182 | @@ -1,2 +1,3 @@ | |
1183 | a |
|
1183 | a | |
1184 | a |
|
1184 | a | |
1185 | +a |
|
1185 | +a | |
1186 |
|
1186 | |||
1187 |
|
1187 | |||
1188 | Mock "Preserve execute permission on original" |
|
1188 | Mock "Preserve execute permission on original" | |
1189 |
|
1189 | |||
1190 | $ echo b >> f1 |
|
1190 | $ echo b >> f1 | |
1191 | $ hg commit -i -d '21 0' -maa <<EOF |
|
1191 | $ hg commit -i -d '21 0' -maa <<EOF | |
1192 | > y |
|
1192 | > y | |
1193 | > y |
|
1193 | > y | |
1194 | > y |
|
1194 | > y | |
1195 | > EOF |
|
1195 | > EOF | |
1196 | diff --git a/subdir/f1 b/subdir/f1 |
|
1196 | diff --git a/subdir/f1 b/subdir/f1 | |
1197 | 1 hunks, 1 lines changed |
|
1197 | 1 hunks, 1 lines changed | |
1198 | examine changes to 'subdir/f1'? [Ynesfdaq?] y |
|
1198 | examine changes to 'subdir/f1'? [Ynesfdaq?] y | |
1199 |
|
1199 | |||
1200 | @@ -1,3 +1,4 @@ |
|
1200 | @@ -1,3 +1,4 @@ | |
1201 | a |
|
1201 | a | |
1202 | a |
|
1202 | a | |
1203 | a |
|
1203 | a | |
1204 | +b |
|
1204 | +b | |
1205 | record this change to 'subdir/f1'? [Ynesfdaq?] y |
|
1205 | record this change to 'subdir/f1'? [Ynesfdaq?] y | |
1206 |
|
1206 | |||
1207 |
|
1207 | |||
1208 | $ hg tip --config diff.git=True -p |
|
1208 | $ hg tip --config diff.git=True -p | |
1209 | changeset: 25:a48d2d60adde |
|
1209 | changeset: 25:a48d2d60adde | |
1210 | tag: tip |
|
1210 | tag: tip | |
1211 | user: test |
|
1211 | user: test | |
1212 | date: Thu Jan 01 00:00:21 1970 +0000 |
|
1212 | date: Thu Jan 01 00:00:21 1970 +0000 | |
1213 | summary: aa |
|
1213 | summary: aa | |
1214 |
|
1214 | |||
1215 | diff --git a/subdir/f1 b/subdir/f1 |
|
1215 | diff --git a/subdir/f1 b/subdir/f1 | |
1216 | --- a/subdir/f1 |
|
1216 | --- a/subdir/f1 | |
1217 | +++ b/subdir/f1 |
|
1217 | +++ b/subdir/f1 | |
1218 | @@ -1,3 +1,4 @@ |
|
1218 | @@ -1,3 +1,4 @@ | |
1219 | a |
|
1219 | a | |
1220 | a |
|
1220 | a | |
1221 | a |
|
1221 | a | |
1222 | +b |
|
1222 | +b | |
1223 |
|
1223 | |||
1224 |
|
1224 | |||
1225 | Mock "Preserve chmod -x" |
|
1225 | Mock "Preserve chmod -x" | |
1226 |
|
1226 | |||
1227 | $ chmod -x f1 |
|
1227 | $ chmod -x f1 | |
1228 | $ echo c >> f1 |
|
1228 | $ echo c >> f1 | |
1229 | $ hg commit -i -d '22 0' -mab <<EOF |
|
1229 | $ hg commit -i -d '22 0' -mab <<EOF | |
1230 | > y |
|
1230 | > y | |
1231 | > y |
|
1231 | > y | |
1232 | > y |
|
1232 | > y | |
1233 | > EOF |
|
1233 | > EOF | |
1234 | diff --git a/subdir/f1 b/subdir/f1 |
|
1234 | diff --git a/subdir/f1 b/subdir/f1 | |
1235 | 1 hunks, 1 lines changed |
|
1235 | 1 hunks, 1 lines changed | |
1236 | examine changes to 'subdir/f1'? [Ynesfdaq?] y |
|
1236 | examine changes to 'subdir/f1'? [Ynesfdaq?] y | |
1237 |
|
1237 | |||
1238 | @@ -2,3 +2,4 @@ a |
|
1238 | @@ -2,3 +2,4 @@ a | |
1239 | a |
|
1239 | a | |
1240 | a |
|
1240 | a | |
1241 | b |
|
1241 | b | |
1242 | +c |
|
1242 | +c | |
1243 | record this change to 'subdir/f1'? [Ynesfdaq?] y |
|
1243 | record this change to 'subdir/f1'? [Ynesfdaq?] y | |
1244 |
|
1244 | |||
1245 |
|
1245 | |||
1246 | $ hg tip --config diff.git=True -p |
|
1246 | $ hg tip --config diff.git=True -p | |
1247 | changeset: 26:5cc89ae210fa |
|
1247 | changeset: 26:5cc89ae210fa | |
1248 | tag: tip |
|
1248 | tag: tip | |
1249 | user: test |
|
1249 | user: test | |
1250 | date: Thu Jan 01 00:00:22 1970 +0000 |
|
1250 | date: Thu Jan 01 00:00:22 1970 +0000 | |
1251 | summary: ab |
|
1251 | summary: ab | |
1252 |
|
1252 | |||
1253 | diff --git a/subdir/f1 b/subdir/f1 |
|
1253 | diff --git a/subdir/f1 b/subdir/f1 | |
1254 | --- a/subdir/f1 |
|
1254 | --- a/subdir/f1 | |
1255 | +++ b/subdir/f1 |
|
1255 | +++ b/subdir/f1 | |
1256 | @@ -2,3 +2,4 @@ |
|
1256 | @@ -2,3 +2,4 @@ | |
1257 | a |
|
1257 | a | |
1258 | a |
|
1258 | a | |
1259 | b |
|
1259 | b | |
1260 | +c |
|
1260 | +c | |
1261 |
|
1261 | |||
1262 |
|
1262 | |||
1263 | #endif |
|
1263 | #endif | |
1264 |
|
1264 | |||
1265 | $ cd .. |
|
1265 | $ cd .. | |
1266 |
|
1266 | |||
1267 |
|
1267 | |||
1268 | Abort early when a merge is in progress |
|
1268 | Abort early when a merge is in progress | |
1269 |
|
1269 | |||
1270 | $ hg up 4 |
|
1270 | $ hg up 4 | |
1271 | 1 files updated, 0 files merged, 7 files removed, 0 files unresolved |
|
1271 | 1 files updated, 0 files merged, 7 files removed, 0 files unresolved | |
1272 |
|
1272 | |||
1273 | $ touch iwillmergethat |
|
1273 | $ touch iwillmergethat | |
1274 | $ hg add iwillmergethat |
|
1274 | $ hg add iwillmergethat | |
1275 |
|
1275 | |||
1276 | $ hg branch thatbranch |
|
1276 | $ hg branch thatbranch | |
1277 | marked working directory as branch thatbranch |
|
1277 | marked working directory as branch thatbranch | |
1278 | (branches are permanent and global, did you want a bookmark?) |
|
1278 | (branches are permanent and global, did you want a bookmark?) | |
1279 |
|
1279 | |||
1280 | $ hg ci -m'new head' |
|
1280 | $ hg ci -m'new head' | |
1281 |
|
1281 | |||
1282 | $ hg up default |
|
1282 | $ hg up default | |
1283 | 7 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
1283 | 7 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
1284 |
|
1284 | |||
1285 | $ hg merge thatbranch |
|
1285 | $ hg merge thatbranch | |
1286 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1286 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1287 | (branch merge, don't forget to commit) |
|
1287 | (branch merge, don't forget to commit) | |
1288 |
|
1288 | |||
1289 | $ hg commit -i -m'will abort' |
|
1289 | $ hg commit -i -m'will abort' | |
1290 | abort: cannot partially commit a merge (use "hg commit" instead) |
|
1290 | abort: cannot partially commit a merge (use "hg commit" instead) | |
1291 | [255] |
|
1291 | [255] | |
1292 |
|
1292 | |||
1293 | $ hg up -C |
|
1293 | $ hg up -C | |
1294 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1294 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1295 |
|
1295 | |||
1296 | Editing patch (and ignoring trailing text) |
|
1296 | Editing patch (and ignoring trailing text) | |
1297 |
|
1297 | |||
1298 | $ cat > editor.sh << '__EOF__' |
|
1298 | $ cat > editor.sh << '__EOF__' | |
1299 | > sed -e 7d -e '5s/^-/ /' -e '/^# ---/i\ |
|
1299 | > sed -e 7d -e '5s/^-/ /' -e '/^# ---/i\ | |
1300 | > trailing\nditto' "$1" > tmp |
|
1300 | > trailing\nditto' "$1" > tmp | |
1301 | > mv tmp "$1" |
|
1301 | > mv tmp "$1" | |
1302 | > __EOF__ |
|
1302 | > __EOF__ | |
1303 | $ cat > editedfile << '__EOF__' |
|
1303 | $ cat > editedfile << '__EOF__' | |
1304 | > This is the first line |
|
1304 | > This is the first line | |
1305 | > This is the second line |
|
1305 | > This is the second line | |
1306 | > This is the third line |
|
1306 | > This is the third line | |
1307 | > __EOF__ |
|
1307 | > __EOF__ | |
1308 | $ hg add editedfile |
|
1308 | $ hg add editedfile | |
1309 | $ hg commit -medit-patch-1 |
|
1309 | $ hg commit -medit-patch-1 | |
1310 | $ cat > editedfile << '__EOF__' |
|
1310 | $ cat > editedfile << '__EOF__' | |
1311 | > This line has changed |
|
1311 | > This line has changed | |
1312 | > This change will be committed |
|
1312 | > This change will be committed | |
1313 | > This is the third line |
|
1313 | > This is the third line | |
1314 | > __EOF__ |
|
1314 | > __EOF__ | |
1315 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -d '23 0' -medit-patch-2 <<EOF |
|
1315 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -d '23 0' -medit-patch-2 <<EOF | |
1316 | > y |
|
1316 | > y | |
1317 | > e |
|
1317 | > e | |
1318 | > EOF |
|
1318 | > EOF | |
1319 | diff --git a/editedfile b/editedfile |
|
1319 | diff --git a/editedfile b/editedfile | |
1320 | 1 hunks, 2 lines changed |
|
1320 | 1 hunks, 2 lines changed | |
1321 | examine changes to 'editedfile'? [Ynesfdaq?] y |
|
1321 | examine changes to 'editedfile'? [Ynesfdaq?] y | |
1322 |
|
1322 | |||
1323 | @@ -1,3 +1,3 @@ |
|
1323 | @@ -1,3 +1,3 @@ | |
1324 | -This is the first line |
|
1324 | -This is the first line | |
1325 | -This is the second line |
|
1325 | -This is the second line | |
1326 | +This line has changed |
|
1326 | +This line has changed | |
1327 | +This change will be committed |
|
1327 | +This change will be committed | |
1328 | This is the third line |
|
1328 | This is the third line | |
1329 | record this change to 'editedfile'? [Ynesfdaq?] e |
|
1329 | record this change to 'editedfile'? [Ynesfdaq?] e | |
1330 |
|
1330 | |||
1331 | $ cat editedfile |
|
1331 | $ cat editedfile | |
1332 | This line has changed |
|
1332 | This line has changed | |
1333 | This change will be committed |
|
1333 | This change will be committed | |
1334 | This is the third line |
|
1334 | This is the third line | |
1335 | $ hg cat -r tip editedfile |
|
1335 | $ hg cat -r tip editedfile | |
1336 | This is the first line |
|
1336 | This is the first line | |
1337 | This change will be committed |
|
1337 | This change will be committed | |
1338 | This is the third line |
|
1338 | This is the third line | |
1339 | $ hg revert editedfile |
|
1339 | $ hg revert editedfile | |
1340 |
|
1340 | |||
1341 | Trying to edit patch for whole file |
|
1341 | Trying to edit patch for whole file | |
1342 |
|
1342 | |||
1343 | $ echo "This is the fourth line" >> editedfile |
|
1343 | $ echo "This is the fourth line" >> editedfile | |
1344 | $ hg commit -i <<EOF |
|
1344 | $ hg commit -i <<EOF | |
1345 | > e |
|
1345 | > e | |
1346 | > q |
|
1346 | > q | |
1347 | > EOF |
|
1347 | > EOF | |
1348 | diff --git a/editedfile b/editedfile |
|
1348 | diff --git a/editedfile b/editedfile | |
1349 | 1 hunks, 1 lines changed |
|
1349 | 1 hunks, 1 lines changed | |
1350 | examine changes to 'editedfile'? [Ynesfdaq?] e |
|
1350 | examine changes to 'editedfile'? [Ynesfdaq?] e | |
1351 |
|
1351 | |||
1352 | cannot edit patch for whole file |
|
1352 | cannot edit patch for whole file | |
1353 | examine changes to 'editedfile'? [Ynesfdaq?] q |
|
1353 | examine changes to 'editedfile'? [Ynesfdaq?] q | |
1354 |
|
1354 | |||
1355 | abort: user quit |
|
1355 | abort: user quit | |
1356 | [255] |
|
1356 | [255] | |
1357 | $ hg revert editedfile |
|
1357 | $ hg revert editedfile | |
1358 |
|
1358 | |||
1359 | Removing changes from patch |
|
1359 | Removing changes from patch | |
1360 |
|
1360 | |||
1361 | $ sed -e '3s/third/second/' -e '2s/will/will not/' -e 1d editedfile > tmp |
|
1361 | $ sed -e '3s/third/second/' -e '2s/will/will not/' -e 1d editedfile > tmp | |
1362 | $ mv tmp editedfile |
|
1362 | $ mv tmp editedfile | |
1363 | $ echo "This line has been added" >> editedfile |
|
1363 | $ echo "This line has been added" >> editedfile | |
1364 | $ cat > editor.sh << '__EOF__' |
|
1364 | $ cat > editor.sh << '__EOF__' | |
1365 | > sed -e 's/^[-+]/ /' "$1" > tmp |
|
1365 | > sed -e 's/^[-+]/ /' "$1" > tmp | |
1366 | > mv tmp "$1" |
|
1366 | > mv tmp "$1" | |
1367 | > __EOF__ |
|
1367 | > __EOF__ | |
1368 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i <<EOF |
|
1368 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i <<EOF | |
1369 | > y |
|
1369 | > y | |
1370 | > e |
|
1370 | > e | |
1371 | > EOF |
|
1371 | > EOF | |
1372 | diff --git a/editedfile b/editedfile |
|
1372 | diff --git a/editedfile b/editedfile | |
1373 | 1 hunks, 3 lines changed |
|
1373 | 1 hunks, 3 lines changed | |
1374 | examine changes to 'editedfile'? [Ynesfdaq?] y |
|
1374 | examine changes to 'editedfile'? [Ynesfdaq?] y | |
1375 |
|
1375 | |||
1376 | @@ -1,3 +1,3 @@ |
|
1376 | @@ -1,3 +1,3 @@ | |
1377 | -This is the first line |
|
1377 | -This is the first line | |
1378 | -This change will be committed |
|
1378 | -This change will be committed | |
1379 | -This is the third line |
|
1379 | -This is the third line | |
1380 | +This change will not be committed |
|
1380 | +This change will not be committed | |
1381 | +This is the second line |
|
1381 | +This is the second line | |
1382 | +This line has been added |
|
1382 | +This line has been added | |
1383 | record this change to 'editedfile'? [Ynesfdaq?] e |
|
1383 | record this change to 'editedfile'? [Ynesfdaq?] e | |
1384 |
|
1384 | |||
1385 | no changes to record |
|
1385 | no changes to record | |
1386 | [1] |
|
1386 | [1] | |
1387 | $ cat editedfile |
|
1387 | $ cat editedfile | |
1388 | This change will not be committed |
|
1388 | This change will not be committed | |
1389 | This is the second line |
|
1389 | This is the second line | |
1390 | This line has been added |
|
1390 | This line has been added | |
1391 | $ hg cat -r tip editedfile |
|
1391 | $ hg cat -r tip editedfile | |
1392 | This is the first line |
|
1392 | This is the first line | |
1393 | This change will be committed |
|
1393 | This change will be committed | |
1394 | This is the third line |
|
1394 | This is the third line | |
1395 | $ hg revert editedfile |
|
1395 | $ hg revert editedfile | |
1396 |
|
1396 | |||
1397 | Invalid patch |
|
1397 | Invalid patch | |
1398 |
|
1398 | |||
1399 | $ sed -e '3s/third/second/' -e '2s/will/will not/' -e 1d editedfile > tmp |
|
1399 | $ sed -e '3s/third/second/' -e '2s/will/will not/' -e 1d editedfile > tmp | |
1400 | $ mv tmp editedfile |
|
1400 | $ mv tmp editedfile | |
1401 | $ echo "This line has been added" >> editedfile |
|
1401 | $ echo "This line has been added" >> editedfile | |
1402 | $ cat > editor.sh << '__EOF__' |
|
1402 | $ cat > editor.sh << '__EOF__' | |
1403 | > sed s/This/That/ "$1" > tmp |
|
1403 | > sed s/This/That/ "$1" > tmp | |
1404 | > mv tmp "$1" |
|
1404 | > mv tmp "$1" | |
1405 | > __EOF__ |
|
1405 | > __EOF__ | |
1406 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i <<EOF |
|
1406 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i <<EOF | |
1407 | > y |
|
1407 | > y | |
1408 | > e |
|
1408 | > e | |
1409 | > EOF |
|
1409 | > EOF | |
1410 | diff --git a/editedfile b/editedfile |
|
1410 | diff --git a/editedfile b/editedfile | |
1411 | 1 hunks, 3 lines changed |
|
1411 | 1 hunks, 3 lines changed | |
1412 | examine changes to 'editedfile'? [Ynesfdaq?] y |
|
1412 | examine changes to 'editedfile'? [Ynesfdaq?] y | |
1413 |
|
1413 | |||
1414 | @@ -1,3 +1,3 @@ |
|
1414 | @@ -1,3 +1,3 @@ | |
1415 | -This is the first line |
|
1415 | -This is the first line | |
1416 | -This change will be committed |
|
1416 | -This change will be committed | |
1417 | -This is the third line |
|
1417 | -This is the third line | |
1418 | +This change will not be committed |
|
1418 | +This change will not be committed | |
1419 | +This is the second line |
|
1419 | +This is the second line | |
1420 | +This line has been added |
|
1420 | +This line has been added | |
1421 | record this change to 'editedfile'? [Ynesfdaq?] e |
|
1421 | record this change to 'editedfile'? [Ynesfdaq?] e | |
1422 |
|
1422 | |||
1423 | patching file editedfile |
|
1423 | patching file editedfile | |
1424 | Hunk #1 FAILED at 0 |
|
1424 | Hunk #1 FAILED at 0 | |
1425 | 1 out of 1 hunks FAILED -- saving rejects to file editedfile.rej |
|
1425 | 1 out of 1 hunks FAILED -- saving rejects to file editedfile.rej | |
1426 | abort: patch failed to apply |
|
1426 | abort: patch failed to apply | |
1427 | [255] |
|
1427 | [255] | |
1428 | $ cat editedfile |
|
1428 | $ cat editedfile | |
1429 | This change will not be committed |
|
1429 | This change will not be committed | |
1430 | This is the second line |
|
1430 | This is the second line | |
1431 | This line has been added |
|
1431 | This line has been added | |
1432 | $ hg cat -r tip editedfile |
|
1432 | $ hg cat -r tip editedfile | |
1433 | This is the first line |
|
1433 | This is the first line | |
1434 | This change will be committed |
|
1434 | This change will be committed | |
1435 | This is the third line |
|
1435 | This is the third line | |
1436 | $ cat editedfile.rej |
|
1436 | $ cat editedfile.rej | |
1437 | --- editedfile |
|
1437 | --- editedfile | |
1438 | +++ editedfile |
|
1438 | +++ editedfile | |
1439 | @@ -1,3 +1,3 @@ |
|
1439 | @@ -1,3 +1,3 @@ | |
1440 | -That is the first line |
|
1440 | -That is the first line | |
1441 | -That change will be committed |
|
1441 | -That change will be committed | |
1442 | -That is the third line |
|
1442 | -That is the third line | |
1443 | +That change will not be committed |
|
1443 | +That change will not be committed | |
1444 | +That is the second line |
|
1444 | +That is the second line | |
1445 | +That line has been added |
|
1445 | +That line has been added | |
1446 |
|
1446 | |||
1447 | Malformed patch - error handling |
|
1447 | Malformed patch - error handling | |
1448 |
|
1448 | |||
1449 | $ cat > editor.sh << '__EOF__' |
|
1449 | $ cat > editor.sh << '__EOF__' | |
1450 | > sed -e '/^@/p' "$1" > tmp |
|
1450 | > sed -e '/^@/p' "$1" > tmp | |
1451 | > mv tmp "$1" |
|
1451 | > mv tmp "$1" | |
1452 | > __EOF__ |
|
1452 | > __EOF__ | |
1453 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i <<EOF |
|
1453 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i <<EOF | |
1454 | > y |
|
1454 | > y | |
1455 | > e |
|
1455 | > e | |
1456 | > EOF |
|
1456 | > EOF | |
1457 | diff --git a/editedfile b/editedfile |
|
1457 | diff --git a/editedfile b/editedfile | |
1458 | 1 hunks, 3 lines changed |
|
1458 | 1 hunks, 3 lines changed | |
1459 | examine changes to 'editedfile'? [Ynesfdaq?] y |
|
1459 | examine changes to 'editedfile'? [Ynesfdaq?] y | |
1460 |
|
1460 | |||
1461 | @@ -1,3 +1,3 @@ |
|
1461 | @@ -1,3 +1,3 @@ | |
1462 | -This is the first line |
|
1462 | -This is the first line | |
1463 | -This change will be committed |
|
1463 | -This change will be committed | |
1464 | -This is the third line |
|
1464 | -This is the third line | |
1465 | +This change will not be committed |
|
1465 | +This change will not be committed | |
1466 | +This is the second line |
|
1466 | +This is the second line | |
1467 | +This line has been added |
|
1467 | +This line has been added | |
1468 | record this change to 'editedfile'? [Ynesfdaq?] e |
|
1468 | record this change to 'editedfile'? [Ynesfdaq?] e | |
1469 |
|
1469 | |||
1470 | abort: error parsing patch: unhandled transition: range -> range |
|
1470 | abort: error parsing patch: unhandled transition: range -> range | |
1471 | [255] |
|
1471 | [255] | |
1472 |
|
1472 | |||
1473 | Exiting editor with status 1, ignores the edit but does not stop the recording |
|
1473 | Exiting editor with status 1, ignores the edit but does not stop the recording | |
1474 | session |
|
1474 | session | |
1475 |
|
1475 | |||
1476 | $ HGEDITOR=false hg commit -i <<EOF |
|
1476 | $ HGEDITOR=false hg commit -i <<EOF | |
1477 | > y |
|
1477 | > y | |
1478 | > e |
|
1478 | > e | |
1479 | > n |
|
1479 | > n | |
1480 | > EOF |
|
1480 | > EOF | |
1481 | diff --git a/editedfile b/editedfile |
|
1481 | diff --git a/editedfile b/editedfile | |
1482 | 1 hunks, 3 lines changed |
|
1482 | 1 hunks, 3 lines changed | |
1483 | examine changes to 'editedfile'? [Ynesfdaq?] y |
|
1483 | examine changes to 'editedfile'? [Ynesfdaq?] y | |
1484 |
|
1484 | |||
1485 | @@ -1,3 +1,3 @@ |
|
1485 | @@ -1,3 +1,3 @@ | |
1486 | -This is the first line |
|
1486 | -This is the first line | |
1487 | -This change will be committed |
|
1487 | -This change will be committed | |
1488 | -This is the third line |
|
1488 | -This is the third line | |
1489 | +This change will not be committed |
|
1489 | +This change will not be committed | |
1490 | +This is the second line |
|
1490 | +This is the second line | |
1491 | +This line has been added |
|
1491 | +This line has been added | |
1492 | record this change to 'editedfile'? [Ynesfdaq?] e |
|
1492 | record this change to 'editedfile'? [Ynesfdaq?] e | |
1493 |
|
1493 | |||
1494 | editor exited with exit code 1 |
|
1494 | editor exited with exit code 1 | |
1495 | record this change to 'editedfile'? [Ynesfdaq?] n |
|
1495 | record this change to 'editedfile'? [Ynesfdaq?] n | |
1496 |
|
1496 | |||
1497 | no changes to record |
|
1497 | no changes to record | |
1498 | [1] |
|
1498 | [1] | |
1499 |
|
1499 | |||
1500 |
|
1500 | |||
1501 | random text in random positions is still an error |
|
1501 | random text in random positions is still an error | |
1502 |
|
1502 | |||
1503 | $ cat > editor.sh << '__EOF__' |
|
1503 | $ cat > editor.sh << '__EOF__' | |
1504 | > sed -e '/^@/i\ |
|
1504 | > sed -e '/^@/i\ | |
1505 | > other' "$1" > tmp |
|
1505 | > other' "$1" > tmp | |
1506 | > mv tmp "$1" |
|
1506 | > mv tmp "$1" | |
1507 | > __EOF__ |
|
1507 | > __EOF__ | |
1508 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i <<EOF |
|
1508 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i <<EOF | |
1509 | > y |
|
1509 | > y | |
1510 | > e |
|
1510 | > e | |
1511 | > EOF |
|
1511 | > EOF | |
1512 | diff --git a/editedfile b/editedfile |
|
1512 | diff --git a/editedfile b/editedfile | |
1513 | 1 hunks, 3 lines changed |
|
1513 | 1 hunks, 3 lines changed | |
1514 | examine changes to 'editedfile'? [Ynesfdaq?] y |
|
1514 | examine changes to 'editedfile'? [Ynesfdaq?] y | |
1515 |
|
1515 | |||
1516 | @@ -1,3 +1,3 @@ |
|
1516 | @@ -1,3 +1,3 @@ | |
1517 | -This is the first line |
|
1517 | -This is the first line | |
1518 | -This change will be committed |
|
1518 | -This change will be committed | |
1519 | -This is the third line |
|
1519 | -This is the third line | |
1520 | +This change will not be committed |
|
1520 | +This change will not be committed | |
1521 | +This is the second line |
|
1521 | +This is the second line | |
1522 | +This line has been added |
|
1522 | +This line has been added | |
1523 | record this change to 'editedfile'? [Ynesfdaq?] e |
|
1523 | record this change to 'editedfile'? [Ynesfdaq?] e | |
1524 |
|
1524 | |||
1525 | abort: error parsing patch: unhandled transition: file -> other |
|
1525 | abort: error parsing patch: unhandled transition: file -> other | |
1526 | [255] |
|
1526 | [255] | |
1527 |
|
1527 | |||
1528 | $ hg up -C |
|
1528 | $ hg up -C | |
1529 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1529 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1530 |
|
1530 | |||
1531 | With win32text |
|
1531 | With win32text | |
1532 |
|
1532 | |||
1533 | $ echo '[extensions]' >> .hg/hgrc |
|
1533 | $ echo '[extensions]' >> .hg/hgrc | |
1534 | $ echo 'win32text = ' >> .hg/hgrc |
|
1534 | $ echo 'win32text = ' >> .hg/hgrc | |
1535 | $ echo '[decode]' >> .hg/hgrc |
|
1535 | $ echo '[decode]' >> .hg/hgrc | |
1536 | $ echo '** = cleverdecode:' >> .hg/hgrc |
|
1536 | $ echo '** = cleverdecode:' >> .hg/hgrc | |
1537 | $ echo '[encode]' >> .hg/hgrc |
|
1537 | $ echo '[encode]' >> .hg/hgrc | |
1538 | $ echo '** = cleverencode:' >> .hg/hgrc |
|
1538 | $ echo '** = cleverencode:' >> .hg/hgrc | |
1539 | $ echo '[patch]' >> .hg/hgrc |
|
1539 | $ echo '[patch]' >> .hg/hgrc | |
1540 | $ echo 'eol = crlf' >> .hg/hgrc |
|
1540 | $ echo 'eol = crlf' >> .hg/hgrc | |
1541 |
|
1541 | |||
1542 | Ignore win32text deprecation warning for now: |
|
1542 | Ignore win32text deprecation warning for now: | |
1543 |
|
1543 | |||
1544 | $ echo '[win32text]' >> .hg/hgrc |
|
1544 | $ echo '[win32text]' >> .hg/hgrc | |
1545 | $ echo 'warn = no' >> .hg/hgrc |
|
1545 | $ echo 'warn = no' >> .hg/hgrc | |
1546 |
|
1546 | |||
1547 | $ echo d >> subdir/f1 |
|
1547 | $ echo d >> subdir/f1 | |
1548 | $ hg commit -i -d '24 0' -mw1 <<EOF |
|
1548 | $ hg commit -i -d '24 0' -mw1 <<EOF | |
1549 | > y |
|
1549 | > y | |
1550 | > y |
|
1550 | > y | |
1551 | > EOF |
|
1551 | > EOF | |
1552 | diff --git a/subdir/f1 b/subdir/f1 |
|
1552 | diff --git a/subdir/f1 b/subdir/f1 | |
1553 | 1 hunks, 1 lines changed |
|
1553 | 1 hunks, 1 lines changed | |
1554 | examine changes to 'subdir/f1'? [Ynesfdaq?] y |
|
1554 | examine changes to 'subdir/f1'? [Ynesfdaq?] y | |
1555 |
|
1555 | |||
1556 | @@ -3,3 +3,4 @@ a |
|
1556 | @@ -3,3 +3,4 @@ a | |
1557 | a |
|
1557 | a | |
1558 | b |
|
1558 | b | |
1559 | c |
|
1559 | c | |
1560 | +d |
|
1560 | +d | |
1561 | record this change to 'subdir/f1'? [Ynesfdaq?] y |
|
1561 | record this change to 'subdir/f1'? [Ynesfdaq?] y | |
1562 |
|
1562 | |||
1563 |
|
1563 | |||
1564 | $ hg status -A subdir/f1 |
|
1564 | $ hg status -A subdir/f1 | |
1565 | C subdir/f1 |
|
1565 | C subdir/f1 | |
1566 | $ hg tip -p |
|
1566 | $ hg tip -p | |
1567 | changeset: 30:* (glob) |
|
1567 | changeset: 30:* (glob) | |
1568 | tag: tip |
|
1568 | tag: tip | |
1569 | user: test |
|
1569 | user: test | |
1570 | date: Thu Jan 01 00:00:24 1970 +0000 |
|
1570 | date: Thu Jan 01 00:00:24 1970 +0000 | |
1571 | summary: w1 |
|
1571 | summary: w1 | |
1572 |
|
1572 | |||
1573 | diff -r ???????????? -r ???????????? subdir/f1 (glob) |
|
1573 | diff -r ???????????? -r ???????????? subdir/f1 (glob) | |
1574 | --- a/subdir/f1 Thu Jan 01 00:00:23 1970 +0000 |
|
1574 | --- a/subdir/f1 Thu Jan 01 00:00:23 1970 +0000 | |
1575 | +++ b/subdir/f1 Thu Jan 01 00:00:24 1970 +0000 |
|
1575 | +++ b/subdir/f1 Thu Jan 01 00:00:24 1970 +0000 | |
1576 | @@ -3,3 +3,4 @@ |
|
1576 | @@ -3,3 +3,4 @@ | |
1577 | a |
|
1577 | a | |
1578 | b |
|
1578 | b | |
1579 | c |
|
1579 | c | |
1580 | +d |
|
1580 | +d | |
1581 |
|
1581 | |||
1582 |
|
1582 | |||
1583 |
|
1583 | |||
1584 | Test --user when ui.username not set |
|
1584 | Test --user when ui.username not set | |
1585 | $ unset HGUSER |
|
1585 | $ unset HGUSER | |
1586 | $ echo e >> subdir/f1 |
|
1586 | $ echo e >> subdir/f1 | |
1587 | $ hg commit -i --config ui.username= -d '8 0' --user xyz -m "user flag" <<EOF |
|
1587 | $ hg commit -i --config ui.username= -d '8 0' --user xyz -m "user flag" <<EOF | |
1588 | > y |
|
1588 | > y | |
1589 | > y |
|
1589 | > y | |
1590 | > EOF |
|
1590 | > EOF | |
1591 | diff --git a/subdir/f1 b/subdir/f1 |
|
1591 | diff --git a/subdir/f1 b/subdir/f1 | |
1592 | 1 hunks, 1 lines changed |
|
1592 | 1 hunks, 1 lines changed | |
1593 | examine changes to 'subdir/f1'? [Ynesfdaq?] y |
|
1593 | examine changes to 'subdir/f1'? [Ynesfdaq?] y | |
1594 |
|
1594 | |||
1595 | @@ -4,3 +4,4 @@ a |
|
1595 | @@ -4,3 +4,4 @@ a | |
1596 | b |
|
1596 | b | |
1597 | c |
|
1597 | c | |
1598 | d |
|
1598 | d | |
1599 | +e |
|
1599 | +e | |
1600 | record this change to 'subdir/f1'? [Ynesfdaq?] y |
|
1600 | record this change to 'subdir/f1'? [Ynesfdaq?] y | |
1601 |
|
1601 | |||
1602 | $ hg status -A subdir/f1 |
|
1602 | $ hg status -A subdir/f1 | |
1603 | C subdir/f1 |
|
1603 | C subdir/f1 | |
1604 | $ hg log --template '{author}\n' -l 1 |
|
1604 | $ hg log --template '{author}\n' -l 1 | |
1605 | xyz |
|
1605 | xyz | |
1606 | $ HGUSER="test" |
|
1606 | $ HGUSER="test" | |
1607 | $ export HGUSER |
|
1607 | $ export HGUSER | |
1608 |
|
1608 | |||
1609 |
|
1609 | |||
1610 | Moving files |
|
1610 | Moving files | |
1611 |
|
1611 | |||
1612 | $ hg update -C . |
|
1612 | $ hg update -C . | |
1613 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1613 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1614 | $ hg mv plain plain3 |
|
1614 | $ hg mv plain plain3 | |
1615 | $ echo somechange >> plain3 |
|
1615 | $ echo somechange >> plain3 | |
1616 | $ hg commit -i -d '23 0' -mmoving_files << EOF |
|
1616 | $ hg commit -i -d '23 0' -mmoving_files << EOF | |
1617 | > y |
|
1617 | > y | |
1618 | > y |
|
1618 | > y | |
1619 | > EOF |
|
1619 | > EOF | |
1620 | diff --git a/plain b/plain3 |
|
1620 | diff --git a/plain b/plain3 | |
1621 | rename from plain |
|
1621 | rename from plain | |
1622 | rename to plain3 |
|
1622 | rename to plain3 | |
1623 | 1 hunks, 1 lines changed |
|
1623 | 1 hunks, 1 lines changed | |
1624 | examine changes to 'plain' and 'plain3'? [Ynesfdaq?] y |
|
1624 | examine changes to 'plain' and 'plain3'? [Ynesfdaq?] y | |
1625 |
|
1625 | |||
1626 | @@ -11,3 +11,4 @@ 8 |
|
1626 | @@ -11,3 +11,4 @@ 8 | |
1627 | 9 |
|
1627 | 9 | |
1628 | 10 |
|
1628 | 10 | |
1629 | 11 |
|
1629 | 11 | |
1630 | +somechange |
|
1630 | +somechange | |
1631 | record this change to 'plain3'? [Ynesfdaq?] y |
|
1631 | record this change to 'plain3'? [Ynesfdaq?] y | |
1632 |
|
1632 | |||
1633 | The #if execbit block above changes the hash here on some systems |
|
1633 | The #if execbit block above changes the hash here on some systems | |
1634 | $ hg status -A plain3 |
|
1634 | $ hg status -A plain3 | |
1635 | C plain3 |
|
1635 | C plain3 | |
1636 | $ hg tip |
|
1636 | $ hg tip | |
1637 | changeset: 32:* (glob) |
|
1637 | changeset: 32:* (glob) | |
1638 | tag: tip |
|
1638 | tag: tip | |
1639 | user: test |
|
1639 | user: test | |
1640 | date: Thu Jan 01 00:00:23 1970 +0000 |
|
1640 | date: Thu Jan 01 00:00:23 1970 +0000 | |
1641 | summary: moving_files |
|
1641 | summary: moving_files | |
1642 |
|
1642 | |||
1643 | Editing patch of newly added file |
|
1643 | Editing patch of newly added file | |
1644 |
|
1644 | |||
1645 | $ hg update -C . |
|
1645 | $ hg update -C . | |
1646 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1646 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1647 | $ cat > editor.sh << '__EOF__' |
|
1647 | $ cat > editor.sh << '__EOF__' | |
1648 | > cat "$1" | sed "s/first/very/g" > tt |
|
1648 | > cat "$1" | sed "s/first/very/g" > tt | |
1649 | > mv tt "$1" |
|
1649 | > mv tt "$1" | |
1650 | > __EOF__ |
|
1650 | > __EOF__ | |
1651 | $ cat > newfile << '__EOF__' |
|
1651 | $ cat > newfile << '__EOF__' | |
1652 | > This is the first line |
|
1652 | > This is the first line | |
1653 | > This is the second line |
|
1653 | > This is the second line | |
1654 | > This is the third line |
|
1654 | > This is the third line | |
1655 | > __EOF__ |
|
1655 | > __EOF__ | |
1656 | $ hg add newfile |
|
1656 | $ hg add newfile | |
1657 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -d '23 0' -medit-patch-new <<EOF |
|
1657 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -d '23 0' -medit-patch-new <<EOF | |
1658 | > y |
|
1658 | > y | |
1659 | > e |
|
1659 | > e | |
1660 | > EOF |
|
1660 | > EOF | |
1661 | diff --git a/newfile b/newfile |
|
1661 | diff --git a/newfile b/newfile | |
1662 | new file mode 100644 |
|
1662 | new file mode 100644 | |
1663 | examine changes to 'newfile'? [Ynesfdaq?] y |
|
1663 | examine changes to 'newfile'? [Ynesfdaq?] y | |
1664 |
|
1664 | |||
1665 | @@ -0,0 +1,3 @@ |
|
1665 | @@ -0,0 +1,3 @@ | |
1666 | +This is the first line |
|
1666 | +This is the first line | |
1667 | +This is the second line |
|
1667 | +This is the second line | |
1668 | +This is the third line |
|
1668 | +This is the third line | |
1669 | record this change to 'newfile'? [Ynesfdaq?] e |
|
1669 | record this change to 'newfile'? [Ynesfdaq?] e | |
1670 |
|
1670 | |||
1671 | $ hg cat -r tip newfile |
|
1671 | $ hg cat -r tip newfile | |
1672 | This is the very line |
|
1672 | This is the very line | |
1673 | This is the second line |
|
1673 | This is the second line | |
1674 | This is the third line |
|
1674 | This is the third line | |
1675 |
|
1675 | |||
1676 | $ cat newfile |
|
1676 | $ cat newfile | |
1677 | This is the first line |
|
1677 | This is the first line | |
1678 | This is the second line |
|
1678 | This is the second line | |
1679 | This is the third line |
|
1679 | This is the third line | |
1680 |
|
1680 | |||
1681 | Add new file from within a subdirectory |
|
1681 | Add new file from within a subdirectory | |
1682 | $ hg update -C . |
|
1682 | $ hg update -C . | |
1683 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1683 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1684 | $ mkdir folder |
|
1684 | $ mkdir folder | |
1685 | $ cd folder |
|
1685 | $ cd folder | |
1686 | $ echo "foo" > bar |
|
1686 | $ echo "foo" > bar | |
1687 | $ hg add bar |
|
1687 | $ hg add bar | |
1688 | $ hg commit -i -d '23 0' -mnewfilesubdir <<EOF |
|
1688 | $ hg commit -i -d '23 0' -mnewfilesubdir <<EOF | |
1689 | > y |
|
1689 | > y | |
1690 | > y |
|
1690 | > y | |
1691 | > EOF |
|
1691 | > EOF | |
1692 | diff --git a/folder/bar b/folder/bar |
|
1692 | diff --git a/folder/bar b/folder/bar | |
1693 | new file mode 100644 |
|
1693 | new file mode 100644 | |
1694 | examine changes to 'folder/bar'? [Ynesfdaq?] y |
|
1694 | examine changes to 'folder/bar'? [Ynesfdaq?] y | |
1695 |
|
1695 | |||
1696 | @@ -0,0 +1,1 @@ |
|
1696 | @@ -0,0 +1,1 @@ | |
1697 | +foo |
|
1697 | +foo | |
1698 | record this change to 'folder/bar'? [Ynesfdaq?] y |
|
1698 | record this change to 'folder/bar'? [Ynesfdaq?] y | |
1699 |
|
1699 | |||
1700 | The #if execbit block above changes the hashes here on some systems |
|
1700 | The #if execbit block above changes the hashes here on some systems | |
1701 | $ hg tip -p |
|
1701 | $ hg tip -p | |
1702 | changeset: 34:* (glob) |
|
1702 | changeset: 34:* (glob) | |
1703 | tag: tip |
|
1703 | tag: tip | |
1704 | user: test |
|
1704 | user: test | |
1705 | date: Thu Jan 01 00:00:23 1970 +0000 |
|
1705 | date: Thu Jan 01 00:00:23 1970 +0000 | |
1706 | summary: newfilesubdir |
|
1706 | summary: newfilesubdir | |
1707 |
|
1707 | |||
1708 | diff -r * -r * folder/bar (glob) |
|
1708 | diff -r * -r * folder/bar (glob) | |
1709 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1709 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1710 | +++ b/folder/bar Thu Jan 01 00:00:23 1970 +0000 |
|
1710 | +++ b/folder/bar Thu Jan 01 00:00:23 1970 +0000 | |
1711 | @@ -0,0 +1,1 @@ |
|
1711 | @@ -0,0 +1,1 @@ | |
1712 | +foo |
|
1712 | +foo | |
1713 |
|
1713 | |||
1714 | $ cd .. |
|
1714 | $ cd .. | |
1715 |
|
1715 | |||
1716 | $ hg status -A folder/bar |
|
1716 | $ hg status -A folder/bar | |
1717 | C folder/bar |
|
1717 | C folder/bar | |
1718 |
|
1718 | |||
1719 | Clear win32text configuration before size/timestamp sensitive test |
|
1719 | Clear win32text configuration before size/timestamp sensitive test | |
1720 |
|
1720 | |||
1721 | $ cat >> .hg/hgrc <<EOF |
|
1721 | $ cat >> .hg/hgrc <<EOF | |
1722 | > [extensions] |
|
1722 | > [extensions] | |
1723 | > win32text = ! |
|
1723 | > win32text = ! | |
1724 | > [decode] |
|
1724 | > [decode] | |
1725 | > ** = ! |
|
1725 | > ** = ! | |
1726 | > [encode] |
|
1726 | > [encode] | |
1727 | > ** = ! |
|
1727 | > ** = ! | |
1728 | > [patch] |
|
1728 | > [patch] | |
1729 | > eol = strict |
|
1729 | > eol = strict | |
1730 | > EOF |
|
1730 | > EOF | |
1731 | $ hg update -q -C null |
|
1731 | $ hg update -q -C null | |
1732 | $ hg update -q -C tip |
|
1732 | $ hg update -q -C tip | |
1733 |
|
1733 | |||
1734 | Test that partially committed file is still treated as "modified", |
|
1734 | Test that partially committed file is still treated as "modified", | |
1735 | even if none of mode, size and timestamp is changed on the filesystem |
|
1735 | even if none of mode, size and timestamp is changed on the filesystem | |
1736 | (see also issue4583). |
|
1736 | (see also issue4583). | |
1737 |
|
1737 | |||
1738 | $ cat > subdir/f1 <<EOF |
|
1738 | $ cat > subdir/f1 <<EOF | |
1739 | > A |
|
1739 | > A | |
1740 | > a |
|
1740 | > a | |
1741 | > a |
|
1741 | > a | |
1742 | > b |
|
1742 | > b | |
1743 | > c |
|
1743 | > c | |
1744 | > d |
|
1744 | > d | |
1745 | > E |
|
1745 | > E | |
1746 | > EOF |
|
1746 | > EOF | |
1747 | $ hg diff --git subdir/f1 |
|
1747 | $ hg diff --git subdir/f1 | |
1748 | diff --git a/subdir/f1 b/subdir/f1 |
|
1748 | diff --git a/subdir/f1 b/subdir/f1 | |
1749 | --- a/subdir/f1 |
|
1749 | --- a/subdir/f1 | |
1750 | +++ b/subdir/f1 |
|
1750 | +++ b/subdir/f1 | |
1751 | @@ -1,7 +1,7 @@ |
|
1751 | @@ -1,7 +1,7 @@ | |
1752 | -a |
|
1752 | -a | |
1753 | +A |
|
1753 | +A | |
1754 | a |
|
1754 | a | |
1755 | a |
|
1755 | a | |
1756 | b |
|
1756 | b | |
1757 | c |
|
1757 | c | |
1758 | d |
|
1758 | d | |
1759 | -e |
|
1759 | -e | |
1760 | +E |
|
1760 | +E | |
1761 |
|
1761 | |||
1762 | $ touch -t 200001010000 subdir/f1 |
|
1762 | $ touch -t 200001010000 subdir/f1 | |
1763 |
|
1763 | |||
1764 | $ cat >> .hg/hgrc <<EOF |
|
1764 | $ cat >> .hg/hgrc <<EOF | |
1765 | > # emulate invoking patch.internalpatch() at 2000-01-01 00:00 |
|
1765 | > # emulate invoking patch.internalpatch() at 2000-01-01 00:00 | |
1766 | > [fakepatchtime] |
|
1766 | > [fakepatchtime] | |
1767 | > fakenow = 200001010000 |
|
1767 | > fakenow = 200001010000 | |
1768 | > |
|
1768 | > | |
1769 | > [extensions] |
|
1769 | > [extensions] | |
1770 | > fakepatchtime = $TESTDIR/fakepatchtime.py |
|
1770 | > fakepatchtime = $TESTDIR/fakepatchtime.py | |
1771 | > EOF |
|
1771 | > EOF | |
1772 | $ hg commit -i -m 'commit subdir/f1 partially' <<EOF |
|
1772 | $ hg commit -i -m 'commit subdir/f1 partially' <<EOF | |
1773 | > y |
|
1773 | > y | |
1774 | > y |
|
1774 | > y | |
1775 | > n |
|
1775 | > n | |
1776 | > EOF |
|
1776 | > EOF | |
1777 | diff --git a/subdir/f1 b/subdir/f1 |
|
1777 | diff --git a/subdir/f1 b/subdir/f1 | |
1778 | 2 hunks, 2 lines changed |
|
1778 | 2 hunks, 2 lines changed | |
1779 | examine changes to 'subdir/f1'? [Ynesfdaq?] y |
|
1779 | examine changes to 'subdir/f1'? [Ynesfdaq?] y | |
1780 |
|
1780 | |||
1781 | @@ -1,6 +1,6 @@ |
|
1781 | @@ -1,6 +1,6 @@ | |
1782 | -a |
|
1782 | -a | |
1783 | +A |
|
1783 | +A | |
1784 | a |
|
1784 | a | |
1785 | a |
|
1785 | a | |
1786 | b |
|
1786 | b | |
1787 | c |
|
1787 | c | |
1788 | d |
|
1788 | d | |
1789 | record change 1/2 to 'subdir/f1'? [Ynesfdaq?] y |
|
1789 | record change 1/2 to 'subdir/f1'? [Ynesfdaq?] y | |
1790 |
|
1790 | |||
1791 | @@ -2,6 +2,6 @@ |
|
1791 | @@ -2,6 +2,6 @@ | |
1792 | a |
|
1792 | a | |
1793 | a |
|
1793 | a | |
1794 | b |
|
1794 | b | |
1795 | c |
|
1795 | c | |
1796 | d |
|
1796 | d | |
1797 | -e |
|
1797 | -e | |
1798 | +E |
|
1798 | +E | |
1799 | record change 2/2 to 'subdir/f1'? [Ynesfdaq?] n |
|
1799 | record change 2/2 to 'subdir/f1'? [Ynesfdaq?] n | |
1800 |
|
1800 | |||
1801 | $ cat >> .hg/hgrc <<EOF |
|
1801 | $ cat >> .hg/hgrc <<EOF | |
1802 | > [extensions] |
|
1802 | > [extensions] | |
1803 | > fakepatchtime = ! |
|
1803 | > fakepatchtime = ! | |
1804 | > EOF |
|
1804 | > EOF | |
1805 |
|
1805 | |||
1806 | $ hg debugstate | grep ' subdir/f1$' |
|
1806 | $ hg debugstate | grep ' subdir/f1$' | |
1807 | n 0 -1 unset subdir/f1 |
|
1807 | n 0 -1 unset subdir/f1 | |
1808 | $ hg status -A subdir/f1 |
|
1808 | $ hg status -A subdir/f1 | |
1809 | M subdir/f1 |
|
1809 | M subdir/f1 |
@@ -1,1779 +1,1779 b'' | |||||
1 | Test basic extension support |
|
1 | Test basic extension support | |
2 | $ cat > unflush.py <<EOF |
|
2 | $ cat > unflush.py <<EOF | |
3 | > import sys |
|
3 | > import sys | |
4 | > from mercurial import pycompat |
|
4 | > from mercurial import pycompat | |
5 | > if pycompat.ispy3: |
|
5 | > if pycompat.ispy3: | |
6 | > # no changes required |
|
6 | > # no changes required | |
7 | > sys.exit(0) |
|
7 | > sys.exit(0) | |
8 | > with open(sys.argv[1], 'rb') as f: |
|
8 | > with open(sys.argv[1], 'rb') as f: | |
9 | > data = f.read() |
|
9 | > data = f.read() | |
10 | > with open(sys.argv[1], 'wb') as f: |
|
10 | > with open(sys.argv[1], 'wb') as f: | |
11 | > f.write(data.replace(b', flush=True', b'')) |
|
11 | > f.write(data.replace(b', flush=True', b'')) | |
12 | > EOF |
|
12 | > EOF | |
13 |
|
13 | |||
14 | $ cat > foobar.py <<EOF |
|
14 | $ cat > foobar.py <<EOF | |
15 | > import os |
|
15 | > import os | |
16 | > from mercurial import commands, registrar |
|
16 | > from mercurial import commands, registrar | |
17 | > cmdtable = {} |
|
17 | > cmdtable = {} | |
18 | > command = registrar.command(cmdtable) |
|
18 | > command = registrar.command(cmdtable) | |
19 | > configtable = {} |
|
19 | > configtable = {} | |
20 | > configitem = registrar.configitem(configtable) |
|
20 | > configitem = registrar.configitem(configtable) | |
21 | > configitem(b'tests', b'foo', default=b"Foo") |
|
21 | > configitem(b'tests', b'foo', default=b"Foo") | |
22 | > def uisetup(ui): |
|
22 | > def uisetup(ui): | |
23 | > ui.debug(b"uisetup called [debug]\\n") |
|
23 | > ui.debug(b"uisetup called [debug]\\n") | |
24 | > ui.write(b"uisetup called\\n") |
|
24 | > ui.write(b"uisetup called\\n") | |
25 | > ui.status(b"uisetup called [status]\\n") |
|
25 | > ui.status(b"uisetup called [status]\\n") | |
26 | > ui.flush() |
|
26 | > ui.flush() | |
27 | > def reposetup(ui, repo): |
|
27 | > def reposetup(ui, repo): | |
28 | > ui.write(b"reposetup called for %s\\n" % os.path.basename(repo.root)) |
|
28 | > ui.write(b"reposetup called for %s\\n" % os.path.basename(repo.root)) | |
29 | > ui.write(b"ui %s= repo.ui\\n" % (ui == repo.ui and b"=" or b"!")) |
|
29 | > ui.write(b"ui %s= repo.ui\\n" % (ui == repo.ui and b"=" or b"!")) | |
30 | > ui.flush() |
|
30 | > ui.flush() | |
31 | > @command(b'foo', [], b'hg foo') |
|
31 | > @command(b'foo', [], b'hg foo') | |
32 | > def foo(ui, *args, **kwargs): |
|
32 | > def foo(ui, *args, **kwargs): | |
33 | > foo = ui.config(b'tests', b'foo') |
|
33 | > foo = ui.config(b'tests', b'foo') | |
34 | > ui.write(foo) |
|
34 | > ui.write(foo) | |
35 | > ui.write(b"\\n") |
|
35 | > ui.write(b"\\n") | |
36 | > @command(b'bar', [], b'hg bar', norepo=True) |
|
36 | > @command(b'bar', [], b'hg bar', norepo=True) | |
37 | > def bar(ui, *args, **kwargs): |
|
37 | > def bar(ui, *args, **kwargs): | |
38 | > ui.write(b"Bar\\n") |
|
38 | > ui.write(b"Bar\\n") | |
39 | > EOF |
|
39 | > EOF | |
40 | $ abspath=`pwd`/foobar.py |
|
40 | $ abspath=`pwd`/foobar.py | |
41 |
|
41 | |||
42 | $ mkdir barfoo |
|
42 | $ mkdir barfoo | |
43 | $ cp foobar.py barfoo/__init__.py |
|
43 | $ cp foobar.py barfoo/__init__.py | |
44 | $ barfoopath=`pwd`/barfoo |
|
44 | $ barfoopath=`pwd`/barfoo | |
45 |
|
45 | |||
46 | $ hg init a |
|
46 | $ hg init a | |
47 | $ cd a |
|
47 | $ cd a | |
48 | $ echo foo > file |
|
48 | $ echo foo > file | |
49 | $ hg add file |
|
49 | $ hg add file | |
50 | $ hg commit -m 'add file' |
|
50 | $ hg commit -m 'add file' | |
51 |
|
51 | |||
52 | $ echo '[extensions]' >> $HGRCPATH |
|
52 | $ echo '[extensions]' >> $HGRCPATH | |
53 | $ echo "foobar = $abspath" >> $HGRCPATH |
|
53 | $ echo "foobar = $abspath" >> $HGRCPATH | |
54 | $ hg foo |
|
54 | $ hg foo | |
55 | uisetup called |
|
55 | uisetup called | |
56 | uisetup called [status] |
|
56 | uisetup called [status] | |
57 | reposetup called for a |
|
57 | reposetup called for a | |
58 | ui == repo.ui |
|
58 | ui == repo.ui | |
59 | reposetup called for a (chg !) |
|
59 | reposetup called for a (chg !) | |
60 | ui == repo.ui (chg !) |
|
60 | ui == repo.ui (chg !) | |
61 | Foo |
|
61 | Foo | |
62 | $ hg foo --quiet |
|
62 | $ hg foo --quiet | |
63 | uisetup called (no-chg !) |
|
63 | uisetup called (no-chg !) | |
64 | reposetup called for a (chg !) |
|
64 | reposetup called for a (chg !) | |
65 | ui == repo.ui |
|
65 | ui == repo.ui | |
66 | Foo |
|
66 | Foo | |
67 | $ hg foo --debug |
|
67 | $ hg foo --debug | |
68 | uisetup called [debug] (no-chg !) |
|
68 | uisetup called [debug] (no-chg !) | |
69 | uisetup called (no-chg !) |
|
69 | uisetup called (no-chg !) | |
70 | uisetup called [status] (no-chg !) |
|
70 | uisetup called [status] (no-chg !) | |
71 | reposetup called for a (chg !) |
|
71 | reposetup called for a (chg !) | |
72 | ui == repo.ui |
|
72 | ui == repo.ui | |
73 | Foo |
|
73 | Foo | |
74 |
|
74 | |||
75 | $ cd .. |
|
75 | $ cd .. | |
76 | $ hg clone a b |
|
76 | $ hg clone a b | |
77 | uisetup called (no-chg !) |
|
77 | uisetup called (no-chg !) | |
78 | uisetup called [status] (no-chg !) |
|
78 | uisetup called [status] (no-chg !) | |
79 | reposetup called for a |
|
79 | reposetup called for a | |
80 | ui == repo.ui |
|
80 | ui == repo.ui | |
81 | reposetup called for b |
|
81 | reposetup called for b | |
82 | ui == repo.ui |
|
82 | ui == repo.ui | |
83 | updating to branch default |
|
83 | updating to branch default | |
84 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
84 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
85 |
|
85 | |||
86 | $ hg bar |
|
86 | $ hg bar | |
87 | uisetup called (no-chg !) |
|
87 | uisetup called (no-chg !) | |
88 | uisetup called [status] (no-chg !) |
|
88 | uisetup called [status] (no-chg !) | |
89 | Bar |
|
89 | Bar | |
90 | $ echo 'foobar = !' >> $HGRCPATH |
|
90 | $ echo 'foobar = !' >> $HGRCPATH | |
91 |
|
91 | |||
92 | module/__init__.py-style |
|
92 | module/__init__.py-style | |
93 |
|
93 | |||
94 | $ echo "barfoo = $barfoopath" >> $HGRCPATH |
|
94 | $ echo "barfoo = $barfoopath" >> $HGRCPATH | |
95 | $ cd a |
|
95 | $ cd a | |
96 | $ hg foo |
|
96 | $ hg foo | |
97 | uisetup called |
|
97 | uisetup called | |
98 | uisetup called [status] |
|
98 | uisetup called [status] | |
99 | reposetup called for a |
|
99 | reposetup called for a | |
100 | ui == repo.ui |
|
100 | ui == repo.ui | |
101 | reposetup called for a (chg !) |
|
101 | reposetup called for a (chg !) | |
102 | ui == repo.ui (chg !) |
|
102 | ui == repo.ui (chg !) | |
103 | Foo |
|
103 | Foo | |
104 | $ echo 'barfoo = !' >> $HGRCPATH |
|
104 | $ echo 'barfoo = !' >> $HGRCPATH | |
105 |
|
105 | |||
106 | Check that extensions are loaded in phases: |
|
106 | Check that extensions are loaded in phases: | |
107 |
|
107 | |||
108 | $ cat > foo.py <<EOF |
|
108 | $ cat > foo.py <<EOF | |
109 | > from __future__ import print_function |
|
109 | > from __future__ import print_function | |
110 | > import os |
|
110 | > import os | |
111 | > name = os.path.basename(__file__).rsplit('.', 1)[0] |
|
111 | > name = os.path.basename(__file__).rsplit('.', 1)[0] | |
112 | > print("1) %s imported" % name, flush=True) |
|
112 | > print("1) %s imported" % name, flush=True) | |
113 | > def uisetup(ui): |
|
113 | > def uisetup(ui): | |
114 | > print("2) %s uisetup" % name, flush=True) |
|
114 | > print("2) %s uisetup" % name, flush=True) | |
115 | > def extsetup(): |
|
115 | > def extsetup(): | |
116 | > print("3) %s extsetup" % name, flush=True) |
|
116 | > print("3) %s extsetup" % name, flush=True) | |
117 | > def reposetup(ui, repo): |
|
117 | > def reposetup(ui, repo): | |
118 | > print("4) %s reposetup" % name, flush=True) |
|
118 | > print("4) %s reposetup" % name, flush=True) | |
119 | > |
|
119 | > | |
120 | > bytesname = name.encode('utf-8') |
|
120 | > bytesname = name.encode('utf-8') | |
121 | > # custom predicate to check registration of functions at loading |
|
121 | > # custom predicate to check registration of functions at loading | |
122 | > from mercurial import ( |
|
122 | > from mercurial import ( | |
123 | > registrar, |
|
123 | > registrar, | |
124 | > smartset, |
|
124 | > smartset, | |
125 | > ) |
|
125 | > ) | |
126 | > revsetpredicate = registrar.revsetpredicate() |
|
126 | > revsetpredicate = registrar.revsetpredicate() | |
127 | > @revsetpredicate(bytesname, safe=True) # safe=True for query via hgweb |
|
127 | > @revsetpredicate(bytesname, safe=True) # safe=True for query via hgweb | |
128 | > def custompredicate(repo, subset, x): |
|
128 | > def custompredicate(repo, subset, x): | |
129 | > return smartset.baseset([r for r in subset if r in {0}]) |
|
129 | > return smartset.baseset([r for r in subset if r in {0}]) | |
130 | > EOF |
|
130 | > EOF | |
131 | $ $PYTHON $TESTTMP/unflush.py foo.py |
|
131 | $ $PYTHON $TESTTMP/unflush.py foo.py | |
132 |
|
132 | |||
133 | $ cp foo.py bar.py |
|
133 | $ cp foo.py bar.py | |
134 | $ echo 'foo = foo.py' >> $HGRCPATH |
|
134 | $ echo 'foo = foo.py' >> $HGRCPATH | |
135 | $ echo 'bar = bar.py' >> $HGRCPATH |
|
135 | $ echo 'bar = bar.py' >> $HGRCPATH | |
136 |
|
136 | |||
137 | Check normal command's load order of extensions and registration of functions |
|
137 | Check normal command's load order of extensions and registration of functions | |
138 |
|
138 | |||
139 | $ hg log -r "foo() and bar()" -q |
|
139 | $ hg log -r "foo() and bar()" -q | |
140 | 1) foo imported |
|
140 | 1) foo imported | |
141 | 1) bar imported |
|
141 | 1) bar imported | |
142 | 2) foo uisetup |
|
142 | 2) foo uisetup | |
143 | 2) bar uisetup |
|
143 | 2) bar uisetup | |
144 | 3) foo extsetup |
|
144 | 3) foo extsetup | |
145 | 3) bar extsetup |
|
145 | 3) bar extsetup | |
146 | 4) foo reposetup |
|
146 | 4) foo reposetup | |
147 | 4) bar reposetup |
|
147 | 4) bar reposetup | |
148 | 0:c24b9ac61126 |
|
148 | 0:c24b9ac61126 | |
149 |
|
149 | |||
150 | Check hgweb's load order of extensions and registration of functions |
|
150 | Check hgweb's load order of extensions and registration of functions | |
151 |
|
151 | |||
152 | $ cat > hgweb.cgi <<EOF |
|
152 | $ cat > hgweb.cgi <<EOF | |
153 | > #!$PYTHON |
|
153 | > #!$PYTHON | |
154 | > from mercurial import demandimport; demandimport.enable() |
|
154 | > from mercurial import demandimport; demandimport.enable() | |
155 | > from mercurial.hgweb import hgweb |
|
155 | > from mercurial.hgweb import hgweb | |
156 | > from mercurial.hgweb import wsgicgi |
|
156 | > from mercurial.hgweb import wsgicgi | |
157 | > application = hgweb(b'.', b'test repo') |
|
157 | > application = hgweb(b'.', b'test repo') | |
158 | > wsgicgi.launch(application) |
|
158 | > wsgicgi.launch(application) | |
159 | > EOF |
|
159 | > EOF | |
160 | $ . "$TESTDIR/cgienv" |
|
160 | $ . "$TESTDIR/cgienv" | |
161 |
|
161 | |||
162 | $ PATH_INFO='/' SCRIPT_NAME='' "$PYTHON" hgweb.cgi \ |
|
162 | $ PATH_INFO='/' SCRIPT_NAME='' "$PYTHON" hgweb.cgi \ | |
163 | > | grep '^[0-9]) ' # ignores HTML output |
|
163 | > | grep '^[0-9]) ' # ignores HTML output | |
164 | 1) foo imported |
|
164 | 1) foo imported | |
165 | 1) bar imported |
|
165 | 1) bar imported | |
166 | 2) foo uisetup |
|
166 | 2) foo uisetup | |
167 | 2) bar uisetup |
|
167 | 2) bar uisetup | |
168 | 3) foo extsetup |
|
168 | 3) foo extsetup | |
169 | 3) bar extsetup |
|
169 | 3) bar extsetup | |
170 | 4) foo reposetup |
|
170 | 4) foo reposetup | |
171 | 4) bar reposetup |
|
171 | 4) bar reposetup | |
172 |
|
172 | |||
173 | (check that revset predicate foo() and bar() are available) |
|
173 | (check that revset predicate foo() and bar() are available) | |
174 |
|
174 | |||
175 | #if msys |
|
175 | #if msys | |
176 | $ PATH_INFO='//shortlog' |
|
176 | $ PATH_INFO='//shortlog' | |
177 | #else |
|
177 | #else | |
178 | $ PATH_INFO='/shortlog' |
|
178 | $ PATH_INFO='/shortlog' | |
179 | #endif |
|
179 | #endif | |
180 | $ export PATH_INFO |
|
180 | $ export PATH_INFO | |
181 | $ SCRIPT_NAME='' QUERY_STRING='rev=foo() and bar()' "$PYTHON" hgweb.cgi \ |
|
181 | $ SCRIPT_NAME='' QUERY_STRING='rev=foo() and bar()' "$PYTHON" hgweb.cgi \ | |
182 | > | grep '<a href="/rev/[0-9a-z]*">' |
|
182 | > | grep '<a href="/rev/[0-9a-z]*">' | |
183 | <a href="/rev/c24b9ac61126">add file</a> |
|
183 | <a href="/rev/c24b9ac61126">add file</a> | |
184 |
|
184 | |||
185 | $ echo 'foo = !' >> $HGRCPATH |
|
185 | $ echo 'foo = !' >> $HGRCPATH | |
186 | $ echo 'bar = !' >> $HGRCPATH |
|
186 | $ echo 'bar = !' >> $HGRCPATH | |
187 |
|
187 | |||
188 | Check "from __future__ import absolute_import" support for external libraries |
|
188 | Check "from __future__ import absolute_import" support for external libraries | |
189 |
|
189 | |||
190 | #if windows |
|
190 | #if windows | |
191 | $ PATHSEP=";" |
|
191 | $ PATHSEP=";" | |
192 | #else |
|
192 | #else | |
193 | $ PATHSEP=":" |
|
193 | $ PATHSEP=":" | |
194 | #endif |
|
194 | #endif | |
195 | $ export PATHSEP |
|
195 | $ export PATHSEP | |
196 |
|
196 | |||
197 | $ mkdir $TESTTMP/libroot |
|
197 | $ mkdir $TESTTMP/libroot | |
198 | $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py |
|
198 | $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py | |
199 | $ mkdir $TESTTMP/libroot/mod |
|
199 | $ mkdir $TESTTMP/libroot/mod | |
200 | $ touch $TESTTMP/libroot/mod/__init__.py |
|
200 | $ touch $TESTTMP/libroot/mod/__init__.py | |
201 | $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py |
|
201 | $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py | |
202 |
|
202 | |||
203 | $ cat > $TESTTMP/libroot/mod/ambigabs.py <<EOF |
|
203 | $ cat > $TESTTMP/libroot/mod/ambigabs.py <<EOF | |
204 | > from __future__ import absolute_import, print_function |
|
204 | > from __future__ import absolute_import, print_function | |
205 | > import ambig # should load "libroot/ambig.py" |
|
205 | > import ambig # should load "libroot/ambig.py" | |
206 | > s = ambig.s |
|
206 | > s = ambig.s | |
207 | > EOF |
|
207 | > EOF | |
208 | $ cat > loadabs.py <<EOF |
|
208 | $ cat > loadabs.py <<EOF | |
209 | > import mod.ambigabs as ambigabs |
|
209 | > import mod.ambigabs as ambigabs | |
210 | > def extsetup(): |
|
210 | > def extsetup(): | |
211 | > print('ambigabs.s=%s' % ambigabs.s, flush=True) |
|
211 | > print('ambigabs.s=%s' % ambigabs.s, flush=True) | |
212 | > EOF |
|
212 | > EOF | |
213 | $ $PYTHON $TESTTMP/unflush.py loadabs.py |
|
213 | $ $PYTHON $TESTTMP/unflush.py loadabs.py | |
214 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root) |
|
214 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root) | |
215 | ambigabs.s=libroot/ambig.py |
|
215 | ambigabs.s=libroot/ambig.py | |
216 | $TESTTMP/a |
|
216 | $TESTTMP/a | |
217 |
|
217 | |||
218 | #if no-py3k |
|
218 | #if no-py3k | |
219 | $ cat > $TESTTMP/libroot/mod/ambigrel.py <<EOF |
|
219 | $ cat > $TESTTMP/libroot/mod/ambigrel.py <<EOF | |
220 | > from __future__ import print_function |
|
220 | > from __future__ import print_function | |
221 | > import ambig # should load "libroot/mod/ambig.py" |
|
221 | > import ambig # should load "libroot/mod/ambig.py" | |
222 | > s = ambig.s |
|
222 | > s = ambig.s | |
223 | > EOF |
|
223 | > EOF | |
224 | $ cat > loadrel.py <<EOF |
|
224 | $ cat > loadrel.py <<EOF | |
225 | > import mod.ambigrel as ambigrel |
|
225 | > import mod.ambigrel as ambigrel | |
226 | > def extsetup(): |
|
226 | > def extsetup(): | |
227 | > print('ambigrel.s=%s' % ambigrel.s, flush=True) |
|
227 | > print('ambigrel.s=%s' % ambigrel.s, flush=True) | |
228 | > EOF |
|
228 | > EOF | |
229 | $ $PYTHON $TESTTMP/unflush.py loadrel.py |
|
229 | $ $PYTHON $TESTTMP/unflush.py loadrel.py | |
230 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root) |
|
230 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root) | |
231 | ambigrel.s=libroot/mod/ambig.py |
|
231 | ambigrel.s=libroot/mod/ambig.py | |
232 | $TESTTMP/a |
|
232 | $TESTTMP/a | |
233 | #endif |
|
233 | #endif | |
234 |
|
234 | |||
235 | Check absolute/relative import of extension specific modules |
|
235 | Check absolute/relative import of extension specific modules | |
236 |
|
236 | |||
237 | $ mkdir $TESTTMP/extroot |
|
237 | $ mkdir $TESTTMP/extroot | |
238 | $ cat > $TESTTMP/extroot/bar.py <<EOF |
|
238 | $ cat > $TESTTMP/extroot/bar.py <<EOF | |
239 | > s = b'this is extroot.bar' |
|
239 | > s = b'this is extroot.bar' | |
240 | > EOF |
|
240 | > EOF | |
241 | $ mkdir $TESTTMP/extroot/sub1 |
|
241 | $ mkdir $TESTTMP/extroot/sub1 | |
242 | $ cat > $TESTTMP/extroot/sub1/__init__.py <<EOF |
|
242 | $ cat > $TESTTMP/extroot/sub1/__init__.py <<EOF | |
243 | > s = b'this is extroot.sub1.__init__' |
|
243 | > s = b'this is extroot.sub1.__init__' | |
244 | > EOF |
|
244 | > EOF | |
245 | $ cat > $TESTTMP/extroot/sub1/baz.py <<EOF |
|
245 | $ cat > $TESTTMP/extroot/sub1/baz.py <<EOF | |
246 | > s = b'this is extroot.sub1.baz' |
|
246 | > s = b'this is extroot.sub1.baz' | |
247 | > EOF |
|
247 | > EOF | |
248 | $ cat > $TESTTMP/extroot/__init__.py <<EOF |
|
248 | $ cat > $TESTTMP/extroot/__init__.py <<EOF | |
249 | > from __future__ import absolute_import |
|
249 | > from __future__ import absolute_import | |
250 | > s = b'this is extroot.__init__' |
|
250 | > s = b'this is extroot.__init__' | |
251 | > from . import foo |
|
251 | > from . import foo | |
252 | > def extsetup(ui): |
|
252 | > def extsetup(ui): | |
253 | > ui.write(b'(extroot) ', foo.func(), b'\n') |
|
253 | > ui.write(b'(extroot) ', foo.func(), b'\n') | |
254 | > ui.flush() |
|
254 | > ui.flush() | |
255 | > EOF |
|
255 | > EOF | |
256 |
|
256 | |||
257 | $ cat > $TESTTMP/extroot/foo.py <<EOF |
|
257 | $ cat > $TESTTMP/extroot/foo.py <<EOF | |
258 | > # test absolute import |
|
258 | > # test absolute import | |
259 | > buf = [] |
|
259 | > buf = [] | |
260 | > def func(): |
|
260 | > def func(): | |
261 | > # "not locals" case |
|
261 | > # "not locals" case | |
262 | > import extroot.bar |
|
262 | > import extroot.bar | |
263 | > buf.append(b'import extroot.bar in func(): %s' % extroot.bar.s) |
|
263 | > buf.append(b'import extroot.bar in func(): %s' % extroot.bar.s) | |
264 | > return b'\n(extroot) '.join(buf) |
|
264 | > return b'\n(extroot) '.join(buf) | |
265 | > # b"fromlist == ('*',)" case |
|
265 | > # b"fromlist == ('*',)" case | |
266 | > from extroot.bar import * |
|
266 | > from extroot.bar import * | |
267 | > buf.append(b'from extroot.bar import *: %s' % s) |
|
267 | > buf.append(b'from extroot.bar import *: %s' % s) | |
268 | > # "not fromlist" and "if '.' in name" case |
|
268 | > # "not fromlist" and "if '.' in name" case | |
269 | > import extroot.sub1.baz |
|
269 | > import extroot.sub1.baz | |
270 | > buf.append(b'import extroot.sub1.baz: %s' % extroot.sub1.baz.s) |
|
270 | > buf.append(b'import extroot.sub1.baz: %s' % extroot.sub1.baz.s) | |
271 | > # "not fromlist" and NOT "if '.' in name" case |
|
271 | > # "not fromlist" and NOT "if '.' in name" case | |
272 | > import extroot |
|
272 | > import extroot | |
273 | > buf.append(b'import extroot: %s' % extroot.s) |
|
273 | > buf.append(b'import extroot: %s' % extroot.s) | |
274 | > # NOT "not fromlist" and NOT "level != -1" case |
|
274 | > # NOT "not fromlist" and NOT "level != -1" case | |
275 | > from extroot.bar import s |
|
275 | > from extroot.bar import s | |
276 | > buf.append(b'from extroot.bar import s: %s' % s) |
|
276 | > buf.append(b'from extroot.bar import s: %s' % s) | |
277 | > EOF |
|
277 | > EOF | |
278 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.extroot=$TESTTMP/extroot root) |
|
278 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.extroot=$TESTTMP/extroot root) | |
279 | (extroot) from extroot.bar import *: this is extroot.bar |
|
279 | (extroot) from extroot.bar import *: this is extroot.bar | |
280 | (extroot) import extroot.sub1.baz: this is extroot.sub1.baz |
|
280 | (extroot) import extroot.sub1.baz: this is extroot.sub1.baz | |
281 | (extroot) import extroot: this is extroot.__init__ |
|
281 | (extroot) import extroot: this is extroot.__init__ | |
282 | (extroot) from extroot.bar import s: this is extroot.bar |
|
282 | (extroot) from extroot.bar import s: this is extroot.bar | |
283 | (extroot) import extroot.bar in func(): this is extroot.bar |
|
283 | (extroot) import extroot.bar in func(): this is extroot.bar | |
284 | $TESTTMP/a |
|
284 | $TESTTMP/a | |
285 |
|
285 | |||
286 | #if no-py3k |
|
286 | #if no-py3k | |
287 | $ rm "$TESTTMP"/extroot/foo.* |
|
287 | $ rm "$TESTTMP"/extroot/foo.* | |
288 | $ rm -Rf "$TESTTMP/extroot/__pycache__" |
|
288 | $ rm -Rf "$TESTTMP/extroot/__pycache__" | |
289 | $ cat > $TESTTMP/extroot/foo.py <<EOF |
|
289 | $ cat > $TESTTMP/extroot/foo.py <<EOF | |
290 | > # test relative import |
|
290 | > # test relative import | |
291 | > buf = [] |
|
291 | > buf = [] | |
292 | > def func(): |
|
292 | > def func(): | |
293 | > # "not locals" case |
|
293 | > # "not locals" case | |
294 | > import bar |
|
294 | > import bar | |
295 | > buf.append('import bar in func(): %s' % bar.s) |
|
295 | > buf.append('import bar in func(): %s' % bar.s) | |
296 | > return '\n(extroot) '.join(buf) |
|
296 | > return '\n(extroot) '.join(buf) | |
297 | > # "fromlist == ('*',)" case |
|
297 | > # "fromlist == ('*',)" case | |
298 | > from bar import * |
|
298 | > from bar import * | |
299 | > buf.append('from bar import *: %s' % s) |
|
299 | > buf.append('from bar import *: %s' % s) | |
300 | > # "not fromlist" and "if '.' in name" case |
|
300 | > # "not fromlist" and "if '.' in name" case | |
301 | > import sub1.baz |
|
301 | > import sub1.baz | |
302 | > buf.append('import sub1.baz: %s' % sub1.baz.s) |
|
302 | > buf.append('import sub1.baz: %s' % sub1.baz.s) | |
303 | > # "not fromlist" and NOT "if '.' in name" case |
|
303 | > # "not fromlist" and NOT "if '.' in name" case | |
304 | > import sub1 |
|
304 | > import sub1 | |
305 | > buf.append('import sub1: %s' % sub1.s) |
|
305 | > buf.append('import sub1: %s' % sub1.s) | |
306 | > # NOT "not fromlist" and NOT "level != -1" case |
|
306 | > # NOT "not fromlist" and NOT "level != -1" case | |
307 | > from bar import s |
|
307 | > from bar import s | |
308 | > buf.append('from bar import s: %s' % s) |
|
308 | > buf.append('from bar import s: %s' % s) | |
309 | > EOF |
|
309 | > EOF | |
310 | $ hg --config extensions.extroot=$TESTTMP/extroot root |
|
310 | $ hg --config extensions.extroot=$TESTTMP/extroot root | |
311 | (extroot) from bar import *: this is extroot.bar |
|
311 | (extroot) from bar import *: this is extroot.bar | |
312 | (extroot) import sub1.baz: this is extroot.sub1.baz |
|
312 | (extroot) import sub1.baz: this is extroot.sub1.baz | |
313 | (extroot) import sub1: this is extroot.sub1.__init__ |
|
313 | (extroot) import sub1: this is extroot.sub1.__init__ | |
314 | (extroot) from bar import s: this is extroot.bar |
|
314 | (extroot) from bar import s: this is extroot.bar | |
315 | (extroot) import bar in func(): this is extroot.bar |
|
315 | (extroot) import bar in func(): this is extroot.bar | |
316 | $TESTTMP/a |
|
316 | $TESTTMP/a | |
317 | #endif |
|
317 | #endif | |
318 |
|
318 | |||
319 | #if demandimport |
|
319 | #if demandimport | |
320 |
|
320 | |||
321 | Examine whether module loading is delayed until actual referring, even |
|
321 | Examine whether module loading is delayed until actual referring, even | |
322 | though module is imported with "absolute_import" feature. |
|
322 | though module is imported with "absolute_import" feature. | |
323 |
|
323 | |||
324 | Files below in each packages are used for described purpose: |
|
324 | Files below in each packages are used for described purpose: | |
325 |
|
325 | |||
326 | - "called": examine whether "from MODULE import ATTR" works correctly |
|
326 | - "called": examine whether "from MODULE import ATTR" works correctly | |
327 | - "unused": examine whether loading is delayed correctly |
|
327 | - "unused": examine whether loading is delayed correctly | |
328 | - "used": examine whether "from PACKAGE import MODULE" works correctly |
|
328 | - "used": examine whether "from PACKAGE import MODULE" works correctly | |
329 |
|
329 | |||
330 | Package hierarchy is needed to examine whether demand importing works |
|
330 | Package hierarchy is needed to examine whether demand importing works | |
331 | as expected for "from SUB.PACK.AGE import MODULE". |
|
331 | as expected for "from SUB.PACK.AGE import MODULE". | |
332 |
|
332 | |||
333 | Setup "external library" to be imported with "absolute_import" |
|
333 | Setup "external library" to be imported with "absolute_import" | |
334 | feature. |
|
334 | feature. | |
335 |
|
335 | |||
336 | $ mkdir -p $TESTTMP/extlibroot/lsub1/lsub2 |
|
336 | $ mkdir -p $TESTTMP/extlibroot/lsub1/lsub2 | |
337 | $ touch $TESTTMP/extlibroot/__init__.py |
|
337 | $ touch $TESTTMP/extlibroot/__init__.py | |
338 | $ touch $TESTTMP/extlibroot/lsub1/__init__.py |
|
338 | $ touch $TESTTMP/extlibroot/lsub1/__init__.py | |
339 | $ touch $TESTTMP/extlibroot/lsub1/lsub2/__init__.py |
|
339 | $ touch $TESTTMP/extlibroot/lsub1/lsub2/__init__.py | |
340 |
|
340 | |||
341 | $ cat > $TESTTMP/extlibroot/lsub1/lsub2/called.py <<EOF |
|
341 | $ cat > $TESTTMP/extlibroot/lsub1/lsub2/called.py <<EOF | |
342 | > def func(): |
|
342 | > def func(): | |
343 | > return b"this is extlibroot.lsub1.lsub2.called.func()" |
|
343 | > return b"this is extlibroot.lsub1.lsub2.called.func()" | |
344 | > EOF |
|
344 | > EOF | |
345 | $ cat > $TESTTMP/extlibroot/lsub1/lsub2/unused.py <<EOF |
|
345 | $ cat > $TESTTMP/extlibroot/lsub1/lsub2/unused.py <<EOF | |
346 | > raise Exception("extlibroot.lsub1.lsub2.unused is loaded unintentionally") |
|
346 | > raise Exception("extlibroot.lsub1.lsub2.unused is loaded unintentionally") | |
347 | > EOF |
|
347 | > EOF | |
348 | $ cat > $TESTTMP/extlibroot/lsub1/lsub2/used.py <<EOF |
|
348 | $ cat > $TESTTMP/extlibroot/lsub1/lsub2/used.py <<EOF | |
349 | > detail = b"this is extlibroot.lsub1.lsub2.used" |
|
349 | > detail = b"this is extlibroot.lsub1.lsub2.used" | |
350 | > EOF |
|
350 | > EOF | |
351 |
|
351 | |||
352 | Setup sub-package of "external library", which causes instantiation of |
|
352 | Setup sub-package of "external library", which causes instantiation of | |
353 | demandmod in "recurse down the module chain" code path. Relative |
|
353 | demandmod in "recurse down the module chain" code path. Relative | |
354 | importing with "absolute_import" feature isn't tested, because "level |
|
354 | importing with "absolute_import" feature isn't tested, because "level | |
355 | >=1 " doesn't cause instantiation of demandmod. |
|
355 | >=1 " doesn't cause instantiation of demandmod. | |
356 |
|
356 | |||
357 | $ mkdir -p $TESTTMP/extlibroot/recursedown/abs |
|
357 | $ mkdir -p $TESTTMP/extlibroot/recursedown/abs | |
358 | $ cat > $TESTTMP/extlibroot/recursedown/abs/used.py <<EOF |
|
358 | $ cat > $TESTTMP/extlibroot/recursedown/abs/used.py <<EOF | |
359 | > detail = b"this is extlibroot.recursedown.abs.used" |
|
359 | > detail = b"this is extlibroot.recursedown.abs.used" | |
360 | > EOF |
|
360 | > EOF | |
361 | $ cat > $TESTTMP/extlibroot/recursedown/abs/__init__.py <<EOF |
|
361 | $ cat > $TESTTMP/extlibroot/recursedown/abs/__init__.py <<EOF | |
362 | > from __future__ import absolute_import |
|
362 | > from __future__ import absolute_import | |
363 | > from extlibroot.recursedown.abs.used import detail |
|
363 | > from extlibroot.recursedown.abs.used import detail | |
364 | > EOF |
|
364 | > EOF | |
365 |
|
365 | |||
366 | $ mkdir -p $TESTTMP/extlibroot/recursedown/legacy |
|
366 | $ mkdir -p $TESTTMP/extlibroot/recursedown/legacy | |
367 | $ cat > $TESTTMP/extlibroot/recursedown/legacy/used.py <<EOF |
|
367 | $ cat > $TESTTMP/extlibroot/recursedown/legacy/used.py <<EOF | |
368 | > detail = b"this is extlibroot.recursedown.legacy.used" |
|
368 | > detail = b"this is extlibroot.recursedown.legacy.used" | |
369 | > EOF |
|
369 | > EOF | |
370 | $ cat > $TESTTMP/extlibroot/recursedown/legacy/__init__.py <<EOF |
|
370 | $ cat > $TESTTMP/extlibroot/recursedown/legacy/__init__.py <<EOF | |
371 | > # legacy style (level == -1) import |
|
371 | > # legacy style (level == -1) import | |
372 | > from extlibroot.recursedown.legacy.used import detail |
|
372 | > from extlibroot.recursedown.legacy.used import detail | |
373 | > EOF |
|
373 | > EOF | |
374 |
|
374 | |||
375 | $ cat > $TESTTMP/extlibroot/recursedown/__init__.py <<EOF |
|
375 | $ cat > $TESTTMP/extlibroot/recursedown/__init__.py <<EOF | |
376 | > from __future__ import absolute_import |
|
376 | > from __future__ import absolute_import | |
377 | > from extlibroot.recursedown.abs import detail as absdetail |
|
377 | > from extlibroot.recursedown.abs import detail as absdetail | |
378 | > from .legacy import detail as legacydetail |
|
378 | > from .legacy import detail as legacydetail | |
379 | > EOF |
|
379 | > EOF | |
380 |
|
380 | |||
381 | Setup package that re-exports an attribute of its submodule as the same |
|
381 | Setup package that re-exports an attribute of its submodule as the same | |
382 | name. This leaves 'shadowing.used' pointing to 'used.detail', but still |
|
382 | name. This leaves 'shadowing.used' pointing to 'used.detail', but still | |
383 | the submodule 'used' should be somehow accessible. (issue5617) |
|
383 | the submodule 'used' should be somehow accessible. (issue5617) | |
384 |
|
384 | |||
385 | $ mkdir -p $TESTTMP/extlibroot/shadowing |
|
385 | $ mkdir -p $TESTTMP/extlibroot/shadowing | |
386 | $ cat > $TESTTMP/extlibroot/shadowing/used.py <<EOF |
|
386 | $ cat > $TESTTMP/extlibroot/shadowing/used.py <<EOF | |
387 | > detail = b"this is extlibroot.shadowing.used" |
|
387 | > detail = b"this is extlibroot.shadowing.used" | |
388 | > EOF |
|
388 | > EOF | |
389 | $ cat > $TESTTMP/extlibroot/shadowing/proxied.py <<EOF |
|
389 | $ cat > $TESTTMP/extlibroot/shadowing/proxied.py <<EOF | |
390 | > from __future__ import absolute_import |
|
390 | > from __future__ import absolute_import | |
391 | > from extlibroot.shadowing.used import detail |
|
391 | > from extlibroot.shadowing.used import detail | |
392 | > EOF |
|
392 | > EOF | |
393 | $ cat > $TESTTMP/extlibroot/shadowing/__init__.py <<EOF |
|
393 | $ cat > $TESTTMP/extlibroot/shadowing/__init__.py <<EOF | |
394 | > from __future__ import absolute_import |
|
394 | > from __future__ import absolute_import | |
395 | > from .used import detail as used |
|
395 | > from .used import detail as used | |
396 | > EOF |
|
396 | > EOF | |
397 |
|
397 | |||
398 | Setup extension local modules to be imported with "absolute_import" |
|
398 | Setup extension local modules to be imported with "absolute_import" | |
399 | feature. |
|
399 | feature. | |
400 |
|
400 | |||
401 | $ mkdir -p $TESTTMP/absextroot/xsub1/xsub2 |
|
401 | $ mkdir -p $TESTTMP/absextroot/xsub1/xsub2 | |
402 | $ touch $TESTTMP/absextroot/xsub1/__init__.py |
|
402 | $ touch $TESTTMP/absextroot/xsub1/__init__.py | |
403 | $ touch $TESTTMP/absextroot/xsub1/xsub2/__init__.py |
|
403 | $ touch $TESTTMP/absextroot/xsub1/xsub2/__init__.py | |
404 |
|
404 | |||
405 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/called.py <<EOF |
|
405 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/called.py <<EOF | |
406 | > def func(): |
|
406 | > def func(): | |
407 | > return b"this is absextroot.xsub1.xsub2.called.func()" |
|
407 | > return b"this is absextroot.xsub1.xsub2.called.func()" | |
408 | > EOF |
|
408 | > EOF | |
409 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/unused.py <<EOF |
|
409 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/unused.py <<EOF | |
410 | > raise Exception("absextroot.xsub1.xsub2.unused is loaded unintentionally") |
|
410 | > raise Exception("absextroot.xsub1.xsub2.unused is loaded unintentionally") | |
411 | > EOF |
|
411 | > EOF | |
412 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/used.py <<EOF |
|
412 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/used.py <<EOF | |
413 | > detail = b"this is absextroot.xsub1.xsub2.used" |
|
413 | > detail = b"this is absextroot.xsub1.xsub2.used" | |
414 | > EOF |
|
414 | > EOF | |
415 |
|
415 | |||
416 | Setup extension local modules to examine whether demand importing |
|
416 | Setup extension local modules to examine whether demand importing | |
417 | works as expected in "level > 1" case. |
|
417 | works as expected in "level > 1" case. | |
418 |
|
418 | |||
419 | $ cat > $TESTTMP/absextroot/relimportee.py <<EOF |
|
419 | $ cat > $TESTTMP/absextroot/relimportee.py <<EOF | |
420 | > detail = b"this is absextroot.relimportee" |
|
420 | > detail = b"this is absextroot.relimportee" | |
421 | > EOF |
|
421 | > EOF | |
422 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/relimporter.py <<EOF |
|
422 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/relimporter.py <<EOF | |
423 | > from __future__ import absolute_import |
|
423 | > from __future__ import absolute_import | |
424 | > from mercurial import pycompat |
|
424 | > from mercurial import pycompat | |
425 | > from ... import relimportee |
|
425 | > from ... import relimportee | |
426 | > detail = b"this relimporter imports %r" % ( |
|
426 | > detail = b"this relimporter imports %r" % ( | |
427 | > pycompat.bytestr(relimportee.detail)) |
|
427 | > pycompat.bytestr(relimportee.detail)) | |
428 | > EOF |
|
428 | > EOF | |
429 |
|
429 | |||
430 | Setup modules, which actually import extension local modules at |
|
430 | Setup modules, which actually import extension local modules at | |
431 | runtime. |
|
431 | runtime. | |
432 |
|
432 | |||
433 | $ cat > $TESTTMP/absextroot/absolute.py << EOF |
|
433 | $ cat > $TESTTMP/absextroot/absolute.py << EOF | |
434 | > from __future__ import absolute_import |
|
434 | > from __future__ import absolute_import | |
435 | > |
|
435 | > | |
436 | > # import extension local modules absolutely (level = 0) |
|
436 | > # import extension local modules absolutely (level = 0) | |
437 | > from absextroot.xsub1.xsub2 import used, unused |
|
437 | > from absextroot.xsub1.xsub2 import used, unused | |
438 | > from absextroot.xsub1.xsub2.called import func |
|
438 | > from absextroot.xsub1.xsub2.called import func | |
439 | > |
|
439 | > | |
440 | > def getresult(): |
|
440 | > def getresult(): | |
441 | > result = [] |
|
441 | > result = [] | |
442 | > result.append(used.detail) |
|
442 | > result.append(used.detail) | |
443 | > result.append(func()) |
|
443 | > result.append(func()) | |
444 | > return result |
|
444 | > return result | |
445 | > EOF |
|
445 | > EOF | |
446 |
|
446 | |||
447 | $ cat > $TESTTMP/absextroot/relative.py << EOF |
|
447 | $ cat > $TESTTMP/absextroot/relative.py << EOF | |
448 | > from __future__ import absolute_import |
|
448 | > from __future__ import absolute_import | |
449 | > |
|
449 | > | |
450 | > # import extension local modules relatively (level == 1) |
|
450 | > # import extension local modules relatively (level == 1) | |
451 | > from .xsub1.xsub2 import used, unused |
|
451 | > from .xsub1.xsub2 import used, unused | |
452 | > from .xsub1.xsub2.called import func |
|
452 | > from .xsub1.xsub2.called import func | |
453 | > |
|
453 | > | |
454 | > # import a module, which implies "importing with level > 1" |
|
454 | > # import a module, which implies "importing with level > 1" | |
455 | > from .xsub1.xsub2 import relimporter |
|
455 | > from .xsub1.xsub2 import relimporter | |
456 | > |
|
456 | > | |
457 | > def getresult(): |
|
457 | > def getresult(): | |
458 | > result = [] |
|
458 | > result = [] | |
459 | > result.append(used.detail) |
|
459 | > result.append(used.detail) | |
460 | > result.append(func()) |
|
460 | > result.append(func()) | |
461 | > result.append(relimporter.detail) |
|
461 | > result.append(relimporter.detail) | |
462 | > return result |
|
462 | > return result | |
463 | > EOF |
|
463 | > EOF | |
464 |
|
464 | |||
465 | Setup main procedure of extension. |
|
465 | Setup main procedure of extension. | |
466 |
|
466 | |||
467 | $ cat > $TESTTMP/absextroot/__init__.py <<EOF |
|
467 | $ cat > $TESTTMP/absextroot/__init__.py <<EOF | |
468 | > from __future__ import absolute_import |
|
468 | > from __future__ import absolute_import | |
469 | > from mercurial import registrar |
|
469 | > from mercurial import registrar | |
470 | > cmdtable = {} |
|
470 | > cmdtable = {} | |
471 | > command = registrar.command(cmdtable) |
|
471 | > command = registrar.command(cmdtable) | |
472 | > |
|
472 | > | |
473 | > # "absolute" and "relative" shouldn't be imported before actual |
|
473 | > # "absolute" and "relative" shouldn't be imported before actual | |
474 | > # command execution, because (1) they import same modules, and (2) |
|
474 | > # command execution, because (1) they import same modules, and (2) | |
475 | > # preceding import (= instantiate "demandmod" object instead of |
|
475 | > # preceding import (= instantiate "demandmod" object instead of | |
476 | > # real "module" object) might hide problem of succeeding import. |
|
476 | > # real "module" object) might hide problem of succeeding import. | |
477 | > |
|
477 | > | |
478 | > @command(b'showabsolute', [], norepo=True) |
|
478 | > @command(b'showabsolute', [], norepo=True) | |
479 | > def showabsolute(ui, *args, **opts): |
|
479 | > def showabsolute(ui, *args, **opts): | |
480 | > from absextroot import absolute |
|
480 | > from absextroot import absolute | |
481 | > ui.write(b'ABS: %s\n' % b'\nABS: '.join(absolute.getresult())) |
|
481 | > ui.write(b'ABS: %s\n' % b'\nABS: '.join(absolute.getresult())) | |
482 | > |
|
482 | > | |
483 | > @command(b'showrelative', [], norepo=True) |
|
483 | > @command(b'showrelative', [], norepo=True) | |
484 | > def showrelative(ui, *args, **opts): |
|
484 | > def showrelative(ui, *args, **opts): | |
485 | > from . import relative |
|
485 | > from . import relative | |
486 | > ui.write(b'REL: %s\n' % b'\nREL: '.join(relative.getresult())) |
|
486 | > ui.write(b'REL: %s\n' % b'\nREL: '.join(relative.getresult())) | |
487 | > |
|
487 | > | |
488 | > # import modules from external library |
|
488 | > # import modules from external library | |
489 | > from extlibroot.lsub1.lsub2 import used as lused, unused as lunused |
|
489 | > from extlibroot.lsub1.lsub2 import used as lused, unused as lunused | |
490 | > from extlibroot.lsub1.lsub2.called import func as lfunc |
|
490 | > from extlibroot.lsub1.lsub2.called import func as lfunc | |
491 | > from extlibroot.recursedown import absdetail, legacydetail |
|
491 | > from extlibroot.recursedown import absdetail, legacydetail | |
492 | > from extlibroot.shadowing import proxied |
|
492 | > from extlibroot.shadowing import proxied | |
493 | > |
|
493 | > | |
494 | > def uisetup(ui): |
|
494 | > def uisetup(ui): | |
495 | > result = [] |
|
495 | > result = [] | |
496 | > result.append(lused.detail) |
|
496 | > result.append(lused.detail) | |
497 | > result.append(lfunc()) |
|
497 | > result.append(lfunc()) | |
498 | > result.append(absdetail) |
|
498 | > result.append(absdetail) | |
499 | > result.append(legacydetail) |
|
499 | > result.append(legacydetail) | |
500 | > result.append(proxied.detail) |
|
500 | > result.append(proxied.detail) | |
501 | > ui.write(b'LIB: %s\n' % b'\nLIB: '.join(result)) |
|
501 | > ui.write(b'LIB: %s\n' % b'\nLIB: '.join(result)) | |
502 | > EOF |
|
502 | > EOF | |
503 |
|
503 | |||
504 | Examine module importing. |
|
504 | Examine module importing. | |
505 |
|
505 | |||
506 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showabsolute) |
|
506 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showabsolute) | |
507 | LIB: this is extlibroot.lsub1.lsub2.used |
|
507 | LIB: this is extlibroot.lsub1.lsub2.used | |
508 | LIB: this is extlibroot.lsub1.lsub2.called.func() |
|
508 | LIB: this is extlibroot.lsub1.lsub2.called.func() | |
509 | LIB: this is extlibroot.recursedown.abs.used |
|
509 | LIB: this is extlibroot.recursedown.abs.used | |
510 | LIB: this is extlibroot.recursedown.legacy.used |
|
510 | LIB: this is extlibroot.recursedown.legacy.used | |
511 | LIB: this is extlibroot.shadowing.used |
|
511 | LIB: this is extlibroot.shadowing.used | |
512 | ABS: this is absextroot.xsub1.xsub2.used |
|
512 | ABS: this is absextroot.xsub1.xsub2.used | |
513 | ABS: this is absextroot.xsub1.xsub2.called.func() |
|
513 | ABS: this is absextroot.xsub1.xsub2.called.func() | |
514 |
|
514 | |||
515 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showrelative) |
|
515 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showrelative) | |
516 | LIB: this is extlibroot.lsub1.lsub2.used |
|
516 | LIB: this is extlibroot.lsub1.lsub2.used | |
517 | LIB: this is extlibroot.lsub1.lsub2.called.func() |
|
517 | LIB: this is extlibroot.lsub1.lsub2.called.func() | |
518 | LIB: this is extlibroot.recursedown.abs.used |
|
518 | LIB: this is extlibroot.recursedown.abs.used | |
519 | LIB: this is extlibroot.recursedown.legacy.used |
|
519 | LIB: this is extlibroot.recursedown.legacy.used | |
520 | LIB: this is extlibroot.shadowing.used |
|
520 | LIB: this is extlibroot.shadowing.used | |
521 | REL: this is absextroot.xsub1.xsub2.used |
|
521 | REL: this is absextroot.xsub1.xsub2.used | |
522 | REL: this is absextroot.xsub1.xsub2.called.func() |
|
522 | REL: this is absextroot.xsub1.xsub2.called.func() | |
523 | REL: this relimporter imports 'this is absextroot.relimportee' |
|
523 | REL: this relimporter imports 'this is absextroot.relimportee' | |
524 |
|
524 | |||
525 | Examine whether sub-module is imported relatively as expected. |
|
525 | Examine whether sub-module is imported relatively as expected. | |
526 |
|
526 | |||
527 | See also issue5208 for detail about example case on Python 3.x. |
|
527 | See also issue5208 for detail about example case on Python 3.x. | |
528 |
|
528 | |||
529 | $ f -q $TESTTMP/extlibroot/lsub1/lsub2/notexist.py |
|
529 | $ f -q $TESTTMP/extlibroot/lsub1/lsub2/notexist.py | |
530 | $TESTTMP/extlibroot/lsub1/lsub2/notexist.py: file not found |
|
530 | $TESTTMP/extlibroot/lsub1/lsub2/notexist.py: file not found | |
531 |
|
531 | |||
532 | $ cat > $TESTTMP/notexist.py <<EOF |
|
532 | $ cat > $TESTTMP/notexist.py <<EOF | |
533 | > text = 'notexist.py at root is loaded unintentionally\n' |
|
533 | > text = 'notexist.py at root is loaded unintentionally\n' | |
534 | > EOF |
|
534 | > EOF | |
535 |
|
535 | |||
536 | $ cat > $TESTTMP/checkrelativity.py <<EOF |
|
536 | $ cat > $TESTTMP/checkrelativity.py <<EOF | |
537 | > from mercurial import registrar |
|
537 | > from mercurial import registrar | |
538 | > cmdtable = {} |
|
538 | > cmdtable = {} | |
539 | > command = registrar.command(cmdtable) |
|
539 | > command = registrar.command(cmdtable) | |
540 | > |
|
540 | > | |
541 | > # demand import avoids failure of importing notexist here |
|
541 | > # demand import avoids failure of importing notexist here | |
542 | > import extlibroot.lsub1.lsub2.notexist |
|
542 | > import extlibroot.lsub1.lsub2.notexist | |
543 | > |
|
543 | > | |
544 | > @command(b'checkrelativity', [], norepo=True) |
|
544 | > @command(b'checkrelativity', [], norepo=True) | |
545 | > def checkrelativity(ui, *args, **opts): |
|
545 | > def checkrelativity(ui, *args, **opts): | |
546 | > try: |
|
546 | > try: | |
547 | > ui.write(extlibroot.lsub1.lsub2.notexist.text) |
|
547 | > ui.write(extlibroot.lsub1.lsub2.notexist.text) | |
548 | > return 1 # unintentional success |
|
548 | > return 1 # unintentional success | |
549 | > except ImportError: |
|
549 | > except ImportError: | |
550 | > pass # intentional failure |
|
550 | > pass # intentional failure | |
551 | > EOF |
|
551 | > EOF | |
552 |
|
552 | |||
553 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.checkrelativity=$TESTTMP/checkrelativity.py checkrelativity) |
|
553 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.checkrelativity=$TESTTMP/checkrelativity.py checkrelativity) | |
554 |
|
554 | |||
555 | #endif |
|
555 | #endif | |
556 |
|
556 | |||
557 | Make sure a broken uisetup doesn't globally break hg: |
|
557 | Make sure a broken uisetup doesn't globally break hg: | |
558 | $ cat > $TESTTMP/baduisetup.py <<EOF |
|
558 | $ cat > $TESTTMP/baduisetup.py <<EOF | |
559 | > def uisetup(ui): |
|
559 | > def uisetup(ui): | |
560 | > 1/0 |
|
560 | > 1/0 | |
561 | > EOF |
|
561 | > EOF | |
562 |
|
562 | |||
563 | Even though the extension fails during uisetup, hg is still basically usable: |
|
563 | Even though the extension fails during uisetup, hg is still basically usable: | |
564 | $ hg --config extensions.baduisetup=$TESTTMP/baduisetup.py version |
|
564 | $ hg --config extensions.baduisetup=$TESTTMP/baduisetup.py version | |
565 | Traceback (most recent call last): |
|
565 | Traceback (most recent call last): | |
566 | File "*/mercurial/extensions.py", line *, in _runuisetup (glob) |
|
566 | File "*/mercurial/extensions.py", line *, in _runuisetup (glob) | |
567 | uisetup(ui) |
|
567 | uisetup(ui) | |
568 | File "$TESTTMP/baduisetup.py", line 2, in uisetup |
|
568 | File "$TESTTMP/baduisetup.py", line 2, in uisetup | |
569 | 1/0 |
|
569 | 1/0 | |
570 | ZeroDivisionError: * by zero (glob) |
|
570 | ZeroDivisionError: * by zero (glob) | |
571 | *** failed to set up extension baduisetup: * by zero (glob) |
|
571 | *** failed to set up extension baduisetup: * by zero (glob) | |
572 | Mercurial Distributed SCM (version *) (glob) |
|
572 | Mercurial Distributed SCM (version *) (glob) | |
573 | (see https://mercurial-scm.org for more information) |
|
573 | (see https://mercurial-scm.org for more information) | |
574 |
|
574 | |||
575 | Copyright (C) 2005-* Matt Mackall and others (glob) |
|
575 | Copyright (C) 2005-* Matt Mackall and others (glob) | |
576 | This is free software; see the source for copying conditions. There is NO |
|
576 | This is free software; see the source for copying conditions. There is NO | |
577 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
577 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
578 |
|
578 | |||
579 | $ cd .. |
|
579 | $ cd .. | |
580 |
|
580 | |||
581 | hide outer repo |
|
581 | hide outer repo | |
582 | $ hg init |
|
582 | $ hg init | |
583 |
|
583 | |||
584 | $ cat > empty.py <<EOF |
|
584 | $ cat > empty.py <<EOF | |
585 | > '''empty cmdtable |
|
585 | > '''empty cmdtable | |
586 | > ''' |
|
586 | > ''' | |
587 | > cmdtable = {} |
|
587 | > cmdtable = {} | |
588 | > EOF |
|
588 | > EOF | |
589 | $ emptypath=`pwd`/empty.py |
|
589 | $ emptypath=`pwd`/empty.py | |
590 | $ echo "empty = $emptypath" >> $HGRCPATH |
|
590 | $ echo "empty = $emptypath" >> $HGRCPATH | |
591 | $ hg help empty |
|
591 | $ hg help empty | |
592 | empty extension - empty cmdtable |
|
592 | empty extension - empty cmdtable | |
593 |
|
593 | |||
594 | no commands defined |
|
594 | no commands defined | |
595 |
|
595 | |||
596 |
|
596 | |||
597 | $ echo 'empty = !' >> $HGRCPATH |
|
597 | $ echo 'empty = !' >> $HGRCPATH | |
598 |
|
598 | |||
599 | $ cat > debugextension.py <<EOF |
|
599 | $ cat > debugextension.py <<EOF | |
600 | > '''only debugcommands |
|
600 | > '''only debugcommands | |
601 | > ''' |
|
601 | > ''' | |
602 | > from mercurial import registrar |
|
602 | > from mercurial import registrar | |
603 | > cmdtable = {} |
|
603 | > cmdtable = {} | |
604 | > command = registrar.command(cmdtable) |
|
604 | > command = registrar.command(cmdtable) | |
605 | > @command(b'debugfoobar', [], b'hg debugfoobar') |
|
605 | > @command(b'debugfoobar', [], b'hg debugfoobar') | |
606 | > def debugfoobar(ui, repo, *args, **opts): |
|
606 | > def debugfoobar(ui, repo, *args, **opts): | |
607 | > "yet another debug command" |
|
607 | > "yet another debug command" | |
608 | > pass |
|
608 | > pass | |
609 | > @command(b'foo', [], b'hg foo') |
|
609 | > @command(b'foo', [], b'hg foo') | |
610 | > def foo(ui, repo, *args, **opts): |
|
610 | > def foo(ui, repo, *args, **opts): | |
611 | > """yet another foo command |
|
611 | > """yet another foo command | |
612 | > This command has been DEPRECATED since forever. |
|
612 | > This command has been DEPRECATED since forever. | |
613 | > """ |
|
613 | > """ | |
614 | > pass |
|
614 | > pass | |
615 | > EOF |
|
615 | > EOF | |
616 | $ debugpath=`pwd`/debugextension.py |
|
616 | $ debugpath=`pwd`/debugextension.py | |
617 | $ echo "debugextension = $debugpath" >> $HGRCPATH |
|
617 | $ echo "debugextension = $debugpath" >> $HGRCPATH | |
618 |
|
618 | |||
619 | $ hg help debugextension |
|
619 | $ hg help debugextension | |
620 | hg debugextensions |
|
620 | hg debugextensions | |
621 |
|
621 | |||
622 | show information about active extensions |
|
622 | show information about active extensions | |
623 |
|
623 | |||
624 | options: |
|
624 | options: | |
625 |
|
625 | |||
626 | -T --template TEMPLATE display with template |
|
626 | -T --template TEMPLATE display with template | |
627 |
|
627 | |||
628 | (some details hidden, use --verbose to show complete help) |
|
628 | (some details hidden, use --verbose to show complete help) | |
629 |
|
629 | |||
630 |
|
630 | |||
631 | $ hg --verbose help debugextension |
|
631 | $ hg --verbose help debugextension | |
632 | hg debugextensions |
|
632 | hg debugextensions | |
633 |
|
633 | |||
634 | show information about active extensions |
|
634 | show information about active extensions | |
635 |
|
635 | |||
636 | options: |
|
636 | options: | |
637 |
|
637 | |||
638 | -T --template TEMPLATE display with template |
|
638 | -T --template TEMPLATE display with template | |
639 |
|
639 | |||
640 | global options ([+] can be repeated): |
|
640 | global options ([+] can be repeated): | |
641 |
|
641 | |||
642 | -R --repository REPO repository root directory or name of overlay bundle |
|
642 | -R --repository REPO repository root directory or name of overlay bundle | |
643 | file |
|
643 | file | |
644 | --cwd DIR change working directory |
|
644 | --cwd DIR change working directory | |
645 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
645 | -y --noninteractive do not prompt, automatically pick the first choice for | |
646 | all prompts |
|
646 | all prompts | |
647 | -q --quiet suppress output |
|
647 | -q --quiet suppress output | |
648 | -v --verbose enable additional output |
|
648 | -v --verbose enable additional output | |
649 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
649 | --color TYPE when to colorize (boolean, always, auto, never, or | |
650 | debug) |
|
650 | debug) | |
651 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
651 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
652 | --debug enable debugging output |
|
652 | --debug enable debugging output | |
653 | --debugger start debugger |
|
653 | --debugger start debugger | |
654 | --encoding ENCODE set the charset encoding (default: ascii) |
|
654 | --encoding ENCODE set the charset encoding (default: ascii) | |
655 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
655 | --encodingmode MODE set the charset encoding mode (default: strict) | |
656 | --traceback always print a traceback on exception |
|
656 | --traceback always print a traceback on exception | |
657 | --time time how long the command takes |
|
657 | --time time how long the command takes | |
658 | --profile print command execution profile |
|
658 | --profile print command execution profile | |
659 | --version output version information and exit |
|
659 | --version output version information and exit | |
660 | -h --help display help and exit |
|
660 | -h --help display help and exit | |
661 | --hidden consider hidden changesets |
|
661 | --hidden consider hidden changesets | |
662 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
662 | --pager TYPE when to paginate (boolean, always, auto, or never) | |
663 | (default: auto) |
|
663 | (default: auto) | |
664 |
|
664 | |||
665 |
|
665 | |||
666 |
|
666 | |||
667 |
|
667 | |||
668 |
|
668 | |||
669 |
|
669 | |||
670 | $ hg --debug help debugextension |
|
670 | $ hg --debug help debugextension | |
671 | hg debugextensions |
|
671 | hg debugextensions | |
672 |
|
672 | |||
673 | show information about active extensions |
|
673 | show information about active extensions | |
674 |
|
674 | |||
675 | options: |
|
675 | options: | |
676 |
|
676 | |||
677 | -T --template TEMPLATE display with template |
|
677 | -T --template TEMPLATE display with template | |
678 |
|
678 | |||
679 | global options ([+] can be repeated): |
|
679 | global options ([+] can be repeated): | |
680 |
|
680 | |||
681 | -R --repository REPO repository root directory or name of overlay bundle |
|
681 | -R --repository REPO repository root directory or name of overlay bundle | |
682 | file |
|
682 | file | |
683 | --cwd DIR change working directory |
|
683 | --cwd DIR change working directory | |
684 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
684 | -y --noninteractive do not prompt, automatically pick the first choice for | |
685 | all prompts |
|
685 | all prompts | |
686 | -q --quiet suppress output |
|
686 | -q --quiet suppress output | |
687 | -v --verbose enable additional output |
|
687 | -v --verbose enable additional output | |
688 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
688 | --color TYPE when to colorize (boolean, always, auto, never, or | |
689 | debug) |
|
689 | debug) | |
690 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
690 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
691 | --debug enable debugging output |
|
691 | --debug enable debugging output | |
692 | --debugger start debugger |
|
692 | --debugger start debugger | |
693 | --encoding ENCODE set the charset encoding (default: ascii) |
|
693 | --encoding ENCODE set the charset encoding (default: ascii) | |
694 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
694 | --encodingmode MODE set the charset encoding mode (default: strict) | |
695 | --traceback always print a traceback on exception |
|
695 | --traceback always print a traceback on exception | |
696 | --time time how long the command takes |
|
696 | --time time how long the command takes | |
697 | --profile print command execution profile |
|
697 | --profile print command execution profile | |
698 | --version output version information and exit |
|
698 | --version output version information and exit | |
699 | -h --help display help and exit |
|
699 | -h --help display help and exit | |
700 | --hidden consider hidden changesets |
|
700 | --hidden consider hidden changesets | |
701 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
701 | --pager TYPE when to paginate (boolean, always, auto, or never) | |
702 | (default: auto) |
|
702 | (default: auto) | |
703 |
|
703 | |||
704 |
|
704 | |||
705 |
|
705 | |||
706 |
|
706 | |||
707 |
|
707 | |||
708 | $ echo 'debugextension = !' >> $HGRCPATH |
|
708 | $ echo 'debugextension = !' >> $HGRCPATH | |
709 |
|
709 | |||
710 | Asking for help about a deprecated extension should do something useful: |
|
710 | Asking for help about a deprecated extension should do something useful: | |
711 |
|
711 | |||
712 | $ hg help glog |
|
712 | $ hg help glog | |
713 | 'glog' is provided by the following extension: |
|
713 | 'glog' is provided by the following extension: | |
714 |
|
714 | |||
715 | graphlog command to view revision graphs from a shell (DEPRECATED) |
|
715 | graphlog command to view revision graphs from a shell (DEPRECATED) | |
716 |
|
716 | |||
717 | (use 'hg help extensions' for information on enabling extensions) |
|
717 | (use 'hg help extensions' for information on enabling extensions) | |
718 |
|
718 | |||
719 | Extension module help vs command help: |
|
719 | Extension module help vs command help: | |
720 |
|
720 | |||
721 | $ echo 'extdiff =' >> $HGRCPATH |
|
721 | $ echo 'extdiff =' >> $HGRCPATH | |
722 | $ hg help extdiff |
|
722 | $ hg help extdiff | |
723 | hg extdiff [OPT]... [FILE]... |
|
723 | hg extdiff [OPT]... [FILE]... | |
724 |
|
724 | |||
725 | use external program to diff repository (or selected files) |
|
725 | use external program to diff repository (or selected files) | |
726 |
|
726 | |||
727 | Show differences between revisions for the specified files, using an |
|
727 | Show differences between revisions for the specified files, using an | |
728 | external program. The default program used is diff, with default options |
|
728 | external program. The default program used is diff, with default options | |
729 | "-Npru". |
|
729 | "-Npru". | |
730 |
|
730 | |||
731 | To select a different program, use the -p/--program option. The program |
|
731 | To select a different program, use the -p/--program option. The program | |
732 | will be passed the names of two directories to compare. To pass additional |
|
732 | will be passed the names of two directories to compare. To pass additional | |
733 | options to the program, use -o/--option. These will be passed before the |
|
733 | options to the program, use -o/--option. These will be passed before the | |
734 | names of the directories to compare. |
|
734 | names of the directories to compare. | |
735 |
|
735 | |||
736 | When two revision arguments are given, then changes are shown between |
|
736 | When two revision arguments are given, then changes are shown between | |
737 | those revisions. If only one revision is specified then that revision is |
|
737 | those revisions. If only one revision is specified then that revision is | |
738 | compared to the working directory, and, when no revisions are specified, |
|
738 | compared to the working directory, and, when no revisions are specified, | |
739 | the working directory files are compared to its parent. |
|
739 | the working directory files are compared to its parent. | |
740 |
|
740 | |||
741 | (use 'hg help -e extdiff' to show help for the extdiff extension) |
|
741 | (use 'hg help -e extdiff' to show help for the extdiff extension) | |
742 |
|
742 | |||
743 | options ([+] can be repeated): |
|
743 | options ([+] can be repeated): | |
744 |
|
744 | |||
745 | -p --program CMD comparison program to run |
|
745 | -p --program CMD comparison program to run | |
746 | -o --option OPT [+] pass option to comparison program |
|
746 | -o --option OPT [+] pass option to comparison program | |
747 | -r --rev REV [+] revision |
|
747 | -r --rev REV [+] revision | |
748 | -c --change REV change made by revision |
|
748 | -c --change REV change made by revision | |
749 | --patch compare patches for two revisions |
|
749 | --patch compare patches for two revisions | |
750 | -I --include PATTERN [+] include names matching the given patterns |
|
750 | -I --include PATTERN [+] include names matching the given patterns | |
751 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
751 | -X --exclude PATTERN [+] exclude names matching the given patterns | |
752 | -S --subrepos recurse into subrepositories |
|
752 | -S --subrepos recurse into subrepositories | |
753 |
|
753 | |||
754 | (some details hidden, use --verbose to show complete help) |
|
754 | (some details hidden, use --verbose to show complete help) | |
755 |
|
755 | |||
756 |
|
756 | |||
757 |
|
757 | |||
758 |
|
758 | |||
759 |
|
759 | |||
760 |
|
760 | |||
761 |
|
761 | |||
762 |
|
762 | |||
763 |
|
763 | |||
764 |
|
764 | |||
765 | $ hg help --extension extdiff |
|
765 | $ hg help --extension extdiff | |
766 | extdiff extension - command to allow external programs to compare revisions |
|
766 | extdiff extension - command to allow external programs to compare revisions | |
767 |
|
767 | |||
768 | The extdiff Mercurial extension allows you to use external programs to compare |
|
768 | The extdiff Mercurial extension allows you to use external programs to compare | |
769 | revisions, or revision with working directory. The external diff programs are |
|
769 | revisions, or revision with working directory. The external diff programs are | |
770 | called with a configurable set of options and two non-option arguments: paths |
|
770 | called with a configurable set of options and two non-option arguments: paths | |
771 | to directories containing snapshots of files to compare. |
|
771 | to directories containing snapshots of files to compare. | |
772 |
|
772 | |||
773 | If there is more than one file being compared and the "child" revision is the |
|
773 | If there is more than one file being compared and the "child" revision is the | |
774 | working directory, any modifications made in the external diff program will be |
|
774 | working directory, any modifications made in the external diff program will be | |
775 | copied back to the working directory from the temporary directory. |
|
775 | copied back to the working directory from the temporary directory. | |
776 |
|
776 | |||
777 | The extdiff extension also allows you to configure new diff commands, so you |
|
777 | The extdiff extension also allows you to configure new diff commands, so you | |
778 | do not need to type 'hg extdiff -p kdiff3' always. |
|
778 | do not need to type 'hg extdiff -p kdiff3' always. | |
779 |
|
779 | |||
780 | [extdiff] |
|
780 | [extdiff] | |
781 | # add new command that runs GNU diff(1) in 'context diff' mode |
|
781 | # add new command that runs GNU diff(1) in 'context diff' mode | |
782 | cdiff = gdiff -Nprc5 |
|
782 | cdiff = gdiff -Nprc5 | |
783 | ## or the old way: |
|
783 | ## or the old way: | |
784 | #cmd.cdiff = gdiff |
|
784 | #cmd.cdiff = gdiff | |
785 | #opts.cdiff = -Nprc5 |
|
785 | #opts.cdiff = -Nprc5 | |
786 |
|
786 | |||
787 | # add new command called meld, runs meld (no need to name twice). If |
|
787 | # add new command called meld, runs meld (no need to name twice). If | |
788 | # the meld executable is not available, the meld tool in [merge-tools] |
|
788 | # the meld executable is not available, the meld tool in [merge-tools] | |
789 | # will be used, if available |
|
789 | # will be used, if available | |
790 | meld = |
|
790 | meld = | |
791 |
|
791 | |||
792 | # add new command called vimdiff, runs gvimdiff with DirDiff plugin |
|
792 | # add new command called vimdiff, runs gvimdiff with DirDiff plugin | |
793 | # (see http://www.vim.org/scripts/script.php?script_id=102) Non |
|
793 | # (see http://www.vim.org/scripts/script.php?script_id=102) Non | |
794 | # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in |
|
794 | # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in | |
795 | # your .vimrc |
|
795 | # your .vimrc | |
796 | vimdiff = gvim -f "+next" \ |
|
796 | vimdiff = gvim -f "+next" \ | |
797 | "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))" |
|
797 | "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))" | |
798 |
|
798 | |||
799 | Tool arguments can include variables that are expanded at runtime: |
|
799 | Tool arguments can include variables that are expanded at runtime: | |
800 |
|
800 | |||
801 | $parent1, $plabel1 - filename, descriptive label of first parent |
|
801 | $parent1, $plabel1 - filename, descriptive label of first parent | |
802 | $child, $clabel - filename, descriptive label of child revision |
|
802 | $child, $clabel - filename, descriptive label of child revision | |
803 | $parent2, $plabel2 - filename, descriptive label of second parent |
|
803 | $parent2, $plabel2 - filename, descriptive label of second parent | |
804 | $root - repository root |
|
804 | $root - repository root | |
805 | $parent is an alias for $parent1. |
|
805 | $parent is an alias for $parent1. | |
806 |
|
806 | |||
807 | The extdiff extension will look in your [diff-tools] and [merge-tools] |
|
807 | The extdiff extension will look in your [diff-tools] and [merge-tools] | |
808 | sections for diff tool arguments, when none are specified in [extdiff]. |
|
808 | sections for diff tool arguments, when none are specified in [extdiff]. | |
809 |
|
809 | |||
810 | [extdiff] |
|
810 | [extdiff] | |
811 | kdiff3 = |
|
811 | kdiff3 = | |
812 |
|
812 | |||
813 | [diff-tools] |
|
813 | [diff-tools] | |
814 | kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child |
|
814 | kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child | |
815 |
|
815 | |||
816 | You can use -I/-X and list of file or directory names like normal 'hg diff' |
|
816 | You can use -I/-X and list of file or directory names like normal 'hg diff' | |
817 | command. The extdiff extension makes snapshots of only needed files, so |
|
817 | command. The extdiff extension makes snapshots of only needed files, so | |
818 | running the external diff program will actually be pretty fast (at least |
|
818 | running the external diff program will actually be pretty fast (at least | |
819 | faster than having to compare the entire tree). |
|
819 | faster than having to compare the entire tree). | |
820 |
|
820 | |||
821 | list of commands: |
|
821 | list of commands: | |
822 |
|
822 | |||
823 | extdiff use external program to diff repository (or selected files) |
|
823 | extdiff use external program to diff repository (or selected files) | |
824 |
|
824 | |||
825 | (use 'hg help -v -e extdiff' to show built-in aliases and global options) |
|
825 | (use 'hg help -v -e extdiff' to show built-in aliases and global options) | |
826 |
|
826 | |||
827 |
|
827 | |||
828 |
|
828 | |||
829 |
|
829 | |||
830 |
|
830 | |||
831 |
|
831 | |||
832 |
|
832 | |||
833 |
|
833 | |||
834 |
|
834 | |||
835 |
|
835 | |||
836 |
|
836 | |||
837 |
|
837 | |||
838 |
|
838 | |||
839 |
|
839 | |||
840 |
|
840 | |||
841 |
|
841 | |||
842 | $ echo 'extdiff = !' >> $HGRCPATH |
|
842 | $ echo 'extdiff = !' >> $HGRCPATH | |
843 |
|
843 | |||
844 | Test help topic with same name as extension |
|
844 | Test help topic with same name as extension | |
845 |
|
845 | |||
846 | $ cat > multirevs.py <<EOF |
|
846 | $ cat > multirevs.py <<EOF | |
847 | > from mercurial import commands, registrar |
|
847 | > from mercurial import commands, registrar | |
848 | > cmdtable = {} |
|
848 | > cmdtable = {} | |
849 | > command = registrar.command(cmdtable) |
|
849 | > command = registrar.command(cmdtable) | |
850 | > """multirevs extension |
|
850 | > """multirevs extension | |
851 | > Big multi-line module docstring.""" |
|
851 | > Big multi-line module docstring.""" | |
852 | > @command(b'multirevs', [], b'ARG', norepo=True) |
|
852 | > @command(b'multirevs', [], b'ARG', norepo=True) | |
853 | > def multirevs(ui, repo, arg, *args, **opts): |
|
853 | > def multirevs(ui, repo, arg, *args, **opts): | |
854 | > """multirevs command""" |
|
854 | > """multirevs command""" | |
855 | > pass |
|
855 | > pass | |
856 | > EOF |
|
856 | > EOF | |
857 | $ echo "multirevs = multirevs.py" >> $HGRCPATH |
|
857 | $ echo "multirevs = multirevs.py" >> $HGRCPATH | |
858 |
|
858 | |||
859 | $ hg help multirevs | tail |
|
859 | $ hg help multirevs | tail | |
860 | used): |
|
860 | used): | |
861 |
|
861 | |||
862 | hg update :@ |
|
862 | hg update :@ | |
863 |
|
863 | |||
864 | - Show diff between tags 1.3 and 1.5 (this works because the first and the |
|
864 | - Show diff between tags 1.3 and 1.5 (this works because the first and the | |
865 | last revisions of the revset are used): |
|
865 | last revisions of the revset are used): | |
866 |
|
866 | |||
867 | hg diff -r 1.3::1.5 |
|
867 | hg diff -r 1.3::1.5 | |
868 |
|
868 | |||
869 | use 'hg help -c multirevs' to see help for the multirevs command |
|
869 | use 'hg help -c multirevs' to see help for the multirevs command | |
870 |
|
870 | |||
871 |
|
871 | |||
872 |
|
872 | |||
873 |
|
873 | |||
874 |
|
874 | |||
875 |
|
875 | |||
876 | $ hg help -c multirevs |
|
876 | $ hg help -c multirevs | |
877 | hg multirevs ARG |
|
877 | hg multirevs ARG | |
878 |
|
878 | |||
879 | multirevs command |
|
879 | multirevs command | |
880 |
|
880 | |||
881 | (some details hidden, use --verbose to show complete help) |
|
881 | (some details hidden, use --verbose to show complete help) | |
882 |
|
882 | |||
883 |
|
883 | |||
884 |
|
884 | |||
885 | $ hg multirevs |
|
885 | $ hg multirevs | |
886 | hg multirevs: invalid arguments |
|
886 | hg multirevs: invalid arguments | |
887 | hg multirevs ARG |
|
887 | hg multirevs ARG | |
888 |
|
888 | |||
889 | multirevs command |
|
889 | multirevs command | |
890 |
|
890 | |||
891 | (use 'hg multirevs -h' to show more help) |
|
891 | (use 'hg multirevs -h' to show more help) | |
892 | [255] |
|
892 | [255] | |
893 |
|
893 | |||
894 |
|
894 | |||
895 |
|
895 | |||
896 | $ echo "multirevs = !" >> $HGRCPATH |
|
896 | $ echo "multirevs = !" >> $HGRCPATH | |
897 |
|
897 | |||
898 | Issue811: Problem loading extensions twice (by site and by user) |
|
898 | Issue811: Problem loading extensions twice (by site and by user) | |
899 |
|
899 | |||
900 | $ cat <<EOF >> $HGRCPATH |
|
900 | $ cat <<EOF >> $HGRCPATH | |
901 | > mq = |
|
901 | > mq = | |
902 | > strip = |
|
902 | > strip = | |
903 | > hgext.mq = |
|
903 | > hgext.mq = | |
904 | > hgext/mq = |
|
904 | > hgext/mq = | |
905 | > EOF |
|
905 | > EOF | |
906 |
|
906 | |||
907 | Show extensions: |
|
907 | Show extensions: | |
908 | (note that mq force load strip, also checking it's not loaded twice) |
|
908 | (note that mq force load strip, also checking it's not loaded twice) | |
909 |
|
909 | |||
910 | #if no-extraextensions |
|
910 | #if no-extraextensions | |
911 | $ hg debugextensions |
|
911 | $ hg debugextensions | |
912 | mq |
|
912 | mq | |
913 | strip |
|
913 | strip | |
914 | #endif |
|
914 | #endif | |
915 |
|
915 | |||
916 | For extensions, which name matches one of its commands, help |
|
916 | For extensions, which name matches one of its commands, help | |
917 | message should ask '-v -e' to get list of built-in aliases |
|
917 | message should ask '-v -e' to get list of built-in aliases | |
918 | along with extension help itself |
|
918 | along with extension help itself | |
919 |
|
919 | |||
920 | $ mkdir $TESTTMP/d |
|
920 | $ mkdir $TESTTMP/d | |
921 | $ cat > $TESTTMP/d/dodo.py <<EOF |
|
921 | $ cat > $TESTTMP/d/dodo.py <<EOF | |
922 | > """ |
|
922 | > """ | |
923 | > This is an awesome 'dodo' extension. It does nothing and |
|
923 | > This is an awesome 'dodo' extension. It does nothing and | |
924 | > writes 'Foo foo' |
|
924 | > writes 'Foo foo' | |
925 | > """ |
|
925 | > """ | |
926 | > from mercurial import commands, registrar |
|
926 | > from mercurial import commands, registrar | |
927 | > cmdtable = {} |
|
927 | > cmdtable = {} | |
928 | > command = registrar.command(cmdtable) |
|
928 | > command = registrar.command(cmdtable) | |
929 | > @command(b'dodo', [], b'hg dodo') |
|
929 | > @command(b'dodo', [], b'hg dodo') | |
930 | > def dodo(ui, *args, **kwargs): |
|
930 | > def dodo(ui, *args, **kwargs): | |
931 | > """Does nothing""" |
|
931 | > """Does nothing""" | |
932 | > ui.write(b"I do nothing. Yay\\n") |
|
932 | > ui.write(b"I do nothing. Yay\\n") | |
933 | > @command(b'foofoo', [], b'hg foofoo') |
|
933 | > @command(b'foofoo', [], b'hg foofoo') | |
934 | > def foofoo(ui, *args, **kwargs): |
|
934 | > def foofoo(ui, *args, **kwargs): | |
935 | > """Writes 'Foo foo'""" |
|
935 | > """Writes 'Foo foo'""" | |
936 | > ui.write(b"Foo foo\\n") |
|
936 | > ui.write(b"Foo foo\\n") | |
937 | > EOF |
|
937 | > EOF | |
938 | $ dodopath=$TESTTMP/d/dodo.py |
|
938 | $ dodopath=$TESTTMP/d/dodo.py | |
939 |
|
939 | |||
940 | $ echo "dodo = $dodopath" >> $HGRCPATH |
|
940 | $ echo "dodo = $dodopath" >> $HGRCPATH | |
941 |
|
941 | |||
942 | Make sure that user is asked to enter '-v -e' to get list of built-in aliases |
|
942 | Make sure that user is asked to enter '-v -e' to get list of built-in aliases | |
943 | $ hg help -e dodo |
|
943 | $ hg help -e dodo | |
944 | dodo extension - |
|
944 | dodo extension - | |
945 |
|
945 | |||
946 | This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo' |
|
946 | This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo' | |
947 |
|
947 | |||
948 | list of commands: |
|
948 | list of commands: | |
949 |
|
949 | |||
950 | dodo Does nothing |
|
950 | dodo Does nothing | |
951 | foofoo Writes 'Foo foo' |
|
951 | foofoo Writes 'Foo foo' | |
952 |
|
952 | |||
953 | (use 'hg help -v -e dodo' to show built-in aliases and global options) |
|
953 | (use 'hg help -v -e dodo' to show built-in aliases and global options) | |
954 |
|
954 | |||
955 | Make sure that '-v -e' prints list of built-in aliases along with |
|
955 | Make sure that '-v -e' prints list of built-in aliases along with | |
956 | extension help itself |
|
956 | extension help itself | |
957 | $ hg help -v -e dodo |
|
957 | $ hg help -v -e dodo | |
958 | dodo extension - |
|
958 | dodo extension - | |
959 |
|
959 | |||
960 | This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo' |
|
960 | This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo' | |
961 |
|
961 | |||
962 | list of commands: |
|
962 | list of commands: | |
963 |
|
963 | |||
964 | dodo Does nothing |
|
964 | dodo Does nothing | |
965 | foofoo Writes 'Foo foo' |
|
965 | foofoo Writes 'Foo foo' | |
966 |
|
966 | |||
967 | global options ([+] can be repeated): |
|
967 | global options ([+] can be repeated): | |
968 |
|
968 | |||
969 | -R --repository REPO repository root directory or name of overlay bundle |
|
969 | -R --repository REPO repository root directory or name of overlay bundle | |
970 | file |
|
970 | file | |
971 | --cwd DIR change working directory |
|
971 | --cwd DIR change working directory | |
972 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
972 | -y --noninteractive do not prompt, automatically pick the first choice for | |
973 | all prompts |
|
973 | all prompts | |
974 | -q --quiet suppress output |
|
974 | -q --quiet suppress output | |
975 | -v --verbose enable additional output |
|
975 | -v --verbose enable additional output | |
976 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
976 | --color TYPE when to colorize (boolean, always, auto, never, or | |
977 | debug) |
|
977 | debug) | |
978 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
978 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
979 | --debug enable debugging output |
|
979 | --debug enable debugging output | |
980 | --debugger start debugger |
|
980 | --debugger start debugger | |
981 | --encoding ENCODE set the charset encoding (default: ascii) |
|
981 | --encoding ENCODE set the charset encoding (default: ascii) | |
982 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
982 | --encodingmode MODE set the charset encoding mode (default: strict) | |
983 | --traceback always print a traceback on exception |
|
983 | --traceback always print a traceback on exception | |
984 | --time time how long the command takes |
|
984 | --time time how long the command takes | |
985 | --profile print command execution profile |
|
985 | --profile print command execution profile | |
986 | --version output version information and exit |
|
986 | --version output version information and exit | |
987 | -h --help display help and exit |
|
987 | -h --help display help and exit | |
988 | --hidden consider hidden changesets |
|
988 | --hidden consider hidden changesets | |
989 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
989 | --pager TYPE when to paginate (boolean, always, auto, or never) | |
990 | (default: auto) |
|
990 | (default: auto) | |
991 |
|
991 | |||
992 | Make sure that single '-v' option shows help and built-ins only for 'dodo' command |
|
992 | Make sure that single '-v' option shows help and built-ins only for 'dodo' command | |
993 | $ hg help -v dodo |
|
993 | $ hg help -v dodo | |
994 | hg dodo |
|
994 | hg dodo | |
995 |
|
995 | |||
996 | Does nothing |
|
996 | Does nothing | |
997 |
|
997 | |||
998 | (use 'hg help -e dodo' to show help for the dodo extension) |
|
998 | (use 'hg help -e dodo' to show help for the dodo extension) | |
999 |
|
999 | |||
1000 | options: |
|
1000 | options: | |
1001 |
|
1001 | |||
1002 | --mq operate on patch repository |
|
1002 | --mq operate on patch repository | |
1003 |
|
1003 | |||
1004 | global options ([+] can be repeated): |
|
1004 | global options ([+] can be repeated): | |
1005 |
|
1005 | |||
1006 | -R --repository REPO repository root directory or name of overlay bundle |
|
1006 | -R --repository REPO repository root directory or name of overlay bundle | |
1007 | file |
|
1007 | file | |
1008 | --cwd DIR change working directory |
|
1008 | --cwd DIR change working directory | |
1009 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
1009 | -y --noninteractive do not prompt, automatically pick the first choice for | |
1010 | all prompts |
|
1010 | all prompts | |
1011 | -q --quiet suppress output |
|
1011 | -q --quiet suppress output | |
1012 | -v --verbose enable additional output |
|
1012 | -v --verbose enable additional output | |
1013 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
1013 | --color TYPE when to colorize (boolean, always, auto, never, or | |
1014 | debug) |
|
1014 | debug) | |
1015 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
1015 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
1016 | --debug enable debugging output |
|
1016 | --debug enable debugging output | |
1017 | --debugger start debugger |
|
1017 | --debugger start debugger | |
1018 | --encoding ENCODE set the charset encoding (default: ascii) |
|
1018 | --encoding ENCODE set the charset encoding (default: ascii) | |
1019 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
1019 | --encodingmode MODE set the charset encoding mode (default: strict) | |
1020 | --traceback always print a traceback on exception |
|
1020 | --traceback always print a traceback on exception | |
1021 | --time time how long the command takes |
|
1021 | --time time how long the command takes | |
1022 | --profile print command execution profile |
|
1022 | --profile print command execution profile | |
1023 | --version output version information and exit |
|
1023 | --version output version information and exit | |
1024 | -h --help display help and exit |
|
1024 | -h --help display help and exit | |
1025 | --hidden consider hidden changesets |
|
1025 | --hidden consider hidden changesets | |
1026 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
1026 | --pager TYPE when to paginate (boolean, always, auto, or never) | |
1027 | (default: auto) |
|
1027 | (default: auto) | |
1028 |
|
1028 | |||
1029 | In case when extension name doesn't match any of its commands, |
|
1029 | In case when extension name doesn't match any of its commands, | |
1030 | help message should ask for '-v' to get list of built-in aliases |
|
1030 | help message should ask for '-v' to get list of built-in aliases | |
1031 | along with extension help |
|
1031 | along with extension help | |
1032 | $ cat > $TESTTMP/d/dudu.py <<EOF |
|
1032 | $ cat > $TESTTMP/d/dudu.py <<EOF | |
1033 | > """ |
|
1033 | > """ | |
1034 | > This is an awesome 'dudu' extension. It does something and |
|
1034 | > This is an awesome 'dudu' extension. It does something and | |
1035 | > also writes 'Beep beep' |
|
1035 | > also writes 'Beep beep' | |
1036 | > """ |
|
1036 | > """ | |
1037 | > from mercurial import commands, registrar |
|
1037 | > from mercurial import commands, registrar | |
1038 | > cmdtable = {} |
|
1038 | > cmdtable = {} | |
1039 | > command = registrar.command(cmdtable) |
|
1039 | > command = registrar.command(cmdtable) | |
1040 | > @command(b'something', [], b'hg something') |
|
1040 | > @command(b'something', [], b'hg something') | |
1041 | > def something(ui, *args, **kwargs): |
|
1041 | > def something(ui, *args, **kwargs): | |
1042 | > """Does something""" |
|
1042 | > """Does something""" | |
1043 | > ui.write(b"I do something. Yaaay\\n") |
|
1043 | > ui.write(b"I do something. Yaaay\\n") | |
1044 | > @command(b'beep', [], b'hg beep') |
|
1044 | > @command(b'beep', [], b'hg beep') | |
1045 | > def beep(ui, *args, **kwargs): |
|
1045 | > def beep(ui, *args, **kwargs): | |
1046 | > """Writes 'Beep beep'""" |
|
1046 | > """Writes 'Beep beep'""" | |
1047 | > ui.write(b"Beep beep\\n") |
|
1047 | > ui.write(b"Beep beep\\n") | |
1048 | > EOF |
|
1048 | > EOF | |
1049 | $ dudupath=$TESTTMP/d/dudu.py |
|
1049 | $ dudupath=$TESTTMP/d/dudu.py | |
1050 |
|
1050 | |||
1051 | $ echo "dudu = $dudupath" >> $HGRCPATH |
|
1051 | $ echo "dudu = $dudupath" >> $HGRCPATH | |
1052 |
|
1052 | |||
1053 | $ hg help -e dudu |
|
1053 | $ hg help -e dudu | |
1054 | dudu extension - |
|
1054 | dudu extension - | |
1055 |
|
1055 | |||
1056 | This is an awesome 'dudu' extension. It does something and also writes 'Beep |
|
1056 | This is an awesome 'dudu' extension. It does something and also writes 'Beep | |
1057 | beep' |
|
1057 | beep' | |
1058 |
|
1058 | |||
1059 | list of commands: |
|
1059 | list of commands: | |
1060 |
|
1060 | |||
1061 | beep Writes 'Beep beep' |
|
1061 | beep Writes 'Beep beep' | |
1062 | something Does something |
|
1062 | something Does something | |
1063 |
|
1063 | |||
1064 | (use 'hg help -v dudu' to show built-in aliases and global options) |
|
1064 | (use 'hg help -v dudu' to show built-in aliases and global options) | |
1065 |
|
1065 | |||
1066 | In case when extension name doesn't match any of its commands, |
|
1066 | In case when extension name doesn't match any of its commands, | |
1067 | help options '-v' and '-v -e' should be equivalent |
|
1067 | help options '-v' and '-v -e' should be equivalent | |
1068 | $ hg help -v dudu |
|
1068 | $ hg help -v dudu | |
1069 | dudu extension - |
|
1069 | dudu extension - | |
1070 |
|
1070 | |||
1071 | This is an awesome 'dudu' extension. It does something and also writes 'Beep |
|
1071 | This is an awesome 'dudu' extension. It does something and also writes 'Beep | |
1072 | beep' |
|
1072 | beep' | |
1073 |
|
1073 | |||
1074 | list of commands: |
|
1074 | list of commands: | |
1075 |
|
1075 | |||
1076 | beep Writes 'Beep beep' |
|
1076 | beep Writes 'Beep beep' | |
1077 | something Does something |
|
1077 | something Does something | |
1078 |
|
1078 | |||
1079 | global options ([+] can be repeated): |
|
1079 | global options ([+] can be repeated): | |
1080 |
|
1080 | |||
1081 | -R --repository REPO repository root directory or name of overlay bundle |
|
1081 | -R --repository REPO repository root directory or name of overlay bundle | |
1082 | file |
|
1082 | file | |
1083 | --cwd DIR change working directory |
|
1083 | --cwd DIR change working directory | |
1084 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
1084 | -y --noninteractive do not prompt, automatically pick the first choice for | |
1085 | all prompts |
|
1085 | all prompts | |
1086 | -q --quiet suppress output |
|
1086 | -q --quiet suppress output | |
1087 | -v --verbose enable additional output |
|
1087 | -v --verbose enable additional output | |
1088 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
1088 | --color TYPE when to colorize (boolean, always, auto, never, or | |
1089 | debug) |
|
1089 | debug) | |
1090 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
1090 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
1091 | --debug enable debugging output |
|
1091 | --debug enable debugging output | |
1092 | --debugger start debugger |
|
1092 | --debugger start debugger | |
1093 | --encoding ENCODE set the charset encoding (default: ascii) |
|
1093 | --encoding ENCODE set the charset encoding (default: ascii) | |
1094 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
1094 | --encodingmode MODE set the charset encoding mode (default: strict) | |
1095 | --traceback always print a traceback on exception |
|
1095 | --traceback always print a traceback on exception | |
1096 | --time time how long the command takes |
|
1096 | --time time how long the command takes | |
1097 | --profile print command execution profile |
|
1097 | --profile print command execution profile | |
1098 | --version output version information and exit |
|
1098 | --version output version information and exit | |
1099 | -h --help display help and exit |
|
1099 | -h --help display help and exit | |
1100 | --hidden consider hidden changesets |
|
1100 | --hidden consider hidden changesets | |
1101 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
1101 | --pager TYPE when to paginate (boolean, always, auto, or never) | |
1102 | (default: auto) |
|
1102 | (default: auto) | |
1103 |
|
1103 | |||
1104 | $ hg help -v -e dudu |
|
1104 | $ hg help -v -e dudu | |
1105 | dudu extension - |
|
1105 | dudu extension - | |
1106 |
|
1106 | |||
1107 | This is an awesome 'dudu' extension. It does something and also writes 'Beep |
|
1107 | This is an awesome 'dudu' extension. It does something and also writes 'Beep | |
1108 | beep' |
|
1108 | beep' | |
1109 |
|
1109 | |||
1110 | list of commands: |
|
1110 | list of commands: | |
1111 |
|
1111 | |||
1112 | beep Writes 'Beep beep' |
|
1112 | beep Writes 'Beep beep' | |
1113 | something Does something |
|
1113 | something Does something | |
1114 |
|
1114 | |||
1115 | global options ([+] can be repeated): |
|
1115 | global options ([+] can be repeated): | |
1116 |
|
1116 | |||
1117 | -R --repository REPO repository root directory or name of overlay bundle |
|
1117 | -R --repository REPO repository root directory or name of overlay bundle | |
1118 | file |
|
1118 | file | |
1119 | --cwd DIR change working directory |
|
1119 | --cwd DIR change working directory | |
1120 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
1120 | -y --noninteractive do not prompt, automatically pick the first choice for | |
1121 | all prompts |
|
1121 | all prompts | |
1122 | -q --quiet suppress output |
|
1122 | -q --quiet suppress output | |
1123 | -v --verbose enable additional output |
|
1123 | -v --verbose enable additional output | |
1124 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
1124 | --color TYPE when to colorize (boolean, always, auto, never, or | |
1125 | debug) |
|
1125 | debug) | |
1126 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
1126 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
1127 | --debug enable debugging output |
|
1127 | --debug enable debugging output | |
1128 | --debugger start debugger |
|
1128 | --debugger start debugger | |
1129 | --encoding ENCODE set the charset encoding (default: ascii) |
|
1129 | --encoding ENCODE set the charset encoding (default: ascii) | |
1130 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
1130 | --encodingmode MODE set the charset encoding mode (default: strict) | |
1131 | --traceback always print a traceback on exception |
|
1131 | --traceback always print a traceback on exception | |
1132 | --time time how long the command takes |
|
1132 | --time time how long the command takes | |
1133 | --profile print command execution profile |
|
1133 | --profile print command execution profile | |
1134 | --version output version information and exit |
|
1134 | --version output version information and exit | |
1135 | -h --help display help and exit |
|
1135 | -h --help display help and exit | |
1136 | --hidden consider hidden changesets |
|
1136 | --hidden consider hidden changesets | |
1137 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
1137 | --pager TYPE when to paginate (boolean, always, auto, or never) | |
1138 | (default: auto) |
|
1138 | (default: auto) | |
1139 |
|
1139 | |||
1140 | Disabled extension commands: |
|
1140 | Disabled extension commands: | |
1141 |
|
1141 | |||
1142 | $ ORGHGRCPATH=$HGRCPATH |
|
1142 | $ ORGHGRCPATH=$HGRCPATH | |
1143 | $ HGRCPATH= |
|
1143 | $ HGRCPATH= | |
1144 | $ export HGRCPATH |
|
1144 | $ export HGRCPATH | |
1145 | $ hg help email |
|
1145 | $ hg help email | |
1146 | 'email' is provided by the following extension: |
|
1146 | 'email' is provided by the following extension: | |
1147 |
|
1147 | |||
1148 | patchbomb command to send changesets as (a series of) patch emails |
|
1148 | patchbomb command to send changesets as (a series of) patch emails | |
1149 |
|
1149 | |||
1150 | (use 'hg help extensions' for information on enabling extensions) |
|
1150 | (use 'hg help extensions' for information on enabling extensions) | |
1151 |
|
1151 | |||
1152 |
|
1152 | |||
1153 | $ hg qdel |
|
1153 | $ hg qdel | |
1154 | hg: unknown command 'qdel' |
|
1154 | hg: unknown command 'qdel' | |
1155 | 'qdelete' is provided by the following extension: |
|
1155 | 'qdelete' is provided by the following extension: | |
1156 |
|
1156 | |||
1157 | mq manage a stack of patches |
|
1157 | mq manage a stack of patches | |
1158 |
|
1158 | |||
1159 | (use 'hg help extensions' for information on enabling extensions) |
|
1159 | (use 'hg help extensions' for information on enabling extensions) | |
1160 | [255] |
|
1160 | [255] | |
1161 |
|
1161 | |||
1162 |
|
1162 | |||
1163 | $ hg churn |
|
1163 | $ hg churn | |
1164 | hg: unknown command 'churn' |
|
1164 | hg: unknown command 'churn' | |
1165 | 'churn' is provided by the following extension: |
|
1165 | 'churn' is provided by the following extension: | |
1166 |
|
1166 | |||
1167 | churn command to display statistics about repository history |
|
1167 | churn command to display statistics about repository history | |
1168 |
|
1168 | |||
1169 | (use 'hg help extensions' for information on enabling extensions) |
|
1169 | (use 'hg help extensions' for information on enabling extensions) | |
1170 | [255] |
|
1170 | [255] | |
1171 |
|
1171 | |||
1172 |
|
1172 | |||
1173 |
|
1173 | |||
1174 | Disabled extensions: |
|
1174 | Disabled extensions: | |
1175 |
|
1175 | |||
1176 | $ hg help churn |
|
1176 | $ hg help churn | |
1177 | churn extension - command to display statistics about repository history |
|
1177 | churn extension - command to display statistics about repository history | |
1178 |
|
1178 | |||
1179 | (use 'hg help extensions' for information on enabling extensions) |
|
1179 | (use 'hg help extensions' for information on enabling extensions) | |
1180 |
|
1180 | |||
1181 | $ hg help patchbomb |
|
1181 | $ hg help patchbomb | |
1182 | patchbomb extension - command to send changesets as (a series of) patch emails |
|
1182 | patchbomb extension - command to send changesets as (a series of) patch emails | |
1183 |
|
1183 | |||
1184 | The series is started off with a "[PATCH 0 of N]" introduction, which |
|
1184 | The series is started off with a "[PATCH 0 of N]" introduction, which | |
1185 | describes the series as a whole. |
|
1185 | describes the series as a whole. | |
1186 |
|
1186 | |||
1187 | Each patch email has a Subject line of "[PATCH M of N] ...", using the first |
|
1187 | Each patch email has a Subject line of "[PATCH M of N] ...", using the first | |
1188 | line of the changeset description as the subject text. The message contains |
|
1188 | line of the changeset description as the subject text. The message contains | |
1189 | two or three body parts: |
|
1189 | two or three body parts: | |
1190 |
|
1190 | |||
1191 | - The changeset description. |
|
1191 | - The changeset description. | |
1192 | - [Optional] The result of running diffstat on the patch. |
|
1192 | - [Optional] The result of running diffstat on the patch. | |
1193 | - The patch itself, as generated by 'hg export'. |
|
1193 | - The patch itself, as generated by 'hg export'. | |
1194 |
|
1194 | |||
1195 | Each message refers to the first in the series using the In-Reply-To and |
|
1195 | Each message refers to the first in the series using the In-Reply-To and | |
1196 | References headers, so they will show up as a sequence in threaded mail and |
|
1196 | References headers, so they will show up as a sequence in threaded mail and | |
1197 | news readers, and in mail archives. |
|
1197 | news readers, and in mail archives. | |
1198 |
|
1198 | |||
1199 | To configure other defaults, add a section like this to your configuration |
|
1199 | To configure other defaults, add a section like this to your configuration | |
1200 | file: |
|
1200 | file: | |
1201 |
|
1201 | |||
1202 | [email] |
|
1202 | [email] | |
1203 | from = My Name <my@email> |
|
1203 | from = My Name <my@email> | |
1204 | to = recipient1, recipient2, ... |
|
1204 | to = recipient1, recipient2, ... | |
1205 | cc = cc1, cc2, ... |
|
1205 | cc = cc1, cc2, ... | |
1206 | bcc = bcc1, bcc2, ... |
|
1206 | bcc = bcc1, bcc2, ... | |
1207 | reply-to = address1, address2, ... |
|
1207 | reply-to = address1, address2, ... | |
1208 |
|
1208 | |||
1209 | Use "[patchbomb]" as configuration section name if you need to override global |
|
1209 | Use "[patchbomb]" as configuration section name if you need to override global | |
1210 | "[email]" address settings. |
|
1210 | "[email]" address settings. | |
1211 |
|
1211 | |||
1212 | Then you can use the 'hg email' command to mail a series of changesets as a |
|
1212 | Then you can use the 'hg email' command to mail a series of changesets as a | |
1213 | patchbomb. |
|
1213 | patchbomb. | |
1214 |
|
1214 | |||
1215 | You can also either configure the method option in the email section to be a |
|
1215 | You can also either configure the method option in the email section to be a | |
1216 | sendmail compatible mailer or fill out the [smtp] section so that the |
|
1216 | sendmail compatible mailer or fill out the [smtp] section so that the | |
1217 | patchbomb extension can automatically send patchbombs directly from the |
|
1217 | patchbomb extension can automatically send patchbombs directly from the | |
1218 | commandline. See the [email] and [smtp] sections in hgrc(5) for details. |
|
1218 | commandline. See the [email] and [smtp] sections in hgrc(5) for details. | |
1219 |
|
1219 | |||
1220 | By default, 'hg email' will prompt for a "To" or "CC" header if you do not |
|
1220 | By default, 'hg email' will prompt for a "To" or "CC" header if you do not | |
1221 | supply one via configuration or the command line. You can override this to |
|
1221 | supply one via configuration or the command line. You can override this to | |
1222 | never prompt by configuring an empty value: |
|
1222 | never prompt by configuring an empty value: | |
1223 |
|
1223 | |||
1224 | [email] |
|
1224 | [email] | |
1225 | cc = |
|
1225 | cc = | |
1226 |
|
1226 | |||
1227 | You can control the default inclusion of an introduction message with the |
|
1227 | You can control the default inclusion of an introduction message with the | |
1228 | "patchbomb.intro" configuration option. The configuration is always |
|
1228 | "patchbomb.intro" configuration option. The configuration is always | |
1229 | overwritten by command line flags like --intro and --desc: |
|
1229 | overwritten by command line flags like --intro and --desc: | |
1230 |
|
1230 | |||
1231 | [patchbomb] |
|
1231 | [patchbomb] | |
1232 | intro=auto # include introduction message if more than 1 patch (default) |
|
1232 | intro=auto # include introduction message if more than 1 patch (default) | |
1233 | intro=never # never include an introduction message |
|
1233 | intro=never # never include an introduction message | |
1234 | intro=always # always include an introduction message |
|
1234 | intro=always # always include an introduction message | |
1235 |
|
1235 | |||
1236 | You can specify a template for flags to be added in subject prefixes. Flags |
|
1236 | You can specify a template for flags to be added in subject prefixes. Flags | |
1237 | specified by --flag option are exported as "{flags}" keyword: |
|
1237 | specified by --flag option are exported as "{flags}" keyword: | |
1238 |
|
1238 | |||
1239 | [patchbomb] |
|
1239 | [patchbomb] | |
1240 | flagtemplate = "{separate(' ', |
|
1240 | flagtemplate = "{separate(' ', | |
1241 | ifeq(branch, 'default', '', branch|upper), |
|
1241 | ifeq(branch, 'default', '', branch|upper), | |
1242 | flags)}" |
|
1242 | flags)}" | |
1243 |
|
1243 | |||
1244 | You can set patchbomb to always ask for confirmation by setting |
|
1244 | You can set patchbomb to always ask for confirmation by setting | |
1245 | "patchbomb.confirm" to true. |
|
1245 | "patchbomb.confirm" to true. | |
1246 |
|
1246 | |||
1247 | (use 'hg help extensions' for information on enabling extensions) |
|
1247 | (use 'hg help extensions' for information on enabling extensions) | |
1248 |
|
1248 | |||
1249 |
|
1249 | |||
1250 | Broken disabled extension and command: |
|
1250 | Broken disabled extension and command: | |
1251 |
|
1251 | |||
1252 | $ mkdir hgext |
|
1252 | $ mkdir hgext | |
1253 | $ echo > hgext/__init__.py |
|
1253 | $ echo > hgext/__init__.py | |
1254 | $ cat > hgext/broken.py <<EOF |
|
1254 | $ cat > hgext/broken.py <<NO_CHECK_EOF | |
1255 | > "broken extension' |
|
1255 | > "broken extension' | |
1256 | > EOF |
|
1256 | > NO_CHECK_EOF | |
1257 | $ cat > path.py <<EOF |
|
1257 | $ cat > path.py <<EOF | |
1258 | > import os, sys |
|
1258 | > import os, sys | |
1259 | > sys.path.insert(0, os.environ['HGEXTPATH']) |
|
1259 | > sys.path.insert(0, os.environ['HGEXTPATH']) | |
1260 | > EOF |
|
1260 | > EOF | |
1261 | $ HGEXTPATH=`pwd` |
|
1261 | $ HGEXTPATH=`pwd` | |
1262 | $ export HGEXTPATH |
|
1262 | $ export HGEXTPATH | |
1263 |
|
1263 | |||
1264 | $ hg --config extensions.path=./path.py help broken |
|
1264 | $ hg --config extensions.path=./path.py help broken | |
1265 | broken extension - (no help text available) |
|
1265 | broken extension - (no help text available) | |
1266 |
|
1266 | |||
1267 | (use 'hg help extensions' for information on enabling extensions) |
|
1267 | (use 'hg help extensions' for information on enabling extensions) | |
1268 |
|
1268 | |||
1269 |
|
1269 | |||
1270 | $ cat > hgext/forest.py <<EOF |
|
1270 | $ cat > hgext/forest.py <<EOF | |
1271 | > cmdtable = None |
|
1271 | > cmdtable = None | |
1272 | > @command() |
|
1272 | > @command() | |
1273 | > def f(): |
|
1273 | > def f(): | |
1274 | > pass |
|
1274 | > pass | |
1275 | > @command(123) |
|
1275 | > @command(123) | |
1276 | > def g(): |
|
1276 | > def g(): | |
1277 | > pass |
|
1277 | > pass | |
1278 | > EOF |
|
1278 | > EOF | |
1279 | $ hg --config extensions.path=./path.py help foo |
|
1279 | $ hg --config extensions.path=./path.py help foo | |
1280 | abort: no such help topic: foo |
|
1280 | abort: no such help topic: foo | |
1281 | (try 'hg help --keyword foo') |
|
1281 | (try 'hg help --keyword foo') | |
1282 | [255] |
|
1282 | [255] | |
1283 |
|
1283 | |||
1284 | $ cat > throw.py <<EOF |
|
1284 | $ cat > throw.py <<EOF | |
1285 | > from mercurial import commands, registrar, util |
|
1285 | > from mercurial import commands, registrar, util | |
1286 | > cmdtable = {} |
|
1286 | > cmdtable = {} | |
1287 | > command = registrar.command(cmdtable) |
|
1287 | > command = registrar.command(cmdtable) | |
1288 | > class Bogon(Exception): pass |
|
1288 | > class Bogon(Exception): pass | |
1289 | > @command(b'throw', [], b'hg throw', norepo=True) |
|
1289 | > @command(b'throw', [], b'hg throw', norepo=True) | |
1290 | > def throw(ui, **opts): |
|
1290 | > def throw(ui, **opts): | |
1291 | > """throws an exception""" |
|
1291 | > """throws an exception""" | |
1292 | > raise Bogon() |
|
1292 | > raise Bogon() | |
1293 | > EOF |
|
1293 | > EOF | |
1294 |
|
1294 | |||
1295 | No declared supported version, extension complains: |
|
1295 | No declared supported version, extension complains: | |
1296 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
1296 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
1297 | ** Unknown exception encountered with possibly-broken third-party extension throw |
|
1297 | ** Unknown exception encountered with possibly-broken third-party extension throw | |
1298 | ** which supports versions unknown of Mercurial. |
|
1298 | ** which supports versions unknown of Mercurial. | |
1299 | ** Please disable throw and try your action again. |
|
1299 | ** Please disable throw and try your action again. | |
1300 | ** If that fixes the bug please report it to the extension author. |
|
1300 | ** If that fixes the bug please report it to the extension author. | |
1301 | ** Python * (glob) |
|
1301 | ** Python * (glob) | |
1302 | ** Mercurial Distributed SCM * (glob) |
|
1302 | ** Mercurial Distributed SCM * (glob) | |
1303 | ** Extensions loaded: throw |
|
1303 | ** Extensions loaded: throw | |
1304 |
|
1304 | |||
1305 | empty declaration of supported version, extension complains: |
|
1305 | empty declaration of supported version, extension complains: | |
1306 | $ echo "testedwith = ''" >> throw.py |
|
1306 | $ echo "testedwith = ''" >> throw.py | |
1307 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
1307 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
1308 | ** Unknown exception encountered with possibly-broken third-party extension throw |
|
1308 | ** Unknown exception encountered with possibly-broken third-party extension throw | |
1309 | ** which supports versions unknown of Mercurial. |
|
1309 | ** which supports versions unknown of Mercurial. | |
1310 | ** Please disable throw and try your action again. |
|
1310 | ** Please disable throw and try your action again. | |
1311 | ** If that fixes the bug please report it to the extension author. |
|
1311 | ** If that fixes the bug please report it to the extension author. | |
1312 | ** Python * (glob) |
|
1312 | ** Python * (glob) | |
1313 | ** Mercurial Distributed SCM (*) (glob) |
|
1313 | ** Mercurial Distributed SCM (*) (glob) | |
1314 | ** Extensions loaded: throw |
|
1314 | ** Extensions loaded: throw | |
1315 |
|
1315 | |||
1316 | If the extension specifies a buglink, show that: |
|
1316 | If the extension specifies a buglink, show that: | |
1317 | $ echo 'buglink = "http://example.com/bts"' >> throw.py |
|
1317 | $ echo 'buglink = "http://example.com/bts"' >> throw.py | |
1318 | $ rm -f throw.pyc throw.pyo |
|
1318 | $ rm -f throw.pyc throw.pyo | |
1319 | $ rm -Rf __pycache__ |
|
1319 | $ rm -Rf __pycache__ | |
1320 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
1320 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
1321 | ** Unknown exception encountered with possibly-broken third-party extension throw |
|
1321 | ** Unknown exception encountered with possibly-broken third-party extension throw | |
1322 | ** which supports versions unknown of Mercurial. |
|
1322 | ** which supports versions unknown of Mercurial. | |
1323 | ** Please disable throw and try your action again. |
|
1323 | ** Please disable throw and try your action again. | |
1324 | ** If that fixes the bug please report it to http://example.com/bts |
|
1324 | ** If that fixes the bug please report it to http://example.com/bts | |
1325 | ** Python * (glob) |
|
1325 | ** Python * (glob) | |
1326 | ** Mercurial Distributed SCM (*) (glob) |
|
1326 | ** Mercurial Distributed SCM (*) (glob) | |
1327 | ** Extensions loaded: throw |
|
1327 | ** Extensions loaded: throw | |
1328 |
|
1328 | |||
1329 | If the extensions declare outdated versions, accuse the older extension first: |
|
1329 | If the extensions declare outdated versions, accuse the older extension first: | |
1330 | $ echo "from mercurial import util" >> older.py |
|
1330 | $ echo "from mercurial import util" >> older.py | |
1331 | $ echo "util.version = lambda:b'2.2'" >> older.py |
|
1331 | $ echo "util.version = lambda:b'2.2'" >> older.py | |
1332 | $ echo "testedwith = b'1.9.3'" >> older.py |
|
1332 | $ echo "testedwith = b'1.9.3'" >> older.py | |
1333 | $ echo "testedwith = b'2.1.1'" >> throw.py |
|
1333 | $ echo "testedwith = b'2.1.1'" >> throw.py | |
1334 | $ rm -f throw.pyc throw.pyo |
|
1334 | $ rm -f throw.pyc throw.pyo | |
1335 | $ rm -Rf __pycache__ |
|
1335 | $ rm -Rf __pycache__ | |
1336 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
1336 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ | |
1337 | > throw 2>&1 | egrep '^\*\*' |
|
1337 | > throw 2>&1 | egrep '^\*\*' | |
1338 | ** Unknown exception encountered with possibly-broken third-party extension older |
|
1338 | ** Unknown exception encountered with possibly-broken third-party extension older | |
1339 | ** which supports versions 1.9 of Mercurial. |
|
1339 | ** which supports versions 1.9 of Mercurial. | |
1340 | ** Please disable older and try your action again. |
|
1340 | ** Please disable older and try your action again. | |
1341 | ** If that fixes the bug please report it to the extension author. |
|
1341 | ** If that fixes the bug please report it to the extension author. | |
1342 | ** Python * (glob) |
|
1342 | ** Python * (glob) | |
1343 | ** Mercurial Distributed SCM (version 2.2) |
|
1343 | ** Mercurial Distributed SCM (version 2.2) | |
1344 | ** Extensions loaded: throw, older |
|
1344 | ** Extensions loaded: throw, older | |
1345 |
|
1345 | |||
1346 | One extension only tested with older, one only with newer versions: |
|
1346 | One extension only tested with older, one only with newer versions: | |
1347 | $ echo "util.version = lambda:b'2.1'" >> older.py |
|
1347 | $ echo "util.version = lambda:b'2.1'" >> older.py | |
1348 | $ rm -f older.pyc older.pyo |
|
1348 | $ rm -f older.pyc older.pyo | |
1349 | $ rm -Rf __pycache__ |
|
1349 | $ rm -Rf __pycache__ | |
1350 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
1350 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ | |
1351 | > throw 2>&1 | egrep '^\*\*' |
|
1351 | > throw 2>&1 | egrep '^\*\*' | |
1352 | ** Unknown exception encountered with possibly-broken third-party extension older |
|
1352 | ** Unknown exception encountered with possibly-broken third-party extension older | |
1353 | ** which supports versions 1.9 of Mercurial. |
|
1353 | ** which supports versions 1.9 of Mercurial. | |
1354 | ** Please disable older and try your action again. |
|
1354 | ** Please disable older and try your action again. | |
1355 | ** If that fixes the bug please report it to the extension author. |
|
1355 | ** If that fixes the bug please report it to the extension author. | |
1356 | ** Python * (glob) |
|
1356 | ** Python * (glob) | |
1357 | ** Mercurial Distributed SCM (version 2.1) |
|
1357 | ** Mercurial Distributed SCM (version 2.1) | |
1358 | ** Extensions loaded: throw, older |
|
1358 | ** Extensions loaded: throw, older | |
1359 |
|
1359 | |||
1360 | Older extension is tested with current version, the other only with newer: |
|
1360 | Older extension is tested with current version, the other only with newer: | |
1361 | $ echo "util.version = lambda:b'1.9.3'" >> older.py |
|
1361 | $ echo "util.version = lambda:b'1.9.3'" >> older.py | |
1362 | $ rm -f older.pyc older.pyo |
|
1362 | $ rm -f older.pyc older.pyo | |
1363 | $ rm -Rf __pycache__ |
|
1363 | $ rm -Rf __pycache__ | |
1364 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
1364 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ | |
1365 | > throw 2>&1 | egrep '^\*\*' |
|
1365 | > throw 2>&1 | egrep '^\*\*' | |
1366 | ** Unknown exception encountered with possibly-broken third-party extension throw |
|
1366 | ** Unknown exception encountered with possibly-broken third-party extension throw | |
1367 | ** which supports versions 2.1 of Mercurial. |
|
1367 | ** which supports versions 2.1 of Mercurial. | |
1368 | ** Please disable throw and try your action again. |
|
1368 | ** Please disable throw and try your action again. | |
1369 | ** If that fixes the bug please report it to http://example.com/bts |
|
1369 | ** If that fixes the bug please report it to http://example.com/bts | |
1370 | ** Python * (glob) |
|
1370 | ** Python * (glob) | |
1371 | ** Mercurial Distributed SCM (version 1.9.3) |
|
1371 | ** Mercurial Distributed SCM (version 1.9.3) | |
1372 | ** Extensions loaded: throw, older |
|
1372 | ** Extensions loaded: throw, older | |
1373 |
|
1373 | |||
1374 | Ability to point to a different point |
|
1374 | Ability to point to a different point | |
1375 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
1375 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ | |
1376 | > --config ui.supportcontact='Your Local Goat Lenders' throw 2>&1 | egrep '^\*\*' |
|
1376 | > --config ui.supportcontact='Your Local Goat Lenders' throw 2>&1 | egrep '^\*\*' | |
1377 | ** unknown exception encountered, please report by visiting |
|
1377 | ** unknown exception encountered, please report by visiting | |
1378 | ** Your Local Goat Lenders |
|
1378 | ** Your Local Goat Lenders | |
1379 | ** Python * (glob) |
|
1379 | ** Python * (glob) | |
1380 | ** Mercurial Distributed SCM (*) (glob) |
|
1380 | ** Mercurial Distributed SCM (*) (glob) | |
1381 | ** Extensions loaded: throw, older |
|
1381 | ** Extensions loaded: throw, older | |
1382 |
|
1382 | |||
1383 | Declare the version as supporting this hg version, show regular bts link: |
|
1383 | Declare the version as supporting this hg version, show regular bts link: | |
1384 | $ hgver=`hg debuginstall -T '{hgver}'` |
|
1384 | $ hgver=`hg debuginstall -T '{hgver}'` | |
1385 | $ echo 'testedwith = """'"$hgver"'"""' >> throw.py |
|
1385 | $ echo 'testedwith = """'"$hgver"'"""' >> throw.py | |
1386 | $ if [ -z "$hgver" ]; then |
|
1386 | $ if [ -z "$hgver" ]; then | |
1387 | > echo "unable to fetch a mercurial version. Make sure __version__ is correct"; |
|
1387 | > echo "unable to fetch a mercurial version. Make sure __version__ is correct"; | |
1388 | > fi |
|
1388 | > fi | |
1389 | $ rm -f throw.pyc throw.pyo |
|
1389 | $ rm -f throw.pyc throw.pyo | |
1390 | $ rm -Rf __pycache__ |
|
1390 | $ rm -Rf __pycache__ | |
1391 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
1391 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
1392 | ** unknown exception encountered, please report by visiting |
|
1392 | ** unknown exception encountered, please report by visiting | |
1393 | ** https://mercurial-scm.org/wiki/BugTracker |
|
1393 | ** https://mercurial-scm.org/wiki/BugTracker | |
1394 | ** Python * (glob) |
|
1394 | ** Python * (glob) | |
1395 | ** Mercurial Distributed SCM (*) (glob) |
|
1395 | ** Mercurial Distributed SCM (*) (glob) | |
1396 | ** Extensions loaded: throw |
|
1396 | ** Extensions loaded: throw | |
1397 |
|
1397 | |||
1398 | Patch version is ignored during compatibility check |
|
1398 | Patch version is ignored during compatibility check | |
1399 | $ echo "testedwith = b'3.2'" >> throw.py |
|
1399 | $ echo "testedwith = b'3.2'" >> throw.py | |
1400 | $ echo "util.version = lambda:b'3.2.2'" >> throw.py |
|
1400 | $ echo "util.version = lambda:b'3.2.2'" >> throw.py | |
1401 | $ rm -f throw.pyc throw.pyo |
|
1401 | $ rm -f throw.pyc throw.pyo | |
1402 | $ rm -Rf __pycache__ |
|
1402 | $ rm -Rf __pycache__ | |
1403 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
1403 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
1404 | ** unknown exception encountered, please report by visiting |
|
1404 | ** unknown exception encountered, please report by visiting | |
1405 | ** https://mercurial-scm.org/wiki/BugTracker |
|
1405 | ** https://mercurial-scm.org/wiki/BugTracker | |
1406 | ** Python * (glob) |
|
1406 | ** Python * (glob) | |
1407 | ** Mercurial Distributed SCM (*) (glob) |
|
1407 | ** Mercurial Distributed SCM (*) (glob) | |
1408 | ** Extensions loaded: throw |
|
1408 | ** Extensions loaded: throw | |
1409 |
|
1409 | |||
1410 | Test version number support in 'hg version': |
|
1410 | Test version number support in 'hg version': | |
1411 | $ echo '__version__ = (1, 2, 3)' >> throw.py |
|
1411 | $ echo '__version__ = (1, 2, 3)' >> throw.py | |
1412 | $ rm -f throw.pyc throw.pyo |
|
1412 | $ rm -f throw.pyc throw.pyo | |
1413 | $ rm -Rf __pycache__ |
|
1413 | $ rm -Rf __pycache__ | |
1414 | $ hg version -v |
|
1414 | $ hg version -v | |
1415 | Mercurial Distributed SCM (version *) (glob) |
|
1415 | Mercurial Distributed SCM (version *) (glob) | |
1416 | (see https://mercurial-scm.org for more information) |
|
1416 | (see https://mercurial-scm.org for more information) | |
1417 |
|
1417 | |||
1418 | Copyright (C) 2005-* Matt Mackall and others (glob) |
|
1418 | Copyright (C) 2005-* Matt Mackall and others (glob) | |
1419 | This is free software; see the source for copying conditions. There is NO |
|
1419 | This is free software; see the source for copying conditions. There is NO | |
1420 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1420 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
1421 |
|
1421 | |||
1422 | Enabled extensions: |
|
1422 | Enabled extensions: | |
1423 |
|
1423 | |||
1424 |
|
1424 | |||
1425 | $ hg version -v --config extensions.throw=throw.py |
|
1425 | $ hg version -v --config extensions.throw=throw.py | |
1426 | Mercurial Distributed SCM (version *) (glob) |
|
1426 | Mercurial Distributed SCM (version *) (glob) | |
1427 | (see https://mercurial-scm.org for more information) |
|
1427 | (see https://mercurial-scm.org for more information) | |
1428 |
|
1428 | |||
1429 | Copyright (C) 2005-* Matt Mackall and others (glob) |
|
1429 | Copyright (C) 2005-* Matt Mackall and others (glob) | |
1430 | This is free software; see the source for copying conditions. There is NO |
|
1430 | This is free software; see the source for copying conditions. There is NO | |
1431 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1431 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
1432 |
|
1432 | |||
1433 | Enabled extensions: |
|
1433 | Enabled extensions: | |
1434 |
|
1434 | |||
1435 | throw external 1.2.3 |
|
1435 | throw external 1.2.3 | |
1436 | $ echo 'getversion = lambda: b"1.twentythree"' >> throw.py |
|
1436 | $ echo 'getversion = lambda: b"1.twentythree"' >> throw.py | |
1437 | $ rm -f throw.pyc throw.pyo |
|
1437 | $ rm -f throw.pyc throw.pyo | |
1438 | $ rm -Rf __pycache__ |
|
1438 | $ rm -Rf __pycache__ | |
1439 | $ hg version -v --config extensions.throw=throw.py --config extensions.strip= |
|
1439 | $ hg version -v --config extensions.throw=throw.py --config extensions.strip= | |
1440 | Mercurial Distributed SCM (version *) (glob) |
|
1440 | Mercurial Distributed SCM (version *) (glob) | |
1441 | (see https://mercurial-scm.org for more information) |
|
1441 | (see https://mercurial-scm.org for more information) | |
1442 |
|
1442 | |||
1443 | Copyright (C) 2005-* Matt Mackall and others (glob) |
|
1443 | Copyright (C) 2005-* Matt Mackall and others (glob) | |
1444 | This is free software; see the source for copying conditions. There is NO |
|
1444 | This is free software; see the source for copying conditions. There is NO | |
1445 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1445 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
1446 |
|
1446 | |||
1447 | Enabled extensions: |
|
1447 | Enabled extensions: | |
1448 |
|
1448 | |||
1449 | throw external 1.twentythree |
|
1449 | throw external 1.twentythree | |
1450 | strip internal |
|
1450 | strip internal | |
1451 |
|
1451 | |||
1452 | $ hg version -q --config extensions.throw=throw.py |
|
1452 | $ hg version -q --config extensions.throw=throw.py | |
1453 | Mercurial Distributed SCM (version *) (glob) |
|
1453 | Mercurial Distributed SCM (version *) (glob) | |
1454 |
|
1454 | |||
1455 | Test template output: |
|
1455 | Test template output: | |
1456 |
|
1456 | |||
1457 | $ hg version --config extensions.strip= -T'{extensions}' |
|
1457 | $ hg version --config extensions.strip= -T'{extensions}' | |
1458 | strip |
|
1458 | strip | |
1459 |
|
1459 | |||
1460 | Test JSON output of version: |
|
1460 | Test JSON output of version: | |
1461 |
|
1461 | |||
1462 | $ hg version -Tjson |
|
1462 | $ hg version -Tjson | |
1463 | [ |
|
1463 | [ | |
1464 | { |
|
1464 | { | |
1465 | "extensions": [], |
|
1465 | "extensions": [], | |
1466 | "ver": "*" (glob) |
|
1466 | "ver": "*" (glob) | |
1467 | } |
|
1467 | } | |
1468 | ] |
|
1468 | ] | |
1469 |
|
1469 | |||
1470 | $ hg version --config extensions.throw=throw.py -Tjson |
|
1470 | $ hg version --config extensions.throw=throw.py -Tjson | |
1471 | [ |
|
1471 | [ | |
1472 | { |
|
1472 | { | |
1473 | "extensions": [{"bundled": false, "name": "throw", "ver": "1.twentythree"}], |
|
1473 | "extensions": [{"bundled": false, "name": "throw", "ver": "1.twentythree"}], | |
1474 | "ver": "3.2.2" |
|
1474 | "ver": "3.2.2" | |
1475 | } |
|
1475 | } | |
1476 | ] |
|
1476 | ] | |
1477 |
|
1477 | |||
1478 | $ hg version --config extensions.strip= -Tjson |
|
1478 | $ hg version --config extensions.strip= -Tjson | |
1479 | [ |
|
1479 | [ | |
1480 | { |
|
1480 | { | |
1481 | "extensions": [{"bundled": true, "name": "strip", "ver": null}], |
|
1481 | "extensions": [{"bundled": true, "name": "strip", "ver": null}], | |
1482 | "ver": "*" (glob) |
|
1482 | "ver": "*" (glob) | |
1483 | } |
|
1483 | } | |
1484 | ] |
|
1484 | ] | |
1485 |
|
1485 | |||
1486 | Test template output of version: |
|
1486 | Test template output of version: | |
1487 |
|
1487 | |||
1488 | $ hg version --config extensions.throw=throw.py --config extensions.strip= \ |
|
1488 | $ hg version --config extensions.throw=throw.py --config extensions.strip= \ | |
1489 | > -T'{extensions % "{name} {pad(ver, 16)} ({if(bundled, "internal", "external")})\n"}' |
|
1489 | > -T'{extensions % "{name} {pad(ver, 16)} ({if(bundled, "internal", "external")})\n"}' | |
1490 | throw 1.twentythree (external) |
|
1490 | throw 1.twentythree (external) | |
1491 | strip (internal) |
|
1491 | strip (internal) | |
1492 |
|
1492 | |||
1493 | Refuse to load extensions with minimum version requirements |
|
1493 | Refuse to load extensions with minimum version requirements | |
1494 |
|
1494 | |||
1495 | $ cat > minversion1.py << EOF |
|
1495 | $ cat > minversion1.py << EOF | |
1496 | > from mercurial import util |
|
1496 | > from mercurial import util | |
1497 | > util.version = lambda: b'3.5.2' |
|
1497 | > util.version = lambda: b'3.5.2' | |
1498 | > minimumhgversion = b'3.6' |
|
1498 | > minimumhgversion = b'3.6' | |
1499 | > EOF |
|
1499 | > EOF | |
1500 | $ hg --config extensions.minversion=minversion1.py version |
|
1500 | $ hg --config extensions.minversion=minversion1.py version | |
1501 | (third party extension minversion requires version 3.6 or newer of Mercurial; disabling) |
|
1501 | (third party extension minversion requires version 3.6 or newer of Mercurial; disabling) | |
1502 | Mercurial Distributed SCM (version 3.5.2) |
|
1502 | Mercurial Distributed SCM (version 3.5.2) | |
1503 | (see https://mercurial-scm.org for more information) |
|
1503 | (see https://mercurial-scm.org for more information) | |
1504 |
|
1504 | |||
1505 | Copyright (C) 2005-* Matt Mackall and others (glob) |
|
1505 | Copyright (C) 2005-* Matt Mackall and others (glob) | |
1506 | This is free software; see the source for copying conditions. There is NO |
|
1506 | This is free software; see the source for copying conditions. There is NO | |
1507 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1507 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
1508 |
|
1508 | |||
1509 | $ cat > minversion2.py << EOF |
|
1509 | $ cat > minversion2.py << EOF | |
1510 | > from mercurial import util |
|
1510 | > from mercurial import util | |
1511 | > util.version = lambda: b'3.6' |
|
1511 | > util.version = lambda: b'3.6' | |
1512 | > minimumhgversion = b'3.7' |
|
1512 | > minimumhgversion = b'3.7' | |
1513 | > EOF |
|
1513 | > EOF | |
1514 | $ hg --config extensions.minversion=minversion2.py version 2>&1 | egrep '\(third' |
|
1514 | $ hg --config extensions.minversion=minversion2.py version 2>&1 | egrep '\(third' | |
1515 | (third party extension minversion requires version 3.7 or newer of Mercurial; disabling) |
|
1515 | (third party extension minversion requires version 3.7 or newer of Mercurial; disabling) | |
1516 |
|
1516 | |||
1517 | Can load version that is only off by point release |
|
1517 | Can load version that is only off by point release | |
1518 |
|
1518 | |||
1519 | $ cat > minversion2.py << EOF |
|
1519 | $ cat > minversion2.py << EOF | |
1520 | > from mercurial import util |
|
1520 | > from mercurial import util | |
1521 | > util.version = lambda: b'3.6.1' |
|
1521 | > util.version = lambda: b'3.6.1' | |
1522 | > minimumhgversion = b'3.6' |
|
1522 | > minimumhgversion = b'3.6' | |
1523 | > EOF |
|
1523 | > EOF | |
1524 | $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third' |
|
1524 | $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third' | |
1525 | [1] |
|
1525 | [1] | |
1526 |
|
1526 | |||
1527 | Can load minimum version identical to current |
|
1527 | Can load minimum version identical to current | |
1528 |
|
1528 | |||
1529 | $ cat > minversion3.py << EOF |
|
1529 | $ cat > minversion3.py << EOF | |
1530 | > from mercurial import util |
|
1530 | > from mercurial import util | |
1531 | > util.version = lambda: b'3.5' |
|
1531 | > util.version = lambda: b'3.5' | |
1532 | > minimumhgversion = b'3.5' |
|
1532 | > minimumhgversion = b'3.5' | |
1533 | > EOF |
|
1533 | > EOF | |
1534 | $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third' |
|
1534 | $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third' | |
1535 | [1] |
|
1535 | [1] | |
1536 |
|
1536 | |||
1537 | Restore HGRCPATH |
|
1537 | Restore HGRCPATH | |
1538 |
|
1538 | |||
1539 | $ HGRCPATH=$ORGHGRCPATH |
|
1539 | $ HGRCPATH=$ORGHGRCPATH | |
1540 | $ export HGRCPATH |
|
1540 | $ export HGRCPATH | |
1541 |
|
1541 | |||
1542 | Commands handling multiple repositories at a time should invoke only |
|
1542 | Commands handling multiple repositories at a time should invoke only | |
1543 | "reposetup()" of extensions enabling in the target repository. |
|
1543 | "reposetup()" of extensions enabling in the target repository. | |
1544 |
|
1544 | |||
1545 | $ mkdir reposetup-test |
|
1545 | $ mkdir reposetup-test | |
1546 | $ cd reposetup-test |
|
1546 | $ cd reposetup-test | |
1547 |
|
1547 | |||
1548 | $ cat > $TESTTMP/reposetuptest.py <<EOF |
|
1548 | $ cat > $TESTTMP/reposetuptest.py <<EOF | |
1549 | > from mercurial import extensions |
|
1549 | > from mercurial import extensions | |
1550 | > def reposetup(ui, repo): |
|
1550 | > def reposetup(ui, repo): | |
1551 | > ui.write(b'reposetup() for %s\n' % (repo.root)) |
|
1551 | > ui.write(b'reposetup() for %s\n' % (repo.root)) | |
1552 | > ui.flush() |
|
1552 | > ui.flush() | |
1553 | > EOF |
|
1553 | > EOF | |
1554 | $ hg init src |
|
1554 | $ hg init src | |
1555 | $ echo a > src/a |
|
1555 | $ echo a > src/a | |
1556 | $ hg -R src commit -Am '#0 at src/a' |
|
1556 | $ hg -R src commit -Am '#0 at src/a' | |
1557 | adding a |
|
1557 | adding a | |
1558 | $ echo '[extensions]' >> src/.hg/hgrc |
|
1558 | $ echo '[extensions]' >> src/.hg/hgrc | |
1559 | $ echo '# enable extension locally' >> src/.hg/hgrc |
|
1559 | $ echo '# enable extension locally' >> src/.hg/hgrc | |
1560 | $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc |
|
1560 | $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc | |
1561 | $ hg -R src status |
|
1561 | $ hg -R src status | |
1562 | reposetup() for $TESTTMP/reposetup-test/src |
|
1562 | reposetup() for $TESTTMP/reposetup-test/src | |
1563 | reposetup() for $TESTTMP/reposetup-test/src (chg !) |
|
1563 | reposetup() for $TESTTMP/reposetup-test/src (chg !) | |
1564 |
|
1564 | |||
1565 | #if no-extraextensions |
|
1565 | #if no-extraextensions | |
1566 | $ hg --cwd src debugextensions |
|
1566 | $ hg --cwd src debugextensions | |
1567 | reposetup() for $TESTTMP/reposetup-test/src |
|
1567 | reposetup() for $TESTTMP/reposetup-test/src | |
1568 | dodo (untested!) |
|
1568 | dodo (untested!) | |
1569 | dudu (untested!) |
|
1569 | dudu (untested!) | |
1570 | mq |
|
1570 | mq | |
1571 | reposetuptest (untested!) |
|
1571 | reposetuptest (untested!) | |
1572 | strip |
|
1572 | strip | |
1573 | #endif |
|
1573 | #endif | |
1574 |
|
1574 | |||
1575 | $ hg clone -U src clone-dst1 |
|
1575 | $ hg clone -U src clone-dst1 | |
1576 | reposetup() for $TESTTMP/reposetup-test/src |
|
1576 | reposetup() for $TESTTMP/reposetup-test/src | |
1577 | $ hg init push-dst1 |
|
1577 | $ hg init push-dst1 | |
1578 | $ hg -q -R src push push-dst1 |
|
1578 | $ hg -q -R src push push-dst1 | |
1579 | reposetup() for $TESTTMP/reposetup-test/src |
|
1579 | reposetup() for $TESTTMP/reposetup-test/src | |
1580 | $ hg init pull-src1 |
|
1580 | $ hg init pull-src1 | |
1581 | $ hg -q -R pull-src1 pull src |
|
1581 | $ hg -q -R pull-src1 pull src | |
1582 | reposetup() for $TESTTMP/reposetup-test/src |
|
1582 | reposetup() for $TESTTMP/reposetup-test/src | |
1583 |
|
1583 | |||
1584 | $ cat <<EOF >> $HGRCPATH |
|
1584 | $ cat <<EOF >> $HGRCPATH | |
1585 | > [extensions] |
|
1585 | > [extensions] | |
1586 | > # disable extension globally and explicitly |
|
1586 | > # disable extension globally and explicitly | |
1587 | > reposetuptest = ! |
|
1587 | > reposetuptest = ! | |
1588 | > EOF |
|
1588 | > EOF | |
1589 | $ hg clone -U src clone-dst2 |
|
1589 | $ hg clone -U src clone-dst2 | |
1590 | reposetup() for $TESTTMP/reposetup-test/src |
|
1590 | reposetup() for $TESTTMP/reposetup-test/src | |
1591 | $ hg init push-dst2 |
|
1591 | $ hg init push-dst2 | |
1592 | $ hg -q -R src push push-dst2 |
|
1592 | $ hg -q -R src push push-dst2 | |
1593 | reposetup() for $TESTTMP/reposetup-test/src |
|
1593 | reposetup() for $TESTTMP/reposetup-test/src | |
1594 | $ hg init pull-src2 |
|
1594 | $ hg init pull-src2 | |
1595 | $ hg -q -R pull-src2 pull src |
|
1595 | $ hg -q -R pull-src2 pull src | |
1596 | reposetup() for $TESTTMP/reposetup-test/src |
|
1596 | reposetup() for $TESTTMP/reposetup-test/src | |
1597 |
|
1597 | |||
1598 | $ cat <<EOF >> $HGRCPATH |
|
1598 | $ cat <<EOF >> $HGRCPATH | |
1599 | > [extensions] |
|
1599 | > [extensions] | |
1600 | > # enable extension globally |
|
1600 | > # enable extension globally | |
1601 | > reposetuptest = $TESTTMP/reposetuptest.py |
|
1601 | > reposetuptest = $TESTTMP/reposetuptest.py | |
1602 | > EOF |
|
1602 | > EOF | |
1603 | $ hg clone -U src clone-dst3 |
|
1603 | $ hg clone -U src clone-dst3 | |
1604 | reposetup() for $TESTTMP/reposetup-test/src |
|
1604 | reposetup() for $TESTTMP/reposetup-test/src | |
1605 | reposetup() for $TESTTMP/reposetup-test/clone-dst3 |
|
1605 | reposetup() for $TESTTMP/reposetup-test/clone-dst3 | |
1606 | $ hg init push-dst3 |
|
1606 | $ hg init push-dst3 | |
1607 | reposetup() for $TESTTMP/reposetup-test/push-dst3 |
|
1607 | reposetup() for $TESTTMP/reposetup-test/push-dst3 | |
1608 | $ hg -q -R src push push-dst3 |
|
1608 | $ hg -q -R src push push-dst3 | |
1609 | reposetup() for $TESTTMP/reposetup-test/src |
|
1609 | reposetup() for $TESTTMP/reposetup-test/src | |
1610 | reposetup() for $TESTTMP/reposetup-test/push-dst3 |
|
1610 | reposetup() for $TESTTMP/reposetup-test/push-dst3 | |
1611 | $ hg init pull-src3 |
|
1611 | $ hg init pull-src3 | |
1612 | reposetup() for $TESTTMP/reposetup-test/pull-src3 |
|
1612 | reposetup() for $TESTTMP/reposetup-test/pull-src3 | |
1613 | $ hg -q -R pull-src3 pull src |
|
1613 | $ hg -q -R pull-src3 pull src | |
1614 | reposetup() for $TESTTMP/reposetup-test/pull-src3 |
|
1614 | reposetup() for $TESTTMP/reposetup-test/pull-src3 | |
1615 | reposetup() for $TESTTMP/reposetup-test/src |
|
1615 | reposetup() for $TESTTMP/reposetup-test/src | |
1616 |
|
1616 | |||
1617 | $ echo '[extensions]' >> src/.hg/hgrc |
|
1617 | $ echo '[extensions]' >> src/.hg/hgrc | |
1618 | $ echo '# disable extension locally' >> src/.hg/hgrc |
|
1618 | $ echo '# disable extension locally' >> src/.hg/hgrc | |
1619 | $ echo 'reposetuptest = !' >> src/.hg/hgrc |
|
1619 | $ echo 'reposetuptest = !' >> src/.hg/hgrc | |
1620 | $ hg clone -U src clone-dst4 |
|
1620 | $ hg clone -U src clone-dst4 | |
1621 | reposetup() for $TESTTMP/reposetup-test/clone-dst4 |
|
1621 | reposetup() for $TESTTMP/reposetup-test/clone-dst4 | |
1622 | $ hg init push-dst4 |
|
1622 | $ hg init push-dst4 | |
1623 | reposetup() for $TESTTMP/reposetup-test/push-dst4 |
|
1623 | reposetup() for $TESTTMP/reposetup-test/push-dst4 | |
1624 | $ hg -q -R src push push-dst4 |
|
1624 | $ hg -q -R src push push-dst4 | |
1625 | reposetup() for $TESTTMP/reposetup-test/push-dst4 |
|
1625 | reposetup() for $TESTTMP/reposetup-test/push-dst4 | |
1626 | $ hg init pull-src4 |
|
1626 | $ hg init pull-src4 | |
1627 | reposetup() for $TESTTMP/reposetup-test/pull-src4 |
|
1627 | reposetup() for $TESTTMP/reposetup-test/pull-src4 | |
1628 | $ hg -q -R pull-src4 pull src |
|
1628 | $ hg -q -R pull-src4 pull src | |
1629 | reposetup() for $TESTTMP/reposetup-test/pull-src4 |
|
1629 | reposetup() for $TESTTMP/reposetup-test/pull-src4 | |
1630 |
|
1630 | |||
1631 | disabling in command line overlays with all configuration |
|
1631 | disabling in command line overlays with all configuration | |
1632 | $ hg --config extensions.reposetuptest=! clone -U src clone-dst5 |
|
1632 | $ hg --config extensions.reposetuptest=! clone -U src clone-dst5 | |
1633 | $ hg --config extensions.reposetuptest=! init push-dst5 |
|
1633 | $ hg --config extensions.reposetuptest=! init push-dst5 | |
1634 | $ hg --config extensions.reposetuptest=! -q -R src push push-dst5 |
|
1634 | $ hg --config extensions.reposetuptest=! -q -R src push push-dst5 | |
1635 | $ hg --config extensions.reposetuptest=! init pull-src5 |
|
1635 | $ hg --config extensions.reposetuptest=! init pull-src5 | |
1636 | $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src |
|
1636 | $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src | |
1637 |
|
1637 | |||
1638 | $ cat <<EOF >> $HGRCPATH |
|
1638 | $ cat <<EOF >> $HGRCPATH | |
1639 | > [extensions] |
|
1639 | > [extensions] | |
1640 | > # disable extension globally and explicitly |
|
1640 | > # disable extension globally and explicitly | |
1641 | > reposetuptest = ! |
|
1641 | > reposetuptest = ! | |
1642 | > EOF |
|
1642 | > EOF | |
1643 | $ hg init parent |
|
1643 | $ hg init parent | |
1644 | $ hg init parent/sub1 |
|
1644 | $ hg init parent/sub1 | |
1645 | $ echo 1 > parent/sub1/1 |
|
1645 | $ echo 1 > parent/sub1/1 | |
1646 | $ hg -R parent/sub1 commit -Am '#0 at parent/sub1' |
|
1646 | $ hg -R parent/sub1 commit -Am '#0 at parent/sub1' | |
1647 | adding 1 |
|
1647 | adding 1 | |
1648 | $ hg init parent/sub2 |
|
1648 | $ hg init parent/sub2 | |
1649 | $ hg init parent/sub2/sub21 |
|
1649 | $ hg init parent/sub2/sub21 | |
1650 | $ echo 21 > parent/sub2/sub21/21 |
|
1650 | $ echo 21 > parent/sub2/sub21/21 | |
1651 | $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21' |
|
1651 | $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21' | |
1652 | adding 21 |
|
1652 | adding 21 | |
1653 | $ cat > parent/sub2/.hgsub <<EOF |
|
1653 | $ cat > parent/sub2/.hgsub <<EOF | |
1654 | > sub21 = sub21 |
|
1654 | > sub21 = sub21 | |
1655 | > EOF |
|
1655 | > EOF | |
1656 | $ hg -R parent/sub2 commit -Am '#0 at parent/sub2' |
|
1656 | $ hg -R parent/sub2 commit -Am '#0 at parent/sub2' | |
1657 | adding .hgsub |
|
1657 | adding .hgsub | |
1658 | $ hg init parent/sub3 |
|
1658 | $ hg init parent/sub3 | |
1659 | $ echo 3 > parent/sub3/3 |
|
1659 | $ echo 3 > parent/sub3/3 | |
1660 | $ hg -R parent/sub3 commit -Am '#0 at parent/sub3' |
|
1660 | $ hg -R parent/sub3 commit -Am '#0 at parent/sub3' | |
1661 | adding 3 |
|
1661 | adding 3 | |
1662 | $ cat > parent/.hgsub <<EOF |
|
1662 | $ cat > parent/.hgsub <<EOF | |
1663 | > sub1 = sub1 |
|
1663 | > sub1 = sub1 | |
1664 | > sub2 = sub2 |
|
1664 | > sub2 = sub2 | |
1665 | > sub3 = sub3 |
|
1665 | > sub3 = sub3 | |
1666 | > EOF |
|
1666 | > EOF | |
1667 | $ hg -R parent commit -Am '#0 at parent' |
|
1667 | $ hg -R parent commit -Am '#0 at parent' | |
1668 | adding .hgsub |
|
1668 | adding .hgsub | |
1669 | $ echo '[extensions]' >> parent/.hg/hgrc |
|
1669 | $ echo '[extensions]' >> parent/.hg/hgrc | |
1670 | $ echo '# enable extension locally' >> parent/.hg/hgrc |
|
1670 | $ echo '# enable extension locally' >> parent/.hg/hgrc | |
1671 | $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc |
|
1671 | $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc | |
1672 | $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc |
|
1672 | $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc | |
1673 | $ hg -R parent status -S -A |
|
1673 | $ hg -R parent status -S -A | |
1674 | reposetup() for $TESTTMP/reposetup-test/parent |
|
1674 | reposetup() for $TESTTMP/reposetup-test/parent | |
1675 | reposetup() for $TESTTMP/reposetup-test/parent/sub2 |
|
1675 | reposetup() for $TESTTMP/reposetup-test/parent/sub2 | |
1676 | C .hgsub |
|
1676 | C .hgsub | |
1677 | C .hgsubstate |
|
1677 | C .hgsubstate | |
1678 | C sub1/1 |
|
1678 | C sub1/1 | |
1679 | C sub2/.hgsub |
|
1679 | C sub2/.hgsub | |
1680 | C sub2/.hgsubstate |
|
1680 | C sub2/.hgsubstate | |
1681 | C sub2/sub21/21 |
|
1681 | C sub2/sub21/21 | |
1682 | C sub3/3 |
|
1682 | C sub3/3 | |
1683 |
|
1683 | |||
1684 | $ cd .. |
|
1684 | $ cd .. | |
1685 |
|
1685 | |||
1686 | Prohibit registration of commands that don't use @command (issue5137) |
|
1686 | Prohibit registration of commands that don't use @command (issue5137) | |
1687 |
|
1687 | |||
1688 | $ hg init deprecated |
|
1688 | $ hg init deprecated | |
1689 | $ cd deprecated |
|
1689 | $ cd deprecated | |
1690 |
|
1690 | |||
1691 | $ cat <<EOF > deprecatedcmd.py |
|
1691 | $ cat <<EOF > deprecatedcmd.py | |
1692 | > def deprecatedcmd(repo, ui): |
|
1692 | > def deprecatedcmd(repo, ui): | |
1693 | > pass |
|
1693 | > pass | |
1694 | > cmdtable = { |
|
1694 | > cmdtable = { | |
1695 | > b'deprecatedcmd': (deprecatedcmd, [], b''), |
|
1695 | > b'deprecatedcmd': (deprecatedcmd, [], b''), | |
1696 | > } |
|
1696 | > } | |
1697 | > EOF |
|
1697 | > EOF | |
1698 | $ cat <<EOF > .hg/hgrc |
|
1698 | $ cat <<EOF > .hg/hgrc | |
1699 | > [extensions] |
|
1699 | > [extensions] | |
1700 | > deprecatedcmd = `pwd`/deprecatedcmd.py |
|
1700 | > deprecatedcmd = `pwd`/deprecatedcmd.py | |
1701 | > mq = ! |
|
1701 | > mq = ! | |
1702 | > hgext.mq = ! |
|
1702 | > hgext.mq = ! | |
1703 | > hgext/mq = ! |
|
1703 | > hgext/mq = ! | |
1704 | > EOF |
|
1704 | > EOF | |
1705 |
|
1705 | |||
1706 | $ hg deprecatedcmd > /dev/null |
|
1706 | $ hg deprecatedcmd > /dev/null | |
1707 | *** failed to import extension deprecatedcmd from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo |
|
1707 | *** failed to import extension deprecatedcmd from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo | |
1708 | *** (use @command decorator to register 'deprecatedcmd') |
|
1708 | *** (use @command decorator to register 'deprecatedcmd') | |
1709 | hg: unknown command 'deprecatedcmd' |
|
1709 | hg: unknown command 'deprecatedcmd' | |
1710 | (use 'hg help' for a list of commands) |
|
1710 | (use 'hg help' for a list of commands) | |
1711 | [255] |
|
1711 | [255] | |
1712 |
|
1712 | |||
1713 | the extension shouldn't be loaded at all so the mq works: |
|
1713 | the extension shouldn't be loaded at all so the mq works: | |
1714 |
|
1714 | |||
1715 | $ hg qseries --config extensions.mq= > /dev/null |
|
1715 | $ hg qseries --config extensions.mq= > /dev/null | |
1716 | *** failed to import extension deprecatedcmd from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo |
|
1716 | *** failed to import extension deprecatedcmd from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo | |
1717 | *** (use @command decorator to register 'deprecatedcmd') |
|
1717 | *** (use @command decorator to register 'deprecatedcmd') | |
1718 |
|
1718 | |||
1719 | $ cd .. |
|
1719 | $ cd .. | |
1720 |
|
1720 | |||
1721 | Test synopsis and docstring extending |
|
1721 | Test synopsis and docstring extending | |
1722 |
|
1722 | |||
1723 | $ hg init exthelp |
|
1723 | $ hg init exthelp | |
1724 | $ cat > exthelp.py <<EOF |
|
1724 | $ cat > exthelp.py <<EOF | |
1725 | > from mercurial import commands, extensions |
|
1725 | > from mercurial import commands, extensions | |
1726 | > def exbookmarks(orig, *args, **opts): |
|
1726 | > def exbookmarks(orig, *args, **opts): | |
1727 | > return orig(*args, **opts) |
|
1727 | > return orig(*args, **opts) | |
1728 | > def uisetup(ui): |
|
1728 | > def uisetup(ui): | |
1729 | > synopsis = b' GREPME [--foo] [-x]' |
|
1729 | > synopsis = b' GREPME [--foo] [-x]' | |
1730 | > docstring = ''' |
|
1730 | > docstring = ''' | |
1731 | > GREPME make sure that this is in the help! |
|
1731 | > GREPME make sure that this is in the help! | |
1732 | > ''' |
|
1732 | > ''' | |
1733 | > extensions.wrapcommand(commands.table, b'bookmarks', exbookmarks, |
|
1733 | > extensions.wrapcommand(commands.table, b'bookmarks', exbookmarks, | |
1734 | > synopsis, docstring) |
|
1734 | > synopsis, docstring) | |
1735 | > EOF |
|
1735 | > EOF | |
1736 | $ abspath=`pwd`/exthelp.py |
|
1736 | $ abspath=`pwd`/exthelp.py | |
1737 | $ echo '[extensions]' >> $HGRCPATH |
|
1737 | $ echo '[extensions]' >> $HGRCPATH | |
1738 | $ echo "exthelp = $abspath" >> $HGRCPATH |
|
1738 | $ echo "exthelp = $abspath" >> $HGRCPATH | |
1739 | $ cd exthelp |
|
1739 | $ cd exthelp | |
1740 | $ hg help bookmarks | grep GREPME |
|
1740 | $ hg help bookmarks | grep GREPME | |
1741 | hg bookmarks [OPTIONS]... [NAME]... GREPME [--foo] [-x] |
|
1741 | hg bookmarks [OPTIONS]... [NAME]... GREPME [--foo] [-x] | |
1742 | GREPME make sure that this is in the help! |
|
1742 | GREPME make sure that this is in the help! | |
1743 | $ cd .. |
|
1743 | $ cd .. | |
1744 |
|
1744 | |||
1745 | Show deprecation warning for the use of cmdutil.command |
|
1745 | Show deprecation warning for the use of cmdutil.command | |
1746 |
|
1746 | |||
1747 | $ cat > nonregistrar.py <<EOF |
|
1747 | $ cat > nonregistrar.py <<EOF | |
1748 | > from mercurial import cmdutil |
|
1748 | > from mercurial import cmdutil | |
1749 | > cmdtable = {} |
|
1749 | > cmdtable = {} | |
1750 | > command = cmdutil.command(cmdtable) |
|
1750 | > command = cmdutil.command(cmdtable) | |
1751 | > @command(b'foo', [], norepo=True) |
|
1751 | > @command(b'foo', [], norepo=True) | |
1752 | > def foo(ui): |
|
1752 | > def foo(ui): | |
1753 | > pass |
|
1753 | > pass | |
1754 | > EOF |
|
1754 | > EOF | |
1755 |
|
1755 | |||
1756 | Prohibit the use of unicode strings as the default value of options |
|
1756 | Prohibit the use of unicode strings as the default value of options | |
1757 |
|
1757 | |||
1758 | $ hg init $TESTTMP/opt-unicode-default |
|
1758 | $ hg init $TESTTMP/opt-unicode-default | |
1759 |
|
1759 | |||
1760 | $ cat > $TESTTMP/test_unicode_default_value.py << EOF |
|
1760 | $ cat > $TESTTMP/test_unicode_default_value.py << EOF | |
1761 | > from __future__ import print_function |
|
1761 | > from __future__ import print_function | |
1762 | > from mercurial import registrar |
|
1762 | > from mercurial import registrar | |
1763 | > cmdtable = {} |
|
1763 | > cmdtable = {} | |
1764 | > command = registrar.command(cmdtable) |
|
1764 | > command = registrar.command(cmdtable) | |
1765 | > @command(b'dummy', [(b'', b'opt', u'value', u'help')], 'ext [OPTIONS]') |
|
1765 | > @command(b'dummy', [(b'', b'opt', u'value', u'help')], 'ext [OPTIONS]') | |
1766 | > def ext(*args, **opts): |
|
1766 | > def ext(*args, **opts): | |
1767 | > print(opts[b'opt'], flush=True) |
|
1767 | > print(opts[b'opt'], flush=True) | |
1768 | > EOF |
|
1768 | > EOF | |
1769 | $ $PYTHON $TESTTMP/unflush.py $TESTTMP/test_unicode_default_value.py |
|
1769 | $ $PYTHON $TESTTMP/unflush.py $TESTTMP/test_unicode_default_value.py | |
1770 | $ cat > $TESTTMP/opt-unicode-default/.hg/hgrc << EOF |
|
1770 | $ cat > $TESTTMP/opt-unicode-default/.hg/hgrc << EOF | |
1771 | > [extensions] |
|
1771 | > [extensions] | |
1772 | > test_unicode_default_value = $TESTTMP/test_unicode_default_value.py |
|
1772 | > test_unicode_default_value = $TESTTMP/test_unicode_default_value.py | |
1773 | > EOF |
|
1773 | > EOF | |
1774 | $ hg -R $TESTTMP/opt-unicode-default dummy |
|
1774 | $ hg -R $TESTTMP/opt-unicode-default dummy | |
1775 | *** failed to import extension test_unicode_default_value from $TESTTMP/test_unicode_default_value.py: unicode *'value' found in cmdtable.dummy (glob) |
|
1775 | *** failed to import extension test_unicode_default_value from $TESTTMP/test_unicode_default_value.py: unicode *'value' found in cmdtable.dummy (glob) | |
1776 | *** (use b'' to make it byte string) |
|
1776 | *** (use b'' to make it byte string) | |
1777 | hg: unknown command 'dummy' |
|
1777 | hg: unknown command 'dummy' | |
1778 | (did you mean summary?) |
|
1778 | (did you mean summary?) | |
1779 | [255] |
|
1779 | [255] |
@@ -1,44 +1,44 b'' | |||||
1 | $ . "$TESTDIR/helpers-testrepo.sh" |
|
1 | $ . "$TESTDIR/helpers-testrepo.sh" | |
2 |
|
2 | |||
3 | Testing that hghave does not crash when checking features |
|
3 | Testing that hghave does not crash when checking features | |
4 |
|
4 | |||
5 | $ hghave --test-features 2>/dev/null |
|
5 | $ hghave --test-features 2>/dev/null | |
6 |
|
6 | |||
7 | Testing hghave extensibility for third party tools |
|
7 | Testing hghave extensibility for third party tools | |
8 |
|
8 | |||
9 | $ cat > hghaveaddon.py <<EOF |
|
9 | $ cat > hghaveaddon.py <<EOF | |
10 | > import hghave |
|
10 | > import hghave | |
11 | > @hghave.check("custom", "custom hghave feature") |
|
11 | > @hghave.check("custom", "custom hghave feature") | |
12 | > def has_custom(): |
|
12 | > def has_custom(): | |
13 | > return True |
|
13 | > return True | |
14 | > EOF |
|
14 | > EOF | |
15 |
|
15 | |||
16 | (invocation via run-tests.py) |
|
16 | (invocation via run-tests.py) | |
17 |
|
17 | |||
18 | $ cat > test-hghaveaddon.t <<EOF |
|
18 | $ cat > test-hghaveaddon.t <<EOF | |
19 | > #require custom |
|
19 | > #require custom | |
20 | > $ echo foo |
|
20 | > $ echo foo | |
21 | > foo |
|
21 | > foo | |
22 | > EOF |
|
22 | > EOF | |
23 | $ ( \ |
|
23 | $ ( \ | |
24 | > testrepohgenv; \ |
|
24 | > testrepohgenv; \ | |
25 | > "$PYTHON" $TESTDIR/run-tests.py $HGTEST_RUN_TESTS_PURE test-hghaveaddon.t \ |
|
25 | > "$PYTHON" $TESTDIR/run-tests.py $HGTEST_RUN_TESTS_PURE test-hghaveaddon.t \ | |
26 | > ) |
|
26 | > ) | |
27 | . |
|
27 | . | |
28 | # Ran 1 tests, 0 skipped, 0 failed. |
|
28 | # Ran 1 tests, 0 skipped, 0 failed. | |
29 |
|
29 | |||
30 | (invocation via command line) |
|
30 | (invocation via command line) | |
31 |
|
31 | |||
32 | $ unset TESTDIR |
|
32 | $ unset TESTDIR | |
33 | $ hghave custom |
|
33 | $ hghave custom | |
34 |
|
34 | |||
35 | (terminate with exit code 2 at failure of importing hghaveaddon.py) |
|
35 | (terminate with exit code 2 at failure of importing hghaveaddon.py) | |
36 |
|
36 | |||
37 | $ rm hghaveaddon.* |
|
37 | $ rm hghaveaddon.* | |
38 | $ cat > hghaveaddon.py <<EOF |
|
38 | $ cat > hghaveaddon.py <<NO_CHECK_EOF | |
39 | > importing this file should cause syntax error |
|
39 | > importing this file should cause syntax error | |
40 | > EOF |
|
40 | > NO_CHECK_EOF | |
41 |
|
41 | |||
42 | $ hghave custom |
|
42 | $ hghave custom | |
43 | failed to import hghaveaddon.py from '.': invalid syntax (hghaveaddon.py, line 1) |
|
43 | failed to import hghaveaddon.py from '.': invalid syntax (hghaveaddon.py, line 1) | |
44 | [2] |
|
44 | [2] |
@@ -1,943 +1,943 b'' | |||||
1 | commit hooks can see env vars |
|
1 | commit hooks can see env vars | |
2 | (and post-transaction one are run unlocked) |
|
2 | (and post-transaction one are run unlocked) | |
3 |
|
3 | |||
4 |
|
4 | |||
5 | $ cat > $TESTTMP/txnabort.checkargs.py <<EOF |
|
5 | $ cat > $TESTTMP/txnabort.checkargs.py <<EOF | |
6 | > from mercurial import pycompat |
|
6 | > from mercurial import pycompat | |
7 | > def showargs(ui, repo, hooktype, **kwargs): |
|
7 | > def showargs(ui, repo, hooktype, **kwargs): | |
8 | > kwargs = pycompat.byteskwargs(kwargs) |
|
8 | > kwargs = pycompat.byteskwargs(kwargs) | |
9 | > ui.write(b'%s Python hook: %s\n' % (hooktype, |
|
9 | > ui.write(b'%s Python hook: %s\n' % (hooktype, | |
10 | > b','.join(sorted(kwargs)))) |
|
10 | > b','.join(sorted(kwargs)))) | |
11 | > EOF |
|
11 | > EOF | |
12 |
|
12 | |||
13 | $ hg init a |
|
13 | $ hg init a | |
14 | $ cd a |
|
14 | $ cd a | |
15 | $ cat > .hg/hgrc <<EOF |
|
15 | $ cat > .hg/hgrc <<EOF | |
16 | > [hooks] |
|
16 | > [hooks] | |
17 | > commit = sh -c "HG_LOCAL= HG_TAG= printenv.py commit" |
|
17 | > commit = sh -c "HG_LOCAL= HG_TAG= printenv.py commit" | |
18 | > commit.b = sh -c "HG_LOCAL= HG_TAG= printenv.py commit.b" |
|
18 | > commit.b = sh -c "HG_LOCAL= HG_TAG= printenv.py commit.b" | |
19 | > precommit = sh -c "HG_LOCAL= HG_NODE= HG_TAG= printenv.py precommit" |
|
19 | > precommit = sh -c "HG_LOCAL= HG_NODE= HG_TAG= printenv.py precommit" | |
20 | > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxncommit" |
|
20 | > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxncommit" | |
21 | > pretxncommit.tip = hg -q tip |
|
21 | > pretxncommit.tip = hg -q tip | |
22 | > pre-identify = sh -c "printenv.py pre-identify 1" |
|
22 | > pre-identify = sh -c "printenv.py pre-identify 1" | |
23 | > pre-cat = sh -c "printenv.py pre-cat" |
|
23 | > pre-cat = sh -c "printenv.py pre-cat" | |
24 | > post-cat = sh -c "printenv.py post-cat" |
|
24 | > post-cat = sh -c "printenv.py post-cat" | |
25 | > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnopen" |
|
25 | > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnopen" | |
26 | > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnclose" |
|
26 | > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnclose" | |
27 | > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py txnclose" |
|
27 | > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py txnclose" | |
28 | > txnabort.0 = python:$TESTTMP/txnabort.checkargs.py:showargs |
|
28 | > txnabort.0 = python:$TESTTMP/txnabort.checkargs.py:showargs | |
29 | > txnabort.1 = sh -c "HG_LOCAL= HG_TAG= printenv.py txnabort" |
|
29 | > txnabort.1 = sh -c "HG_LOCAL= HG_TAG= printenv.py txnabort" | |
30 | > txnclose.checklock = sh -c "hg debuglock > /dev/null" |
|
30 | > txnclose.checklock = sh -c "hg debuglock > /dev/null" | |
31 | > EOF |
|
31 | > EOF | |
32 | $ echo a > a |
|
32 | $ echo a > a | |
33 | $ hg add a |
|
33 | $ hg add a | |
34 | $ hg commit -m a |
|
34 | $ hg commit -m a | |
35 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=0000000000000000000000000000000000000000 |
|
35 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=0000000000000000000000000000000000000000 | |
36 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
36 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
37 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a |
|
37 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a | |
38 | 0:cb9a9f314b8b |
|
38 | 0:cb9a9f314b8b | |
39 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
39 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
40 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
40 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
41 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 |
|
41 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 | |
42 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 |
|
42 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 | |
43 |
|
43 | |||
44 | $ hg clone . ../b |
|
44 | $ hg clone . ../b | |
45 | updating to branch default |
|
45 | updating to branch default | |
46 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
46 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
47 | $ cd ../b |
|
47 | $ cd ../b | |
48 |
|
48 | |||
49 | changegroup hooks can see env vars |
|
49 | changegroup hooks can see env vars | |
50 |
|
50 | |||
51 | $ cat > .hg/hgrc <<EOF |
|
51 | $ cat > .hg/hgrc <<EOF | |
52 | > [hooks] |
|
52 | > [hooks] | |
53 | > prechangegroup = sh -c "printenv.py prechangegroup" |
|
53 | > prechangegroup = sh -c "printenv.py prechangegroup" | |
54 | > changegroup = sh -c "printenv.py changegroup" |
|
54 | > changegroup = sh -c "printenv.py changegroup" | |
55 | > incoming = sh -c "printenv.py incoming" |
|
55 | > incoming = sh -c "printenv.py incoming" | |
56 | > EOF |
|
56 | > EOF | |
57 |
|
57 | |||
58 | pretxncommit and commit hooks can see both parents of merge |
|
58 | pretxncommit and commit hooks can see both parents of merge | |
59 |
|
59 | |||
60 | $ cd ../a |
|
60 | $ cd ../a | |
61 | $ echo b >> a |
|
61 | $ echo b >> a | |
62 | $ hg commit -m a1 -d "1 0" |
|
62 | $ hg commit -m a1 -d "1 0" | |
63 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
63 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
64 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
64 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
65 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a |
|
65 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a | |
66 | 1:ab228980c14d |
|
66 | 1:ab228980c14d | |
67 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
67 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
68 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
68 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
69 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
69 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
70 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
70 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
71 | $ hg update -C 0 |
|
71 | $ hg update -C 0 | |
72 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
72 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
73 | $ echo b > b |
|
73 | $ echo b > b | |
74 | $ hg add b |
|
74 | $ hg add b | |
75 | $ hg commit -m b -d '1 0' |
|
75 | $ hg commit -m b -d '1 0' | |
76 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
76 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
77 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
77 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
78 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a |
|
78 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a | |
79 | 2:ee9deb46ab31 |
|
79 | 2:ee9deb46ab31 | |
80 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
80 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
81 | created new head |
|
81 | created new head | |
82 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
82 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
83 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
83 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
84 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
84 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
85 | $ hg merge 1 |
|
85 | $ hg merge 1 | |
86 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
86 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
87 | (branch merge, don't forget to commit) |
|
87 | (branch merge, don't forget to commit) | |
88 | $ hg commit -m merge -d '2 0' |
|
88 | $ hg commit -m merge -d '2 0' | |
89 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd |
|
89 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd | |
90 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
90 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
91 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a |
|
91 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a | |
92 | 3:07f3376c1e65 |
|
92 | 3:07f3376c1e65 | |
93 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
93 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
94 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
94 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
95 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd |
|
95 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd | |
96 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd |
|
96 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd | |
97 |
|
97 | |||
98 | test generic hooks |
|
98 | test generic hooks | |
99 |
|
99 | |||
100 | $ hg id |
|
100 | $ hg id | |
101 | pre-identify hook: HG_ARGS=id HG_HOOKNAME=pre-identify HG_HOOKTYPE=pre-identify HG_OPTS={'bookmarks': None, 'branch': None, 'id': None, 'insecure': None, 'num': None, 'remotecmd': '', 'rev': '', 'ssh': '', 'tags': None, 'template': ''} HG_PATS=[] |
|
101 | pre-identify hook: HG_ARGS=id HG_HOOKNAME=pre-identify HG_HOOKTYPE=pre-identify HG_OPTS={'bookmarks': None, 'branch': None, 'id': None, 'insecure': None, 'num': None, 'remotecmd': '', 'rev': '', 'ssh': '', 'tags': None, 'template': ''} HG_PATS=[] | |
102 | abort: pre-identify hook exited with status 1 |
|
102 | abort: pre-identify hook exited with status 1 | |
103 | [255] |
|
103 | [255] | |
104 | $ hg cat b |
|
104 | $ hg cat b | |
105 | pre-cat hook: HG_ARGS=cat b HG_HOOKNAME=pre-cat HG_HOOKTYPE=pre-cat HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''} HG_PATS=['b'] |
|
105 | pre-cat hook: HG_ARGS=cat b HG_HOOKNAME=pre-cat HG_HOOKTYPE=pre-cat HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''} HG_PATS=['b'] | |
106 | b |
|
106 | b | |
107 | post-cat hook: HG_ARGS=cat b HG_HOOKNAME=post-cat HG_HOOKTYPE=post-cat HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''} HG_PATS=['b'] HG_RESULT=0 |
|
107 | post-cat hook: HG_ARGS=cat b HG_HOOKNAME=post-cat HG_HOOKTYPE=post-cat HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''} HG_PATS=['b'] HG_RESULT=0 | |
108 |
|
108 | |||
109 | $ cd ../b |
|
109 | $ cd ../b | |
110 | $ hg pull ../a |
|
110 | $ hg pull ../a | |
111 | pulling from ../a |
|
111 | pulling from ../a | |
112 | searching for changes |
|
112 | searching for changes | |
113 | prechangegroup hook: HG_HOOKNAME=prechangegroup HG_HOOKTYPE=prechangegroup HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a |
|
113 | prechangegroup hook: HG_HOOKNAME=prechangegroup HG_HOOKTYPE=prechangegroup HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a | |
114 | adding changesets |
|
114 | adding changesets | |
115 | adding manifests |
|
115 | adding manifests | |
116 | adding file changes |
|
116 | adding file changes | |
117 | added 3 changesets with 2 changes to 2 files |
|
117 | added 3 changesets with 2 changes to 2 files | |
118 | new changesets ab228980c14d:07f3376c1e65 |
|
118 | new changesets ab228980c14d:07f3376c1e65 | |
119 | changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_NODE_LAST=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a |
|
119 | changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_NODE_LAST=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a | |
120 | incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a |
|
120 | incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a | |
121 | incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a |
|
121 | incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a | |
122 | incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a |
|
122 | incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a | |
123 | (run 'hg update' to get a working copy) |
|
123 | (run 'hg update' to get a working copy) | |
124 |
|
124 | |||
125 | tag hooks can see env vars |
|
125 | tag hooks can see env vars | |
126 |
|
126 | |||
127 | $ cd ../a |
|
127 | $ cd ../a | |
128 | $ cat >> .hg/hgrc <<EOF |
|
128 | $ cat >> .hg/hgrc <<EOF | |
129 | > pretag = sh -c "printenv.py pretag" |
|
129 | > pretag = sh -c "printenv.py pretag" | |
130 | > tag = sh -c "HG_PARENT1= HG_PARENT2= printenv.py tag" |
|
130 | > tag = sh -c "HG_PARENT1= HG_PARENT2= printenv.py tag" | |
131 | > EOF |
|
131 | > EOF | |
132 | $ hg tag -d '3 0' a |
|
132 | $ hg tag -d '3 0' a | |
133 | pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a |
|
133 | pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a | |
134 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 |
|
134 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 | |
135 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
135 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
136 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a |
|
136 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a | |
137 | 4:539e4b31b6dc |
|
137 | 4:539e4b31b6dc | |
138 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
138 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
139 | tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a |
|
139 | tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a | |
140 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
140 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
141 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 |
|
141 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 | |
142 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 |
|
142 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 | |
143 | $ hg tag -l la |
|
143 | $ hg tag -l la | |
144 | pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la |
|
144 | pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la | |
145 | tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la |
|
145 | tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la | |
146 |
|
146 | |||
147 | pretag hook can forbid tagging |
|
147 | pretag hook can forbid tagging | |
148 |
|
148 | |||
149 | $ cat >> .hg/hgrc <<EOF |
|
149 | $ cat >> .hg/hgrc <<EOF | |
150 | > pretag.forbid = sh -c "printenv.py pretag.forbid 1" |
|
150 | > pretag.forbid = sh -c "printenv.py pretag.forbid 1" | |
151 | > EOF |
|
151 | > EOF | |
152 | $ hg tag -d '4 0' fa |
|
152 | $ hg tag -d '4 0' fa | |
153 | pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa |
|
153 | pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa | |
154 | pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa |
|
154 | pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa | |
155 | abort: pretag.forbid hook exited with status 1 |
|
155 | abort: pretag.forbid hook exited with status 1 | |
156 | [255] |
|
156 | [255] | |
157 | $ hg tag -l fla |
|
157 | $ hg tag -l fla | |
158 | pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla |
|
158 | pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla | |
159 | pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla |
|
159 | pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla | |
160 | abort: pretag.forbid hook exited with status 1 |
|
160 | abort: pretag.forbid hook exited with status 1 | |
161 | [255] |
|
161 | [255] | |
162 |
|
162 | |||
163 | pretxncommit hook can see changeset, can roll back txn, changeset no |
|
163 | pretxncommit hook can see changeset, can roll back txn, changeset no | |
164 | more there after |
|
164 | more there after | |
165 |
|
165 | |||
166 | $ cat >> .hg/hgrc <<EOF |
|
166 | $ cat >> .hg/hgrc <<EOF | |
167 | > pretxncommit.forbid0 = sh -c "hg tip -q" |
|
167 | > pretxncommit.forbid0 = sh -c "hg tip -q" | |
168 | > pretxncommit.forbid1 = sh -c "printenv.py pretxncommit.forbid 1" |
|
168 | > pretxncommit.forbid1 = sh -c "printenv.py pretxncommit.forbid 1" | |
169 | > EOF |
|
169 | > EOF | |
170 | $ echo z > z |
|
170 | $ echo z > z | |
171 | $ hg add z |
|
171 | $ hg add z | |
172 | $ hg -q tip |
|
172 | $ hg -q tip | |
173 | 4:539e4b31b6dc |
|
173 | 4:539e4b31b6dc | |
174 | $ hg commit -m 'fail' -d '4 0' |
|
174 | $ hg commit -m 'fail' -d '4 0' | |
175 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 |
|
175 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 | |
176 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
176 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
177 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a |
|
177 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a | |
178 | 5:6f611f8018c1 |
|
178 | 5:6f611f8018c1 | |
179 | 5:6f611f8018c1 |
|
179 | 5:6f611f8018c1 | |
180 | pretxncommit.forbid hook: HG_HOOKNAME=pretxncommit.forbid1 HG_HOOKTYPE=pretxncommit HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a |
|
180 | pretxncommit.forbid hook: HG_HOOKNAME=pretxncommit.forbid1 HG_HOOKTYPE=pretxncommit HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a | |
181 | transaction abort! |
|
181 | transaction abort! | |
182 | txnabort Python hook: txnid,txnname |
|
182 | txnabort Python hook: txnid,txnname | |
183 | txnabort hook: HG_HOOKNAME=txnabort.1 HG_HOOKTYPE=txnabort HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
183 | txnabort hook: HG_HOOKNAME=txnabort.1 HG_HOOKTYPE=txnabort HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
184 | rollback completed |
|
184 | rollback completed | |
185 | abort: pretxncommit.forbid1 hook exited with status 1 |
|
185 | abort: pretxncommit.forbid1 hook exited with status 1 | |
186 | [255] |
|
186 | [255] | |
187 | $ hg -q tip |
|
187 | $ hg -q tip | |
188 | 4:539e4b31b6dc |
|
188 | 4:539e4b31b6dc | |
189 |
|
189 | |||
190 | (Check that no 'changelog.i.a' file were left behind) |
|
190 | (Check that no 'changelog.i.a' file were left behind) | |
191 |
|
191 | |||
192 | $ ls -1 .hg/store/ |
|
192 | $ ls -1 .hg/store/ | |
193 | 00changelog.i |
|
193 | 00changelog.i | |
194 | 00manifest.i |
|
194 | 00manifest.i | |
195 | data |
|
195 | data | |
196 | fncache (repofncache !) |
|
196 | fncache (repofncache !) | |
197 | journal.phaseroots |
|
197 | journal.phaseroots | |
198 | phaseroots |
|
198 | phaseroots | |
199 | undo |
|
199 | undo | |
200 | undo.backup.fncache (repofncache !) |
|
200 | undo.backup.fncache (repofncache !) | |
201 | undo.backupfiles |
|
201 | undo.backupfiles | |
202 | undo.phaseroots |
|
202 | undo.phaseroots | |
203 |
|
203 | |||
204 |
|
204 | |||
205 | precommit hook can prevent commit |
|
205 | precommit hook can prevent commit | |
206 |
|
206 | |||
207 | $ cat >> .hg/hgrc <<EOF |
|
207 | $ cat >> .hg/hgrc <<EOF | |
208 | > precommit.forbid = sh -c "printenv.py precommit.forbid 1" |
|
208 | > precommit.forbid = sh -c "printenv.py precommit.forbid 1" | |
209 | > EOF |
|
209 | > EOF | |
210 | $ hg commit -m 'fail' -d '4 0' |
|
210 | $ hg commit -m 'fail' -d '4 0' | |
211 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 |
|
211 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 | |
212 | precommit.forbid hook: HG_HOOKNAME=precommit.forbid HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 |
|
212 | precommit.forbid hook: HG_HOOKNAME=precommit.forbid HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 | |
213 | abort: precommit.forbid hook exited with status 1 |
|
213 | abort: precommit.forbid hook exited with status 1 | |
214 | [255] |
|
214 | [255] | |
215 | $ hg -q tip |
|
215 | $ hg -q tip | |
216 | 4:539e4b31b6dc |
|
216 | 4:539e4b31b6dc | |
217 |
|
217 | |||
218 | preupdate hook can prevent update |
|
218 | preupdate hook can prevent update | |
219 |
|
219 | |||
220 | $ cat >> .hg/hgrc <<EOF |
|
220 | $ cat >> .hg/hgrc <<EOF | |
221 | > preupdate = sh -c "printenv.py preupdate" |
|
221 | > preupdate = sh -c "printenv.py preupdate" | |
222 | > EOF |
|
222 | > EOF | |
223 | $ hg update 1 |
|
223 | $ hg update 1 | |
224 | preupdate hook: HG_HOOKNAME=preupdate HG_HOOKTYPE=preupdate HG_PARENT1=ab228980c14d |
|
224 | preupdate hook: HG_HOOKNAME=preupdate HG_HOOKTYPE=preupdate HG_PARENT1=ab228980c14d | |
225 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
225 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
226 |
|
226 | |||
227 | update hook |
|
227 | update hook | |
228 |
|
228 | |||
229 | $ cat >> .hg/hgrc <<EOF |
|
229 | $ cat >> .hg/hgrc <<EOF | |
230 | > update = sh -c "printenv.py update" |
|
230 | > update = sh -c "printenv.py update" | |
231 | > EOF |
|
231 | > EOF | |
232 | $ hg update |
|
232 | $ hg update | |
233 | preupdate hook: HG_HOOKNAME=preupdate HG_HOOKTYPE=preupdate HG_PARENT1=539e4b31b6dc |
|
233 | preupdate hook: HG_HOOKNAME=preupdate HG_HOOKTYPE=preupdate HG_PARENT1=539e4b31b6dc | |
234 | update hook: HG_ERROR=0 HG_HOOKNAME=update HG_HOOKTYPE=update HG_PARENT1=539e4b31b6dc |
|
234 | update hook: HG_ERROR=0 HG_HOOKNAME=update HG_HOOKTYPE=update HG_PARENT1=539e4b31b6dc | |
235 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
235 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
236 |
|
236 | |||
237 | pushkey hook |
|
237 | pushkey hook | |
238 |
|
238 | |||
239 | $ cat >> .hg/hgrc <<EOF |
|
239 | $ cat >> .hg/hgrc <<EOF | |
240 | > pushkey = sh -c "printenv.py pushkey" |
|
240 | > pushkey = sh -c "printenv.py pushkey" | |
241 | > EOF |
|
241 | > EOF | |
242 | $ cd ../b |
|
242 | $ cd ../b | |
243 | $ hg bookmark -r null foo |
|
243 | $ hg bookmark -r null foo | |
244 | $ hg push -B foo ../a |
|
244 | $ hg push -B foo ../a | |
245 | pushing to ../a |
|
245 | pushing to ../a | |
246 | searching for changes |
|
246 | searching for changes | |
247 | no changes found |
|
247 | no changes found | |
248 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push |
|
248 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push | |
249 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a |
|
249 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a | |
250 | pushkey hook: HG_BUNDLE2=1 HG_HOOKNAME=pushkey HG_HOOKTYPE=pushkey HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_PUSHKEYCOMPAT=1 HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a |
|
250 | pushkey hook: HG_BUNDLE2=1 HG_HOOKNAME=pushkey HG_HOOKTYPE=pushkey HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_PUSHKEYCOMPAT=1 HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a | |
251 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a |
|
251 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a | |
252 | exporting bookmark foo |
|
252 | exporting bookmark foo | |
253 | [1] |
|
253 | [1] | |
254 | $ cd ../a |
|
254 | $ cd ../a | |
255 |
|
255 | |||
256 | listkeys hook |
|
256 | listkeys hook | |
257 |
|
257 | |||
258 | $ cat >> .hg/hgrc <<EOF |
|
258 | $ cat >> .hg/hgrc <<EOF | |
259 | > listkeys = sh -c "printenv.py listkeys" |
|
259 | > listkeys = sh -c "printenv.py listkeys" | |
260 | > EOF |
|
260 | > EOF | |
261 | $ hg bookmark -r null bar |
|
261 | $ hg bookmark -r null bar | |
262 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark |
|
262 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark | |
263 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark |
|
263 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark | |
264 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark |
|
264 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark | |
265 | $ cd ../b |
|
265 | $ cd ../b | |
266 | $ hg pull -B bar ../a |
|
266 | $ hg pull -B bar ../a | |
267 | pulling from ../a |
|
267 | pulling from ../a | |
268 | listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} |
|
268 | listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} | |
269 | no changes found |
|
269 | no changes found | |
270 | adding remote bookmark bar |
|
270 | adding remote bookmark bar | |
271 | $ cd ../a |
|
271 | $ cd ../a | |
272 |
|
272 | |||
273 | test that prepushkey can prevent incoming keys |
|
273 | test that prepushkey can prevent incoming keys | |
274 |
|
274 | |||
275 | $ cat >> .hg/hgrc <<EOF |
|
275 | $ cat >> .hg/hgrc <<EOF | |
276 | > prepushkey = sh -c "printenv.py prepushkey.forbid 1" |
|
276 | > prepushkey = sh -c "printenv.py prepushkey.forbid 1" | |
277 | > EOF |
|
277 | > EOF | |
278 | $ cd ../b |
|
278 | $ cd ../b | |
279 | $ hg bookmark -r null baz |
|
279 | $ hg bookmark -r null baz | |
280 | $ hg push -B baz ../a |
|
280 | $ hg push -B baz ../a | |
281 | pushing to ../a |
|
281 | pushing to ../a | |
282 | searching for changes |
|
282 | searching for changes | |
283 | listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'} |
|
283 | listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'} | |
284 | listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} |
|
284 | listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} | |
285 | no changes found |
|
285 | no changes found | |
286 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push |
|
286 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push | |
287 | prepushkey.forbid hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_PUSHKEYCOMPAT=1 HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a |
|
287 | prepushkey.forbid hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_PUSHKEYCOMPAT=1 HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a | |
288 | abort: prepushkey hook exited with status 1 |
|
288 | abort: prepushkey hook exited with status 1 | |
289 | [255] |
|
289 | [255] | |
290 | $ cd ../a |
|
290 | $ cd ../a | |
291 |
|
291 | |||
292 | test that prelistkeys can prevent listing keys |
|
292 | test that prelistkeys can prevent listing keys | |
293 |
|
293 | |||
294 | $ cat >> .hg/hgrc <<EOF |
|
294 | $ cat >> .hg/hgrc <<EOF | |
295 | > prelistkeys = sh -c "printenv.py prelistkeys.forbid 1" |
|
295 | > prelistkeys = sh -c "printenv.py prelistkeys.forbid 1" | |
296 | > EOF |
|
296 | > EOF | |
297 | $ hg bookmark -r null quux |
|
297 | $ hg bookmark -r null quux | |
298 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark |
|
298 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark | |
299 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark |
|
299 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark | |
300 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark |
|
300 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark | |
301 | $ cd ../b |
|
301 | $ cd ../b | |
302 | $ hg pull -B quux ../a |
|
302 | $ hg pull -B quux ../a | |
303 | pulling from ../a |
|
303 | pulling from ../a | |
304 | prelistkeys.forbid hook: HG_HOOKNAME=prelistkeys HG_HOOKTYPE=prelistkeys HG_NAMESPACE=bookmarks |
|
304 | prelistkeys.forbid hook: HG_HOOKNAME=prelistkeys HG_HOOKTYPE=prelistkeys HG_NAMESPACE=bookmarks | |
305 | abort: prelistkeys hook exited with status 1 |
|
305 | abort: prelistkeys hook exited with status 1 | |
306 | [255] |
|
306 | [255] | |
307 | $ cd ../a |
|
307 | $ cd ../a | |
308 | $ rm .hg/hgrc |
|
308 | $ rm .hg/hgrc | |
309 |
|
309 | |||
310 | prechangegroup hook can prevent incoming changes |
|
310 | prechangegroup hook can prevent incoming changes | |
311 |
|
311 | |||
312 | $ cd ../b |
|
312 | $ cd ../b | |
313 | $ hg -q tip |
|
313 | $ hg -q tip | |
314 | 3:07f3376c1e65 |
|
314 | 3:07f3376c1e65 | |
315 | $ cat > .hg/hgrc <<EOF |
|
315 | $ cat > .hg/hgrc <<EOF | |
316 | > [hooks] |
|
316 | > [hooks] | |
317 | > prechangegroup.forbid = sh -c "printenv.py prechangegroup.forbid 1" |
|
317 | > prechangegroup.forbid = sh -c "printenv.py prechangegroup.forbid 1" | |
318 | > EOF |
|
318 | > EOF | |
319 | $ hg pull ../a |
|
319 | $ hg pull ../a | |
320 | pulling from ../a |
|
320 | pulling from ../a | |
321 | searching for changes |
|
321 | searching for changes | |
322 | prechangegroup.forbid hook: HG_HOOKNAME=prechangegroup.forbid HG_HOOKTYPE=prechangegroup HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a |
|
322 | prechangegroup.forbid hook: HG_HOOKNAME=prechangegroup.forbid HG_HOOKTYPE=prechangegroup HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a | |
323 | abort: prechangegroup.forbid hook exited with status 1 |
|
323 | abort: prechangegroup.forbid hook exited with status 1 | |
324 | [255] |
|
324 | [255] | |
325 |
|
325 | |||
326 | pretxnchangegroup hook can see incoming changes, can roll back txn, |
|
326 | pretxnchangegroup hook can see incoming changes, can roll back txn, | |
327 | incoming changes no longer there after |
|
327 | incoming changes no longer there after | |
328 |
|
328 | |||
329 | $ cat > .hg/hgrc <<EOF |
|
329 | $ cat > .hg/hgrc <<EOF | |
330 | > [hooks] |
|
330 | > [hooks] | |
331 | > pretxnchangegroup.forbid0 = hg tip -q |
|
331 | > pretxnchangegroup.forbid0 = hg tip -q | |
332 | > pretxnchangegroup.forbid1 = sh -c "printenv.py pretxnchangegroup.forbid 1" |
|
332 | > pretxnchangegroup.forbid1 = sh -c "printenv.py pretxnchangegroup.forbid 1" | |
333 | > EOF |
|
333 | > EOF | |
334 | $ hg pull ../a |
|
334 | $ hg pull ../a | |
335 | pulling from ../a |
|
335 | pulling from ../a | |
336 | searching for changes |
|
336 | searching for changes | |
337 | adding changesets |
|
337 | adding changesets | |
338 | adding manifests |
|
338 | adding manifests | |
339 | adding file changes |
|
339 | adding file changes | |
340 | added 1 changesets with 1 changes to 1 files |
|
340 | added 1 changesets with 1 changes to 1 files | |
341 | 4:539e4b31b6dc |
|
341 | 4:539e4b31b6dc | |
342 | pretxnchangegroup.forbid hook: HG_HOOKNAME=pretxnchangegroup.forbid1 HG_HOOKTYPE=pretxnchangegroup HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_NODE_LAST=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a |
|
342 | pretxnchangegroup.forbid hook: HG_HOOKNAME=pretxnchangegroup.forbid1 HG_HOOKTYPE=pretxnchangegroup HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_NODE_LAST=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a | |
343 | transaction abort! |
|
343 | transaction abort! | |
344 | rollback completed |
|
344 | rollback completed | |
345 | abort: pretxnchangegroup.forbid1 hook exited with status 1 |
|
345 | abort: pretxnchangegroup.forbid1 hook exited with status 1 | |
346 | [255] |
|
346 | [255] | |
347 | $ hg -q tip |
|
347 | $ hg -q tip | |
348 | 3:07f3376c1e65 |
|
348 | 3:07f3376c1e65 | |
349 |
|
349 | |||
350 | outgoing hooks can see env vars |
|
350 | outgoing hooks can see env vars | |
351 |
|
351 | |||
352 | $ rm .hg/hgrc |
|
352 | $ rm .hg/hgrc | |
353 | $ cat > ../a/.hg/hgrc <<EOF |
|
353 | $ cat > ../a/.hg/hgrc <<EOF | |
354 | > [hooks] |
|
354 | > [hooks] | |
355 | > preoutgoing = sh -c "printenv.py preoutgoing" |
|
355 | > preoutgoing = sh -c "printenv.py preoutgoing" | |
356 | > outgoing = sh -c "printenv.py outgoing" |
|
356 | > outgoing = sh -c "printenv.py outgoing" | |
357 | > EOF |
|
357 | > EOF | |
358 | $ hg pull ../a |
|
358 | $ hg pull ../a | |
359 | pulling from ../a |
|
359 | pulling from ../a | |
360 | searching for changes |
|
360 | searching for changes | |
361 | preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=pull |
|
361 | preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=pull | |
362 | outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull |
|
362 | outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull | |
363 | adding changesets |
|
363 | adding changesets | |
364 | adding manifests |
|
364 | adding manifests | |
365 | adding file changes |
|
365 | adding file changes | |
366 | added 1 changesets with 1 changes to 1 files |
|
366 | added 1 changesets with 1 changes to 1 files | |
367 | adding remote bookmark quux |
|
367 | adding remote bookmark quux | |
368 | new changesets 539e4b31b6dc |
|
368 | new changesets 539e4b31b6dc | |
369 | (run 'hg update' to get a working copy) |
|
369 | (run 'hg update' to get a working copy) | |
370 | $ hg rollback |
|
370 | $ hg rollback | |
371 | repository tip rolled back to revision 3 (undo pull) |
|
371 | repository tip rolled back to revision 3 (undo pull) | |
372 |
|
372 | |||
373 | preoutgoing hook can prevent outgoing changes |
|
373 | preoutgoing hook can prevent outgoing changes | |
374 |
|
374 | |||
375 | $ cat >> ../a/.hg/hgrc <<EOF |
|
375 | $ cat >> ../a/.hg/hgrc <<EOF | |
376 | > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1" |
|
376 | > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1" | |
377 | > EOF |
|
377 | > EOF | |
378 | $ hg pull ../a |
|
378 | $ hg pull ../a | |
379 | pulling from ../a |
|
379 | pulling from ../a | |
380 | searching for changes |
|
380 | searching for changes | |
381 | preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=pull |
|
381 | preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=pull | |
382 | preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=pull |
|
382 | preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=pull | |
383 | abort: preoutgoing.forbid hook exited with status 1 |
|
383 | abort: preoutgoing.forbid hook exited with status 1 | |
384 | [255] |
|
384 | [255] | |
385 |
|
385 | |||
386 | outgoing hooks work for local clones |
|
386 | outgoing hooks work for local clones | |
387 |
|
387 | |||
388 | $ cd .. |
|
388 | $ cd .. | |
389 | $ cat > a/.hg/hgrc <<EOF |
|
389 | $ cat > a/.hg/hgrc <<EOF | |
390 | > [hooks] |
|
390 | > [hooks] | |
391 | > preoutgoing = sh -c "printenv.py preoutgoing" |
|
391 | > preoutgoing = sh -c "printenv.py preoutgoing" | |
392 | > outgoing = sh -c "printenv.py outgoing" |
|
392 | > outgoing = sh -c "printenv.py outgoing" | |
393 | > EOF |
|
393 | > EOF | |
394 | $ hg clone a c |
|
394 | $ hg clone a c | |
395 | preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=clone |
|
395 | preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=clone | |
396 | outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone |
|
396 | outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone | |
397 | updating to branch default |
|
397 | updating to branch default | |
398 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
398 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
399 | $ rm -rf c |
|
399 | $ rm -rf c | |
400 |
|
400 | |||
401 | preoutgoing hook can prevent outgoing changes for local clones |
|
401 | preoutgoing hook can prevent outgoing changes for local clones | |
402 |
|
402 | |||
403 | $ cat >> a/.hg/hgrc <<EOF |
|
403 | $ cat >> a/.hg/hgrc <<EOF | |
404 | > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1" |
|
404 | > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1" | |
405 | > EOF |
|
405 | > EOF | |
406 | $ hg clone a zzz |
|
406 | $ hg clone a zzz | |
407 | preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=clone |
|
407 | preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=clone | |
408 | preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=clone |
|
408 | preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=clone | |
409 | abort: preoutgoing.forbid hook exited with status 1 |
|
409 | abort: preoutgoing.forbid hook exited with status 1 | |
410 | [255] |
|
410 | [255] | |
411 |
|
411 | |||
412 | $ cd "$TESTTMP/b" |
|
412 | $ cd "$TESTTMP/b" | |
413 |
|
413 | |||
414 | $ cat > hooktests.py <<EOF |
|
414 | $ cat > hooktests.py <<EOF | |
415 | > from __future__ import print_function |
|
415 | > from __future__ import print_function | |
416 | > from mercurial import ( |
|
416 | > from mercurial import ( | |
417 | > error, |
|
417 | > error, | |
418 | > pycompat, |
|
418 | > pycompat, | |
419 | > ) |
|
419 | > ) | |
420 | > |
|
420 | > | |
421 | > uncallable = 0 |
|
421 | > uncallable = 0 | |
422 | > |
|
422 | > | |
423 | > def printargs(ui, args): |
|
423 | > def printargs(ui, args): | |
424 | > a = list(pycompat.byteskwargs(args).items()) |
|
424 | > a = list(pycompat.byteskwargs(args).items()) | |
425 | > a.sort() |
|
425 | > a.sort() | |
426 | > ui.write(b'hook args:\n') |
|
426 | > ui.write(b'hook args:\n') | |
427 | > for k, v in a: |
|
427 | > for k, v in a: | |
428 | > ui.write(b' %s %s\n' % (k, v)) |
|
428 | > ui.write(b' %s %s\n' % (k, v)) | |
429 | > |
|
429 | > | |
430 | > def passhook(ui, repo, **args): |
|
430 | > def passhook(ui, repo, **args): | |
431 | > printargs(ui, args) |
|
431 | > printargs(ui, args) | |
432 | > |
|
432 | > | |
433 | > def failhook(ui, repo, **args): |
|
433 | > def failhook(ui, repo, **args): | |
434 | > printargs(ui, args) |
|
434 | > printargs(ui, args) | |
435 | > return True |
|
435 | > return True | |
436 | > |
|
436 | > | |
437 | > class LocalException(Exception): |
|
437 | > class LocalException(Exception): | |
438 | > pass |
|
438 | > pass | |
439 | > |
|
439 | > | |
440 | > def raisehook(**args): |
|
440 | > def raisehook(**args): | |
441 | > raise LocalException('exception from hook') |
|
441 | > raise LocalException('exception from hook') | |
442 | > |
|
442 | > | |
443 | > def aborthook(**args): |
|
443 | > def aborthook(**args): | |
444 | > raise error.Abort(b'raise abort from hook') |
|
444 | > raise error.Abort(b'raise abort from hook') | |
445 | > |
|
445 | > | |
446 | > def brokenhook(**args): |
|
446 | > def brokenhook(**args): | |
447 | > return 1 + {} |
|
447 | > return 1 + {} | |
448 | > |
|
448 | > | |
449 | > def verbosehook(ui, **args): |
|
449 | > def verbosehook(ui, **args): | |
450 | > ui.note(b'verbose output from hook\n') |
|
450 | > ui.note(b'verbose output from hook\n') | |
451 | > |
|
451 | > | |
452 | > def printtags(ui, repo, **args): |
|
452 | > def printtags(ui, repo, **args): | |
453 | > ui.write(b'[%s]\n' % b', '.join(sorted(repo.tags()))) |
|
453 | > ui.write(b'[%s]\n' % b', '.join(sorted(repo.tags()))) | |
454 | > |
|
454 | > | |
455 | > class container: |
|
455 | > class container: | |
456 | > unreachable = 1 |
|
456 | > unreachable = 1 | |
457 | > EOF |
|
457 | > EOF | |
458 |
|
458 | |||
459 | $ cat > syntaxerror.py << EOF |
|
459 | $ cat > syntaxerror.py << NO_CHECK_EOF | |
460 | > (foo |
|
460 | > (foo | |
461 | > EOF |
|
461 | > NO_CHECK_EOF | |
462 |
|
462 | |||
463 | test python hooks |
|
463 | test python hooks | |
464 |
|
464 | |||
465 | #if windows |
|
465 | #if windows | |
466 | $ PYTHONPATH="$TESTTMP/b;$PYTHONPATH" |
|
466 | $ PYTHONPATH="$TESTTMP/b;$PYTHONPATH" | |
467 | #else |
|
467 | #else | |
468 | $ PYTHONPATH="$TESTTMP/b:$PYTHONPATH" |
|
468 | $ PYTHONPATH="$TESTTMP/b:$PYTHONPATH" | |
469 | #endif |
|
469 | #endif | |
470 | $ export PYTHONPATH |
|
470 | $ export PYTHONPATH | |
471 |
|
471 | |||
472 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
472 | $ echo '[hooks]' > ../a/.hg/hgrc | |
473 | $ echo 'preoutgoing.broken = python:hooktests.brokenhook' >> ../a/.hg/hgrc |
|
473 | $ echo 'preoutgoing.broken = python:hooktests.brokenhook' >> ../a/.hg/hgrc | |
474 | $ hg pull ../a 2>&1 | grep 'raised an exception' |
|
474 | $ hg pull ../a 2>&1 | grep 'raised an exception' | |
475 | error: preoutgoing.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict' |
|
475 | error: preoutgoing.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict' | |
476 |
|
476 | |||
477 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
477 | $ echo '[hooks]' > ../a/.hg/hgrc | |
478 | $ echo 'preoutgoing.raise = python:hooktests.raisehook' >> ../a/.hg/hgrc |
|
478 | $ echo 'preoutgoing.raise = python:hooktests.raisehook' >> ../a/.hg/hgrc | |
479 | $ hg pull ../a 2>&1 | grep 'raised an exception' |
|
479 | $ hg pull ../a 2>&1 | grep 'raised an exception' | |
480 | error: preoutgoing.raise hook raised an exception: exception from hook |
|
480 | error: preoutgoing.raise hook raised an exception: exception from hook | |
481 |
|
481 | |||
482 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
482 | $ echo '[hooks]' > ../a/.hg/hgrc | |
483 | $ echo 'preoutgoing.abort = python:hooktests.aborthook' >> ../a/.hg/hgrc |
|
483 | $ echo 'preoutgoing.abort = python:hooktests.aborthook' >> ../a/.hg/hgrc | |
484 | $ hg pull ../a |
|
484 | $ hg pull ../a | |
485 | pulling from ../a |
|
485 | pulling from ../a | |
486 | searching for changes |
|
486 | searching for changes | |
487 | error: preoutgoing.abort hook failed: raise abort from hook |
|
487 | error: preoutgoing.abort hook failed: raise abort from hook | |
488 | abort: raise abort from hook |
|
488 | abort: raise abort from hook | |
489 | [255] |
|
489 | [255] | |
490 |
|
490 | |||
491 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
491 | $ echo '[hooks]' > ../a/.hg/hgrc | |
492 | $ echo 'preoutgoing.fail = python:hooktests.failhook' >> ../a/.hg/hgrc |
|
492 | $ echo 'preoutgoing.fail = python:hooktests.failhook' >> ../a/.hg/hgrc | |
493 | $ hg pull ../a |
|
493 | $ hg pull ../a | |
494 | pulling from ../a |
|
494 | pulling from ../a | |
495 | searching for changes |
|
495 | searching for changes | |
496 | hook args: |
|
496 | hook args: | |
497 | hooktype preoutgoing |
|
497 | hooktype preoutgoing | |
498 | source pull |
|
498 | source pull | |
499 | abort: preoutgoing.fail hook failed |
|
499 | abort: preoutgoing.fail hook failed | |
500 | [255] |
|
500 | [255] | |
501 |
|
501 | |||
502 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
502 | $ echo '[hooks]' > ../a/.hg/hgrc | |
503 | $ echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc |
|
503 | $ echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc | |
504 | $ hg pull ../a |
|
504 | $ hg pull ../a | |
505 | pulling from ../a |
|
505 | pulling from ../a | |
506 | searching for changes |
|
506 | searching for changes | |
507 | abort: preoutgoing.uncallable hook is invalid: "hooktests.uncallable" is not callable |
|
507 | abort: preoutgoing.uncallable hook is invalid: "hooktests.uncallable" is not callable | |
508 | [255] |
|
508 | [255] | |
509 |
|
509 | |||
510 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
510 | $ echo '[hooks]' > ../a/.hg/hgrc | |
511 | $ echo 'preoutgoing.nohook = python:hooktests.nohook' >> ../a/.hg/hgrc |
|
511 | $ echo 'preoutgoing.nohook = python:hooktests.nohook' >> ../a/.hg/hgrc | |
512 | $ hg pull ../a |
|
512 | $ hg pull ../a | |
513 | pulling from ../a |
|
513 | pulling from ../a | |
514 | searching for changes |
|
514 | searching for changes | |
515 | abort: preoutgoing.nohook hook is invalid: "hooktests.nohook" is not defined |
|
515 | abort: preoutgoing.nohook hook is invalid: "hooktests.nohook" is not defined | |
516 | [255] |
|
516 | [255] | |
517 |
|
517 | |||
518 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
518 | $ echo '[hooks]' > ../a/.hg/hgrc | |
519 | $ echo 'preoutgoing.nomodule = python:nomodule' >> ../a/.hg/hgrc |
|
519 | $ echo 'preoutgoing.nomodule = python:nomodule' >> ../a/.hg/hgrc | |
520 | $ hg pull ../a |
|
520 | $ hg pull ../a | |
521 | pulling from ../a |
|
521 | pulling from ../a | |
522 | searching for changes |
|
522 | searching for changes | |
523 | abort: preoutgoing.nomodule hook is invalid: "nomodule" not in a module |
|
523 | abort: preoutgoing.nomodule hook is invalid: "nomodule" not in a module | |
524 | [255] |
|
524 | [255] | |
525 |
|
525 | |||
526 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
526 | $ echo '[hooks]' > ../a/.hg/hgrc | |
527 | $ echo 'preoutgoing.badmodule = python:nomodule.nowhere' >> ../a/.hg/hgrc |
|
527 | $ echo 'preoutgoing.badmodule = python:nomodule.nowhere' >> ../a/.hg/hgrc | |
528 | $ hg pull ../a |
|
528 | $ hg pull ../a | |
529 | pulling from ../a |
|
529 | pulling from ../a | |
530 | searching for changes |
|
530 | searching for changes | |
531 | abort: preoutgoing.badmodule hook is invalid: import of "nomodule" failed |
|
531 | abort: preoutgoing.badmodule hook is invalid: import of "nomodule" failed | |
532 | (run with --traceback for stack trace) |
|
532 | (run with --traceback for stack trace) | |
533 | [255] |
|
533 | [255] | |
534 |
|
534 | |||
535 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
535 | $ echo '[hooks]' > ../a/.hg/hgrc | |
536 | $ echo 'preoutgoing.unreachable = python:hooktests.container.unreachable' >> ../a/.hg/hgrc |
|
536 | $ echo 'preoutgoing.unreachable = python:hooktests.container.unreachable' >> ../a/.hg/hgrc | |
537 | $ hg pull ../a |
|
537 | $ hg pull ../a | |
538 | pulling from ../a |
|
538 | pulling from ../a | |
539 | searching for changes |
|
539 | searching for changes | |
540 | abort: preoutgoing.unreachable hook is invalid: import of "hooktests.container" failed |
|
540 | abort: preoutgoing.unreachable hook is invalid: import of "hooktests.container" failed | |
541 | (run with --traceback for stack trace) |
|
541 | (run with --traceback for stack trace) | |
542 | [255] |
|
542 | [255] | |
543 |
|
543 | |||
544 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
544 | $ echo '[hooks]' > ../a/.hg/hgrc | |
545 | $ echo 'preoutgoing.syntaxerror = python:syntaxerror.syntaxerror' >> ../a/.hg/hgrc |
|
545 | $ echo 'preoutgoing.syntaxerror = python:syntaxerror.syntaxerror' >> ../a/.hg/hgrc | |
546 | $ hg pull ../a |
|
546 | $ hg pull ../a | |
547 | pulling from ../a |
|
547 | pulling from ../a | |
548 | searching for changes |
|
548 | searching for changes | |
549 | abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed |
|
549 | abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed | |
550 | (run with --traceback for stack trace) |
|
550 | (run with --traceback for stack trace) | |
551 | [255] |
|
551 | [255] | |
552 |
|
552 | |||
553 | The second egrep is to filter out lines like ' ^', which are slightly |
|
553 | The second egrep is to filter out lines like ' ^', which are slightly | |
554 | different between Python 2.6 and Python 2.7. |
|
554 | different between Python 2.6 and Python 2.7. | |
555 | $ hg pull ../a --traceback 2>&1 | egrep -v '^( +File| [_a-zA-Z*(])' | egrep -v '^( )+(\^)?$' |
|
555 | $ hg pull ../a --traceback 2>&1 | egrep -v '^( +File| [_a-zA-Z*(])' | egrep -v '^( )+(\^)?$' | |
556 | pulling from ../a |
|
556 | pulling from ../a | |
557 | searching for changes |
|
557 | searching for changes | |
558 | exception from first failed import attempt: |
|
558 | exception from first failed import attempt: | |
559 | Traceback (most recent call last): |
|
559 | Traceback (most recent call last): | |
560 | SyntaxError: * (glob) |
|
560 | SyntaxError: * (glob) | |
561 | exception from second failed import attempt: |
|
561 | exception from second failed import attempt: | |
562 | Traceback (most recent call last): |
|
562 | Traceback (most recent call last): | |
563 | ImportError: No module named hgext_syntaxerror |
|
563 | ImportError: No module named hgext_syntaxerror | |
564 | Traceback (most recent call last): |
|
564 | Traceback (most recent call last): | |
565 | HookLoadError: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed |
|
565 | HookLoadError: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed | |
566 | abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed |
|
566 | abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed | |
567 |
|
567 | |||
568 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
568 | $ echo '[hooks]' > ../a/.hg/hgrc | |
569 | $ echo 'preoutgoing.pass = python:hooktests.passhook' >> ../a/.hg/hgrc |
|
569 | $ echo 'preoutgoing.pass = python:hooktests.passhook' >> ../a/.hg/hgrc | |
570 | $ hg pull ../a |
|
570 | $ hg pull ../a | |
571 | pulling from ../a |
|
571 | pulling from ../a | |
572 | searching for changes |
|
572 | searching for changes | |
573 | hook args: |
|
573 | hook args: | |
574 | hooktype preoutgoing |
|
574 | hooktype preoutgoing | |
575 | source pull |
|
575 | source pull | |
576 | adding changesets |
|
576 | adding changesets | |
577 | adding manifests |
|
577 | adding manifests | |
578 | adding file changes |
|
578 | adding file changes | |
579 | added 1 changesets with 1 changes to 1 files |
|
579 | added 1 changesets with 1 changes to 1 files | |
580 | adding remote bookmark quux |
|
580 | adding remote bookmark quux | |
581 | new changesets 539e4b31b6dc |
|
581 | new changesets 539e4b31b6dc | |
582 | (run 'hg update' to get a working copy) |
|
582 | (run 'hg update' to get a working copy) | |
583 |
|
583 | |||
584 | post- python hooks that fail to *run* don't cause an abort |
|
584 | post- python hooks that fail to *run* don't cause an abort | |
585 | $ rm ../a/.hg/hgrc |
|
585 | $ rm ../a/.hg/hgrc | |
586 | $ echo '[hooks]' > .hg/hgrc |
|
586 | $ echo '[hooks]' > .hg/hgrc | |
587 | $ echo 'post-pull.broken = python:hooktests.brokenhook' >> .hg/hgrc |
|
587 | $ echo 'post-pull.broken = python:hooktests.brokenhook' >> .hg/hgrc | |
588 | $ hg pull ../a |
|
588 | $ hg pull ../a | |
589 | pulling from ../a |
|
589 | pulling from ../a | |
590 | searching for changes |
|
590 | searching for changes | |
591 | no changes found |
|
591 | no changes found | |
592 | error: post-pull.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict' |
|
592 | error: post-pull.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict' | |
593 | (run with --traceback for stack trace) |
|
593 | (run with --traceback for stack trace) | |
594 |
|
594 | |||
595 | but post- python hooks that fail to *load* do |
|
595 | but post- python hooks that fail to *load* do | |
596 | $ echo '[hooks]' > .hg/hgrc |
|
596 | $ echo '[hooks]' > .hg/hgrc | |
597 | $ echo 'post-pull.nomodule = python:nomodule' >> .hg/hgrc |
|
597 | $ echo 'post-pull.nomodule = python:nomodule' >> .hg/hgrc | |
598 | $ hg pull ../a |
|
598 | $ hg pull ../a | |
599 | pulling from ../a |
|
599 | pulling from ../a | |
600 | searching for changes |
|
600 | searching for changes | |
601 | no changes found |
|
601 | no changes found | |
602 | abort: post-pull.nomodule hook is invalid: "nomodule" not in a module |
|
602 | abort: post-pull.nomodule hook is invalid: "nomodule" not in a module | |
603 | [255] |
|
603 | [255] | |
604 |
|
604 | |||
605 | $ echo '[hooks]' > .hg/hgrc |
|
605 | $ echo '[hooks]' > .hg/hgrc | |
606 | $ echo 'post-pull.badmodule = python:nomodule.nowhere' >> .hg/hgrc |
|
606 | $ echo 'post-pull.badmodule = python:nomodule.nowhere' >> .hg/hgrc | |
607 | $ hg pull ../a |
|
607 | $ hg pull ../a | |
608 | pulling from ../a |
|
608 | pulling from ../a | |
609 | searching for changes |
|
609 | searching for changes | |
610 | no changes found |
|
610 | no changes found | |
611 | abort: post-pull.badmodule hook is invalid: import of "nomodule" failed |
|
611 | abort: post-pull.badmodule hook is invalid: import of "nomodule" failed | |
612 | (run with --traceback for stack trace) |
|
612 | (run with --traceback for stack trace) | |
613 | [255] |
|
613 | [255] | |
614 |
|
614 | |||
615 | $ echo '[hooks]' > .hg/hgrc |
|
615 | $ echo '[hooks]' > .hg/hgrc | |
616 | $ echo 'post-pull.nohook = python:hooktests.nohook' >> .hg/hgrc |
|
616 | $ echo 'post-pull.nohook = python:hooktests.nohook' >> .hg/hgrc | |
617 | $ hg pull ../a |
|
617 | $ hg pull ../a | |
618 | pulling from ../a |
|
618 | pulling from ../a | |
619 | searching for changes |
|
619 | searching for changes | |
620 | no changes found |
|
620 | no changes found | |
621 | abort: post-pull.nohook hook is invalid: "hooktests.nohook" is not defined |
|
621 | abort: post-pull.nohook hook is invalid: "hooktests.nohook" is not defined | |
622 | [255] |
|
622 | [255] | |
623 |
|
623 | |||
624 | make sure --traceback works |
|
624 | make sure --traceback works | |
625 |
|
625 | |||
626 | $ echo '[hooks]' > .hg/hgrc |
|
626 | $ echo '[hooks]' > .hg/hgrc | |
627 | $ echo 'commit.abort = python:hooktests.aborthook' >> .hg/hgrc |
|
627 | $ echo 'commit.abort = python:hooktests.aborthook' >> .hg/hgrc | |
628 |
|
628 | |||
629 | $ echo aa > a |
|
629 | $ echo aa > a | |
630 | $ hg --traceback commit -d '0 0' -ma 2>&1 | grep '^Traceback' |
|
630 | $ hg --traceback commit -d '0 0' -ma 2>&1 | grep '^Traceback' | |
631 | Traceback (most recent call last): |
|
631 | Traceback (most recent call last): | |
632 |
|
632 | |||
633 | $ cd .. |
|
633 | $ cd .. | |
634 | $ hg init c |
|
634 | $ hg init c | |
635 | $ cd c |
|
635 | $ cd c | |
636 |
|
636 | |||
637 | $ cat > hookext.py <<EOF |
|
637 | $ cat > hookext.py <<EOF | |
638 | > def autohook(ui, **args): |
|
638 | > def autohook(ui, **args): | |
639 | > ui.write(b'Automatically installed hook\n') |
|
639 | > ui.write(b'Automatically installed hook\n') | |
640 | > |
|
640 | > | |
641 | > def reposetup(ui, repo): |
|
641 | > def reposetup(ui, repo): | |
642 | > repo.ui.setconfig(b"hooks", b"commit.auto", autohook) |
|
642 | > repo.ui.setconfig(b"hooks", b"commit.auto", autohook) | |
643 | > EOF |
|
643 | > EOF | |
644 | $ echo '[extensions]' >> .hg/hgrc |
|
644 | $ echo '[extensions]' >> .hg/hgrc | |
645 | $ echo 'hookext = hookext.py' >> .hg/hgrc |
|
645 | $ echo 'hookext = hookext.py' >> .hg/hgrc | |
646 |
|
646 | |||
647 | $ touch foo |
|
647 | $ touch foo | |
648 | $ hg add foo |
|
648 | $ hg add foo | |
649 | $ hg ci -d '0 0' -m 'add foo' |
|
649 | $ hg ci -d '0 0' -m 'add foo' | |
650 | Automatically installed hook |
|
650 | Automatically installed hook | |
651 | $ echo >> foo |
|
651 | $ echo >> foo | |
652 | $ hg ci --debug -d '0 0' -m 'change foo' |
|
652 | $ hg ci --debug -d '0 0' -m 'change foo' | |
653 | committing files: |
|
653 | committing files: | |
654 | foo |
|
654 | foo | |
655 | committing manifest |
|
655 | committing manifest | |
656 | committing changelog |
|
656 | committing changelog | |
657 | updating the branch cache |
|
657 | updating the branch cache | |
658 | committed changeset 1:52998019f6252a2b893452765fcb0a47351a5708 |
|
658 | committed changeset 1:52998019f6252a2b893452765fcb0a47351a5708 | |
659 | calling hook commit.auto: hgext_hookext.autohook |
|
659 | calling hook commit.auto: hgext_hookext.autohook | |
660 | Automatically installed hook |
|
660 | Automatically installed hook | |
661 |
|
661 | |||
662 | $ hg showconfig hooks |
|
662 | $ hg showconfig hooks | |
663 | hooks.commit.auto=<function autohook at *> (glob) |
|
663 | hooks.commit.auto=<function autohook at *> (glob) | |
664 |
|
664 | |||
665 | test python hook configured with python:[file]:[hook] syntax |
|
665 | test python hook configured with python:[file]:[hook] syntax | |
666 |
|
666 | |||
667 | $ cd .. |
|
667 | $ cd .. | |
668 | $ mkdir d |
|
668 | $ mkdir d | |
669 | $ cd d |
|
669 | $ cd d | |
670 | $ hg init repo |
|
670 | $ hg init repo | |
671 | $ mkdir hooks |
|
671 | $ mkdir hooks | |
672 |
|
672 | |||
673 | $ cd hooks |
|
673 | $ cd hooks | |
674 | $ cat > testhooks.py <<EOF |
|
674 | $ cat > testhooks.py <<EOF | |
675 | > def testhook(ui, **args): |
|
675 | > def testhook(ui, **args): | |
676 | > ui.write(b'hook works\n') |
|
676 | > ui.write(b'hook works\n') | |
677 | > EOF |
|
677 | > EOF | |
678 | $ echo '[hooks]' > ../repo/.hg/hgrc |
|
678 | $ echo '[hooks]' > ../repo/.hg/hgrc | |
679 | $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc |
|
679 | $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc | |
680 |
|
680 | |||
681 | $ cd ../repo |
|
681 | $ cd ../repo | |
682 | $ hg commit -d '0 0' |
|
682 | $ hg commit -d '0 0' | |
683 | hook works |
|
683 | hook works | |
684 | nothing changed |
|
684 | nothing changed | |
685 | [1] |
|
685 | [1] | |
686 |
|
686 | |||
687 | $ echo '[hooks]' > .hg/hgrc |
|
687 | $ echo '[hooks]' > .hg/hgrc | |
688 | $ echo "update.ne = python:`pwd`/nonexistent.py:testhook" >> .hg/hgrc |
|
688 | $ echo "update.ne = python:`pwd`/nonexistent.py:testhook" >> .hg/hgrc | |
689 | $ echo "pre-identify.npmd = python:`pwd`/:no_python_module_dir" >> .hg/hgrc |
|
689 | $ echo "pre-identify.npmd = python:`pwd`/:no_python_module_dir" >> .hg/hgrc | |
690 |
|
690 | |||
691 | $ hg up null |
|
691 | $ hg up null | |
692 | loading update.ne hook failed: |
|
692 | loading update.ne hook failed: | |
693 | abort: $ENOENT$: $TESTTMP/d/repo/nonexistent.py |
|
693 | abort: $ENOENT$: $TESTTMP/d/repo/nonexistent.py | |
694 | [255] |
|
694 | [255] | |
695 |
|
695 | |||
696 | $ hg id |
|
696 | $ hg id | |
697 | loading pre-identify.npmd hook failed: |
|
697 | loading pre-identify.npmd hook failed: | |
698 | abort: No module named repo! |
|
698 | abort: No module named repo! | |
699 | [255] |
|
699 | [255] | |
700 |
|
700 | |||
701 | $ cd ../../b |
|
701 | $ cd ../../b | |
702 |
|
702 | |||
703 | make sure --traceback works on hook import failure |
|
703 | make sure --traceback works on hook import failure | |
704 |
|
704 | |||
705 | $ cat > importfail.py <<EOF |
|
705 | $ cat > importfail.py <<EOF | |
706 | > import somebogusmodule |
|
706 | > import somebogusmodule | |
707 | > # dereference something in the module to force demandimport to load it |
|
707 | > # dereference something in the module to force demandimport to load it | |
708 | > somebogusmodule.whatever |
|
708 | > somebogusmodule.whatever | |
709 | > EOF |
|
709 | > EOF | |
710 |
|
710 | |||
711 | $ echo '[hooks]' > .hg/hgrc |
|
711 | $ echo '[hooks]' > .hg/hgrc | |
712 | $ echo 'precommit.importfail = python:importfail.whatever' >> .hg/hgrc |
|
712 | $ echo 'precommit.importfail = python:importfail.whatever' >> .hg/hgrc | |
713 |
|
713 | |||
714 | $ echo a >> a |
|
714 | $ echo a >> a | |
715 | $ hg --traceback commit -ma 2>&1 | egrep -v '^( +File| [a-zA-Z(])' |
|
715 | $ hg --traceback commit -ma 2>&1 | egrep -v '^( +File| [a-zA-Z(])' | |
716 | exception from first failed import attempt: |
|
716 | exception from first failed import attempt: | |
717 | Traceback (most recent call last): |
|
717 | Traceback (most recent call last): | |
718 | ImportError: No module named somebogusmodule |
|
718 | ImportError: No module named somebogusmodule | |
719 | exception from second failed import attempt: |
|
719 | exception from second failed import attempt: | |
720 | Traceback (most recent call last): |
|
720 | Traceback (most recent call last): | |
721 | ImportError: No module named hgext_importfail |
|
721 | ImportError: No module named hgext_importfail | |
722 | Traceback (most recent call last): |
|
722 | Traceback (most recent call last): | |
723 | HookLoadError: precommit.importfail hook is invalid: import of "importfail" failed |
|
723 | HookLoadError: precommit.importfail hook is invalid: import of "importfail" failed | |
724 | abort: precommit.importfail hook is invalid: import of "importfail" failed |
|
724 | abort: precommit.importfail hook is invalid: import of "importfail" failed | |
725 |
|
725 | |||
726 | Issue1827: Hooks Update & Commit not completely post operation |
|
726 | Issue1827: Hooks Update & Commit not completely post operation | |
727 |
|
727 | |||
728 | commit and update hooks should run after command completion. The largefiles |
|
728 | commit and update hooks should run after command completion. The largefiles | |
729 | use demonstrates a recursive wlock, showing the hook doesn't run until the |
|
729 | use demonstrates a recursive wlock, showing the hook doesn't run until the | |
730 | final release (and dirstate flush). |
|
730 | final release (and dirstate flush). | |
731 |
|
731 | |||
732 | $ echo '[hooks]' > .hg/hgrc |
|
732 | $ echo '[hooks]' > .hg/hgrc | |
733 | $ echo 'commit = hg id' >> .hg/hgrc |
|
733 | $ echo 'commit = hg id' >> .hg/hgrc | |
734 | $ echo 'update = hg id' >> .hg/hgrc |
|
734 | $ echo 'update = hg id' >> .hg/hgrc | |
735 | $ echo bb > a |
|
735 | $ echo bb > a | |
736 | $ hg ci -ma |
|
736 | $ hg ci -ma | |
737 | 223eafe2750c tip |
|
737 | 223eafe2750c tip | |
738 | $ hg up 0 --config extensions.largefiles= |
|
738 | $ hg up 0 --config extensions.largefiles= | |
739 | The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !) |
|
739 | The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !) | |
740 | cb9a9f314b8b |
|
740 | cb9a9f314b8b | |
741 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
741 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
742 |
|
742 | |||
743 | make sure --verbose (and --quiet/--debug etc.) are propagated to the local ui |
|
743 | make sure --verbose (and --quiet/--debug etc.) are propagated to the local ui | |
744 | that is passed to pre/post hooks |
|
744 | that is passed to pre/post hooks | |
745 |
|
745 | |||
746 | $ echo '[hooks]' > .hg/hgrc |
|
746 | $ echo '[hooks]' > .hg/hgrc | |
747 | $ echo 'pre-identify = python:hooktests.verbosehook' >> .hg/hgrc |
|
747 | $ echo 'pre-identify = python:hooktests.verbosehook' >> .hg/hgrc | |
748 | $ hg id |
|
748 | $ hg id | |
749 | cb9a9f314b8b |
|
749 | cb9a9f314b8b | |
750 | $ hg id --verbose |
|
750 | $ hg id --verbose | |
751 | calling hook pre-identify: hooktests.verbosehook |
|
751 | calling hook pre-identify: hooktests.verbosehook | |
752 | verbose output from hook |
|
752 | verbose output from hook | |
753 | cb9a9f314b8b |
|
753 | cb9a9f314b8b | |
754 |
|
754 | |||
755 | Ensure hooks can be prioritized |
|
755 | Ensure hooks can be prioritized | |
756 |
|
756 | |||
757 | $ echo '[hooks]' > .hg/hgrc |
|
757 | $ echo '[hooks]' > .hg/hgrc | |
758 | $ echo 'pre-identify.a = python:hooktests.verbosehook' >> .hg/hgrc |
|
758 | $ echo 'pre-identify.a = python:hooktests.verbosehook' >> .hg/hgrc | |
759 | $ echo 'pre-identify.b = python:hooktests.verbosehook' >> .hg/hgrc |
|
759 | $ echo 'pre-identify.b = python:hooktests.verbosehook' >> .hg/hgrc | |
760 | $ echo 'priority.pre-identify.b = 1' >> .hg/hgrc |
|
760 | $ echo 'priority.pre-identify.b = 1' >> .hg/hgrc | |
761 | $ echo 'pre-identify.c = python:hooktests.verbosehook' >> .hg/hgrc |
|
761 | $ echo 'pre-identify.c = python:hooktests.verbosehook' >> .hg/hgrc | |
762 | $ hg id --verbose |
|
762 | $ hg id --verbose | |
763 | calling hook pre-identify.b: hooktests.verbosehook |
|
763 | calling hook pre-identify.b: hooktests.verbosehook | |
764 | verbose output from hook |
|
764 | verbose output from hook | |
765 | calling hook pre-identify.a: hooktests.verbosehook |
|
765 | calling hook pre-identify.a: hooktests.verbosehook | |
766 | verbose output from hook |
|
766 | verbose output from hook | |
767 | calling hook pre-identify.c: hooktests.verbosehook |
|
767 | calling hook pre-identify.c: hooktests.verbosehook | |
768 | verbose output from hook |
|
768 | verbose output from hook | |
769 | cb9a9f314b8b |
|
769 | cb9a9f314b8b | |
770 |
|
770 | |||
771 | new tags must be visible in pretxncommit (issue3210) |
|
771 | new tags must be visible in pretxncommit (issue3210) | |
772 |
|
772 | |||
773 | $ echo 'pretxncommit.printtags = python:hooktests.printtags' >> .hg/hgrc |
|
773 | $ echo 'pretxncommit.printtags = python:hooktests.printtags' >> .hg/hgrc | |
774 | $ hg tag -f foo |
|
774 | $ hg tag -f foo | |
775 | [a, foo, tip] |
|
775 | [a, foo, tip] | |
776 |
|
776 | |||
777 | post-init hooks must not crash (issue4983) |
|
777 | post-init hooks must not crash (issue4983) | |
778 | This also creates the `to` repo for the next test block. |
|
778 | This also creates the `to` repo for the next test block. | |
779 |
|
779 | |||
780 | $ cd .. |
|
780 | $ cd .. | |
781 | $ cat << EOF >> hgrc-with-post-init-hook |
|
781 | $ cat << EOF >> hgrc-with-post-init-hook | |
782 | > [hooks] |
|
782 | > [hooks] | |
783 | > post-init = sh -c "printenv.py post-init" |
|
783 | > post-init = sh -c "printenv.py post-init" | |
784 | > EOF |
|
784 | > EOF | |
785 | $ HGRCPATH=hgrc-with-post-init-hook hg init to |
|
785 | $ HGRCPATH=hgrc-with-post-init-hook hg init to | |
786 | post-init hook: HG_ARGS=init to HG_HOOKNAME=post-init HG_HOOKTYPE=post-init HG_OPTS={'insecure': None, 'remotecmd': '', 'ssh': ''} HG_PATS=['to'] HG_RESULT=0 |
|
786 | post-init hook: HG_ARGS=init to HG_HOOKNAME=post-init HG_HOOKTYPE=post-init HG_OPTS={'insecure': None, 'remotecmd': '', 'ssh': ''} HG_PATS=['to'] HG_RESULT=0 | |
787 |
|
787 | |||
788 | new commits must be visible in pretxnchangegroup (issue3428) |
|
788 | new commits must be visible in pretxnchangegroup (issue3428) | |
789 |
|
789 | |||
790 | $ echo '[hooks]' >> to/.hg/hgrc |
|
790 | $ echo '[hooks]' >> to/.hg/hgrc | |
791 | $ echo 'prechangegroup = hg --traceback tip' >> to/.hg/hgrc |
|
791 | $ echo 'prechangegroup = hg --traceback tip' >> to/.hg/hgrc | |
792 | $ echo 'pretxnchangegroup = hg --traceback tip' >> to/.hg/hgrc |
|
792 | $ echo 'pretxnchangegroup = hg --traceback tip' >> to/.hg/hgrc | |
793 | $ echo a >> to/a |
|
793 | $ echo a >> to/a | |
794 | $ hg --cwd to ci -Ama |
|
794 | $ hg --cwd to ci -Ama | |
795 | adding a |
|
795 | adding a | |
796 | $ hg clone to from |
|
796 | $ hg clone to from | |
797 | updating to branch default |
|
797 | updating to branch default | |
798 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
798 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
799 | $ echo aa >> from/a |
|
799 | $ echo aa >> from/a | |
800 | $ hg --cwd from ci -mb |
|
800 | $ hg --cwd from ci -mb | |
801 | $ hg --cwd from push |
|
801 | $ hg --cwd from push | |
802 | pushing to $TESTTMP/to |
|
802 | pushing to $TESTTMP/to | |
803 | searching for changes |
|
803 | searching for changes | |
804 | changeset: 0:cb9a9f314b8b |
|
804 | changeset: 0:cb9a9f314b8b | |
805 | tag: tip |
|
805 | tag: tip | |
806 | user: test |
|
806 | user: test | |
807 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
807 | date: Thu Jan 01 00:00:00 1970 +0000 | |
808 | summary: a |
|
808 | summary: a | |
809 |
|
809 | |||
810 | adding changesets |
|
810 | adding changesets | |
811 | adding manifests |
|
811 | adding manifests | |
812 | adding file changes |
|
812 | adding file changes | |
813 | added 1 changesets with 1 changes to 1 files |
|
813 | added 1 changesets with 1 changes to 1 files | |
814 | changeset: 1:9836a07b9b9d |
|
814 | changeset: 1:9836a07b9b9d | |
815 | tag: tip |
|
815 | tag: tip | |
816 | user: test |
|
816 | user: test | |
817 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
817 | date: Thu Jan 01 00:00:00 1970 +0000 | |
818 | summary: b |
|
818 | summary: b | |
819 |
|
819 | |||
820 |
|
820 | |||
821 | pretxnclose hook failure should abort the transaction |
|
821 | pretxnclose hook failure should abort the transaction | |
822 |
|
822 | |||
823 | $ hg init txnfailure |
|
823 | $ hg init txnfailure | |
824 | $ cd txnfailure |
|
824 | $ cd txnfailure | |
825 | $ touch a && hg commit -Aqm a |
|
825 | $ touch a && hg commit -Aqm a | |
826 | $ cat >> .hg/hgrc <<EOF |
|
826 | $ cat >> .hg/hgrc <<EOF | |
827 | > [hooks] |
|
827 | > [hooks] | |
828 | > pretxnclose.error = exit 1 |
|
828 | > pretxnclose.error = exit 1 | |
829 | > EOF |
|
829 | > EOF | |
830 | $ hg strip -r 0 --config extensions.strip= |
|
830 | $ hg strip -r 0 --config extensions.strip= | |
831 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
831 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
832 | saved backup bundle to * (glob) |
|
832 | saved backup bundle to * (glob) | |
833 | transaction abort! |
|
833 | transaction abort! | |
834 | rollback completed |
|
834 | rollback completed | |
835 | strip failed, backup bundle stored in * (glob) |
|
835 | strip failed, backup bundle stored in * (glob) | |
836 | abort: pretxnclose.error hook exited with status 1 |
|
836 | abort: pretxnclose.error hook exited with status 1 | |
837 | [255] |
|
837 | [255] | |
838 | $ hg recover |
|
838 | $ hg recover | |
839 | no interrupted transaction available |
|
839 | no interrupted transaction available | |
840 | [1] |
|
840 | [1] | |
841 | $ cd .. |
|
841 | $ cd .. | |
842 |
|
842 | |||
843 | check whether HG_PENDING makes pending changes only in related |
|
843 | check whether HG_PENDING makes pending changes only in related | |
844 | repositories visible to an external hook. |
|
844 | repositories visible to an external hook. | |
845 |
|
845 | |||
846 | (emulate a transaction running concurrently by copied |
|
846 | (emulate a transaction running concurrently by copied | |
847 | .hg/store/00changelog.i.a in subsequent test) |
|
847 | .hg/store/00changelog.i.a in subsequent test) | |
848 |
|
848 | |||
849 | $ cat > $TESTTMP/savepending.sh <<EOF |
|
849 | $ cat > $TESTTMP/savepending.sh <<EOF | |
850 | > cp .hg/store/00changelog.i.a .hg/store/00changelog.i.a.saved |
|
850 | > cp .hg/store/00changelog.i.a .hg/store/00changelog.i.a.saved | |
851 | > exit 1 # to avoid adding new revision for subsequent tests |
|
851 | > exit 1 # to avoid adding new revision for subsequent tests | |
852 | > EOF |
|
852 | > EOF | |
853 | $ cd a |
|
853 | $ cd a | |
854 | $ hg tip -q |
|
854 | $ hg tip -q | |
855 | 4:539e4b31b6dc |
|
855 | 4:539e4b31b6dc | |
856 | $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" commit -m "invisible" |
|
856 | $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" commit -m "invisible" | |
857 | transaction abort! |
|
857 | transaction abort! | |
858 | rollback completed |
|
858 | rollback completed | |
859 | abort: pretxnclose hook exited with status 1 |
|
859 | abort: pretxnclose hook exited with status 1 | |
860 | [255] |
|
860 | [255] | |
861 | $ cp .hg/store/00changelog.i.a.saved .hg/store/00changelog.i.a |
|
861 | $ cp .hg/store/00changelog.i.a.saved .hg/store/00changelog.i.a | |
862 |
|
862 | |||
863 | (check (in)visibility of new changeset while transaction running in |
|
863 | (check (in)visibility of new changeset while transaction running in | |
864 | repo) |
|
864 | repo) | |
865 |
|
865 | |||
866 | $ cat > $TESTTMP/checkpending.sh <<EOF |
|
866 | $ cat > $TESTTMP/checkpending.sh <<EOF | |
867 | > echo '@a' |
|
867 | > echo '@a' | |
868 | > hg -R "$TESTTMP/a" tip -q |
|
868 | > hg -R "$TESTTMP/a" tip -q | |
869 | > echo '@a/nested' |
|
869 | > echo '@a/nested' | |
870 | > hg -R "$TESTTMP/a/nested" tip -q |
|
870 | > hg -R "$TESTTMP/a/nested" tip -q | |
871 | > exit 1 # to avoid adding new revision for subsequent tests |
|
871 | > exit 1 # to avoid adding new revision for subsequent tests | |
872 | > EOF |
|
872 | > EOF | |
873 | $ hg init nested |
|
873 | $ hg init nested | |
874 | $ cd nested |
|
874 | $ cd nested | |
875 | $ echo a > a |
|
875 | $ echo a > a | |
876 | $ hg add a |
|
876 | $ hg add a | |
877 | $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" commit -m '#0' |
|
877 | $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" commit -m '#0' | |
878 | @a |
|
878 | @a | |
879 | 4:539e4b31b6dc |
|
879 | 4:539e4b31b6dc | |
880 | @a/nested |
|
880 | @a/nested | |
881 | 0:bf5e395ced2c |
|
881 | 0:bf5e395ced2c | |
882 | transaction abort! |
|
882 | transaction abort! | |
883 | rollback completed |
|
883 | rollback completed | |
884 | abort: pretxnclose hook exited with status 1 |
|
884 | abort: pretxnclose hook exited with status 1 | |
885 | [255] |
|
885 | [255] | |
886 |
|
886 | |||
887 | Hook from untrusted hgrc are reported as failure |
|
887 | Hook from untrusted hgrc are reported as failure | |
888 | ================================================ |
|
888 | ================================================ | |
889 |
|
889 | |||
890 | $ cat << EOF > $TESTTMP/untrusted.py |
|
890 | $ cat << EOF > $TESTTMP/untrusted.py | |
891 | > from mercurial import scmutil, util |
|
891 | > from mercurial import scmutil, util | |
892 | > def uisetup(ui): |
|
892 | > def uisetup(ui): | |
893 | > class untrustedui(ui.__class__): |
|
893 | > class untrustedui(ui.__class__): | |
894 | > def _trusted(self, fp, f): |
|
894 | > def _trusted(self, fp, f): | |
895 | > if util.normpath(fp.name).endswith(b'untrusted/.hg/hgrc'): |
|
895 | > if util.normpath(fp.name).endswith(b'untrusted/.hg/hgrc'): | |
896 | > return False |
|
896 | > return False | |
897 | > return super(untrustedui, self)._trusted(fp, f) |
|
897 | > return super(untrustedui, self)._trusted(fp, f) | |
898 | > ui.__class__ = untrustedui |
|
898 | > ui.__class__ = untrustedui | |
899 | > EOF |
|
899 | > EOF | |
900 | $ cat << EOF >> $HGRCPATH |
|
900 | $ cat << EOF >> $HGRCPATH | |
901 | > [extensions] |
|
901 | > [extensions] | |
902 | > untrusted=$TESTTMP/untrusted.py |
|
902 | > untrusted=$TESTTMP/untrusted.py | |
903 | > EOF |
|
903 | > EOF | |
904 | $ hg init untrusted |
|
904 | $ hg init untrusted | |
905 | $ cd untrusted |
|
905 | $ cd untrusted | |
906 |
|
906 | |||
907 | Non-blocking hook |
|
907 | Non-blocking hook | |
908 | ----------------- |
|
908 | ----------------- | |
909 |
|
909 | |||
910 | $ cat << EOF >> .hg/hgrc |
|
910 | $ cat << EOF >> .hg/hgrc | |
911 | > [hooks] |
|
911 | > [hooks] | |
912 | > txnclose.testing=echo txnclose hook called |
|
912 | > txnclose.testing=echo txnclose hook called | |
913 | > EOF |
|
913 | > EOF | |
914 | $ touch a && hg commit -Aqm a |
|
914 | $ touch a && hg commit -Aqm a | |
915 | warning: untrusted hook txnclose.testing not executed |
|
915 | warning: untrusted hook txnclose.testing not executed | |
916 | $ hg log |
|
916 | $ hg log | |
917 | changeset: 0:3903775176ed |
|
917 | changeset: 0:3903775176ed | |
918 | tag: tip |
|
918 | tag: tip | |
919 | user: test |
|
919 | user: test | |
920 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
920 | date: Thu Jan 01 00:00:00 1970 +0000 | |
921 | summary: a |
|
921 | summary: a | |
922 |
|
922 | |||
923 |
|
923 | |||
924 | Non-blocking hook |
|
924 | Non-blocking hook | |
925 | ----------------- |
|
925 | ----------------- | |
926 |
|
926 | |||
927 | $ cat << EOF >> .hg/hgrc |
|
927 | $ cat << EOF >> .hg/hgrc | |
928 | > [hooks] |
|
928 | > [hooks] | |
929 | > pretxnclose.testing=echo pre-txnclose hook called |
|
929 | > pretxnclose.testing=echo pre-txnclose hook called | |
930 | > EOF |
|
930 | > EOF | |
931 | $ touch b && hg commit -Aqm a |
|
931 | $ touch b && hg commit -Aqm a | |
932 | transaction abort! |
|
932 | transaction abort! | |
933 | rollback completed |
|
933 | rollback completed | |
934 | abort: untrusted hook pretxnclose.testing not executed |
|
934 | abort: untrusted hook pretxnclose.testing not executed | |
935 | (see 'hg help config.trusted') |
|
935 | (see 'hg help config.trusted') | |
936 | [255] |
|
936 | [255] | |
937 | $ hg log |
|
937 | $ hg log | |
938 | changeset: 0:3903775176ed |
|
938 | changeset: 0:3903775176ed | |
939 | tag: tip |
|
939 | tag: tip | |
940 | user: test |
|
940 | user: test | |
941 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
941 | date: Thu Jan 01 00:00:00 1970 +0000 | |
942 | summary: a |
|
942 | summary: a | |
943 |
|
943 |
General Comments 0
You need to be logged in to leave comments.
Login now