##// END OF EJS Templates
test-mq-qrefresh: drop single quoting of HGEDITOR value for Windows...
Matt Harbison -
r27055:5a0ffa24 default
parent child Browse files
Show More
@@ -1,326 +1,326 b''
1 Environment setup for MQ
1 Environment setup for MQ
2
2
3 $ echo "[extensions]" >> $HGRCPATH
3 $ echo "[extensions]" >> $HGRCPATH
4 $ echo "mq=" >> $HGRCPATH
4 $ echo "mq=" >> $HGRCPATH
5 $ cat >> $HGRCPATH <<EOF
5 $ cat >> $HGRCPATH <<EOF
6 > [defaults]
6 > [defaults]
7 > # explicit date to commit with fixed hashid
7 > # explicit date to commit with fixed hashid
8 > qnew = -d "0 0"
8 > qnew = -d "0 0"
9 > qrefresh = -d "0 0"
9 > qrefresh = -d "0 0"
10 > qfold = -d "0 0"
10 > qfold = -d "0 0"
11 > EOF
11 > EOF
12 $ hg init
12 $ hg init
13 $ hg qinit
13 $ hg qinit
14
14
15 Should fail if no patches applied
15 Should fail if no patches applied
16 (this tests also that editor is not invoked if '--edit' is not
16 (this tests also that editor is not invoked if '--edit' is not
17 specified)
17 specified)
18
18
19 $ hg qrefresh
19 $ hg qrefresh
20 no patches applied
20 no patches applied
21 [1]
21 [1]
22 $ hg qrefresh -e
22 $ hg qrefresh -e
23 no patches applied
23 no patches applied
24 [1]
24 [1]
25 $ hg qnew -m "First commit message" first-patch
25 $ hg qnew -m "First commit message" first-patch
26 $ echo aaaa > file
26 $ echo aaaa > file
27 $ hg add file
27 $ hg add file
28 $ HGEDITOR=cat hg qrefresh
28 $ HGEDITOR=cat hg qrefresh
29
29
30 Should display 'First commit message'
30 Should display 'First commit message'
31
31
32 $ hg log -l1 --template "{desc}\n"
32 $ hg log -l1 --template "{desc}\n"
33 First commit message
33 First commit message
34
34
35 Testing changing message with -m
35 Testing changing message with -m
36 (this tests also that '--edit' can be used with '--message', and
36 (this tests also that '--edit' can be used with '--message', and
37 that '[committemplate] changeset' definition and commit log specific
37 that '[committemplate] changeset' definition and commit log specific
38 template keyword 'extramsg' work well)
38 template keyword 'extramsg' work well)
39
39
40 $ cat >> .hg/hgrc <<EOF
40 $ cat >> .hg/hgrc <<EOF
41 > [committemplate]
41 > [committemplate]
42 > listupfiles = {file_adds %
42 > listupfiles = {file_adds %
43 > "HG: added {file}\n" }{file_mods %
43 > "HG: added {file}\n" }{file_mods %
44 > "HG: changed {file}\n" }{file_dels %
44 > "HG: changed {file}\n" }{file_dels %
45 > "HG: removed {file}\n" }{if(files, "",
45 > "HG: removed {file}\n" }{if(files, "",
46 > "HG: no files changed\n")}
46 > "HG: no files changed\n")}
47 >
47 >
48 > changeset = HG: this is customized commit template
48 > changeset = HG: this is customized commit template
49 > {desc}\n\n
49 > {desc}\n\n
50 > HG: Enter commit message. Lines beginning with 'HG:' are removed.
50 > HG: Enter commit message. Lines beginning with 'HG:' are removed.
51 > HG: {extramsg}
51 > HG: {extramsg}
52 > HG: --
52 > HG: --
53 > HG: user: {author}
53 > HG: user: {author}
54 > HG: branch '{branch}'\n{listupfiles}
54 > HG: branch '{branch}'\n{listupfiles}
55 > EOF
55 > EOF
56
56
57 $ echo bbbb > file
57 $ echo bbbb > file
58 $ HGEDITOR=cat hg qrefresh -m "Second commit message" -e
58 $ HGEDITOR=cat hg qrefresh -m "Second commit message" -e
59 HG: this is customized commit template
59 HG: this is customized commit template
60 Second commit message
60 Second commit message
61
61
62
62
63 HG: Enter commit message. Lines beginning with 'HG:' are removed.
63 HG: Enter commit message. Lines beginning with 'HG:' are removed.
64 HG: Leave message empty to use default message.
64 HG: Leave message empty to use default message.
65 HG: --
65 HG: --
66 HG: user: test
66 HG: user: test
67 HG: branch 'default'
67 HG: branch 'default'
68 HG: added file
68 HG: added file
69
69
70 $ cat >> .hg/hgrc <<EOF
70 $ cat >> .hg/hgrc <<EOF
71 > # disable customizing for subsequent tests
71 > # disable customizing for subsequent tests
72 > [committemplate]
72 > [committemplate]
73 > changeset =
73 > changeset =
74 > EOF
74 > EOF
75
75
76 Should display 'Second commit message'
76 Should display 'Second commit message'
77
77
78 $ hg log -l1 --template "{desc}\n"
78 $ hg log -l1 --template "{desc}\n"
79 Second commit message
79 Second commit message
80
80
81 Testing changing message with -l
81 Testing changing message with -l
82
82
83 $ echo "Third commit message" > logfile
83 $ echo "Third commit message" > logfile
84 $ echo " This is the 3rd log message" >> logfile
84 $ echo " This is the 3rd log message" >> logfile
85 $ echo bbbb > file
85 $ echo bbbb > file
86 $ hg qrefresh -l logfile
86 $ hg qrefresh -l logfile
87
87
88 Should display 'Third commit message\\\n This is the 3rd log message'
88 Should display 'Third commit message\\\n This is the 3rd log message'
89
89
90 $ hg log -l1 --template "{desc}\n"
90 $ hg log -l1 --template "{desc}\n"
91 Third commit message
91 Third commit message
92 This is the 3rd log message
92 This is the 3rd log message
93
93
94 Testing changing message with -l-
94 Testing changing message with -l-
95
95
96 $ hg qnew -m "First commit message" second-patch
96 $ hg qnew -m "First commit message" second-patch
97 $ echo aaaa > file2
97 $ echo aaaa > file2
98 $ hg add file2
98 $ hg add file2
99 $ echo bbbb > file2
99 $ echo bbbb > file2
100 $ (echo "Fifth commit message"; echo " This is the 5th log message") | hg qrefresh -l-
100 $ (echo "Fifth commit message"; echo " This is the 5th log message") | hg qrefresh -l-
101
101
102 Should display 'Fifth commit message\\\n This is the 5th log message'
102 Should display 'Fifth commit message\\\n This is the 5th log message'
103
103
104 $ hg log -l1 --template "{desc}\n"
104 $ hg log -l1 --template "{desc}\n"
105 Fifth commit message
105 Fifth commit message
106 This is the 5th log message
106 This is the 5th log message
107
107
108 Test saving last-message.txt:
108 Test saving last-message.txt:
109
109
110 $ cat > $TESTTMP/editor.sh << EOF
110 $ cat > $TESTTMP/editor.sh << EOF
111 > echo "==== before editing"
111 > echo "==== before editing"
112 > cat \$1
112 > cat \$1
113 > echo "===="
113 > echo "===="
114 > (echo; echo "test saving last-message.txt") >> \$1
114 > (echo; echo "test saving last-message.txt") >> \$1
115 > EOF
115 > EOF
116
116
117 $ cat > $TESTTMP/commitfailure.py <<EOF
117 $ cat > $TESTTMP/commitfailure.py <<EOF
118 > from mercurial import error
118 > from mercurial import error
119 > def reposetup(ui, repo):
119 > def reposetup(ui, repo):
120 > class commitfailure(repo.__class__):
120 > class commitfailure(repo.__class__):
121 > def commit(self, *args, **kwargs):
121 > def commit(self, *args, **kwargs):
122 > raise error.Abort('emulating unexpected abort')
122 > raise error.Abort('emulating unexpected abort')
123 > repo.__class__ = commitfailure
123 > repo.__class__ = commitfailure
124 > EOF
124 > EOF
125
125
126 $ cat >> .hg/hgrc <<EOF
126 $ cat >> .hg/hgrc <<EOF
127 > [extensions]
127 > [extensions]
128 > # this failure occurs before editor invocation
128 > # this failure occurs before editor invocation
129 > commitfailure = $TESTTMP/commitfailure.py
129 > commitfailure = $TESTTMP/commitfailure.py
130 > EOF
130 > EOF
131
131
132 $ hg qapplied
132 $ hg qapplied
133 first-patch
133 first-patch
134 second-patch
134 second-patch
135 $ hg tip --template "{files}\n"
135 $ hg tip --template "{files}\n"
136 file2
136 file2
137
137
138 (test that editor is not invoked before transaction starting)
138 (test that editor is not invoked before transaction starting)
139
139
140 $ rm -f .hg/last-message.txt
140 $ rm -f .hg/last-message.txt
141 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qrefresh -e
141 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qrefresh -e
142 qrefresh interrupted while patch was popped! (revert --all, qpush to recover)
142 qrefresh interrupted while patch was popped! (revert --all, qpush to recover)
143 abort: emulating unexpected abort
143 abort: emulating unexpected abort
144 [255]
144 [255]
145 $ test -f .hg/last-message.txt
145 $ test -f .hg/last-message.txt
146 [1]
146 [1]
147
147
148 (reset applied patches and directory status)
148 (reset applied patches and directory status)
149
149
150 $ cat >> .hg/hgrc <<EOF
150 $ cat >> .hg/hgrc <<EOF
151 > [extensions]
151 > [extensions]
152 > commitfailure = !
152 > commitfailure = !
153 > EOF
153 > EOF
154
154
155 $ hg qapplied
155 $ hg qapplied
156 first-patch
156 first-patch
157 $ hg status -A file2
157 $ hg status -A file2
158 ? file2
158 ? file2
159 $ rm file2
159 $ rm file2
160 $ hg qpush -q second-patch
160 $ hg qpush -q second-patch
161 now at: second-patch
161 now at: second-patch
162
162
163 (test that editor is invoked and commit message is saved into
163 (test that editor is invoked and commit message is saved into
164 "last-message.txt")
164 "last-message.txt")
165
165
166 $ cat >> .hg/hgrc <<EOF
166 $ cat >> .hg/hgrc <<EOF
167 > [hooks]
167 > [hooks]
168 > # this failure occurs after editor invocation
168 > # this failure occurs after editor invocation
169 > pretxncommit.unexpectedabort = false
169 > pretxncommit.unexpectedabort = false
170 > EOF
170 > EOF
171
171
172 $ rm -f .hg/last-message.txt
172 $ rm -f .hg/last-message.txt
173 $ hg status --rev "second-patch^1" -arm
173 $ hg status --rev "second-patch^1" -arm
174 A file2
174 A file2
175 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qrefresh -e
175 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qrefresh -e
176 ==== before editing
176 ==== before editing
177 Fifth commit message
177 Fifth commit message
178 This is the 5th log message
178 This is the 5th log message
179
179
180
180
181 HG: Enter commit message. Lines beginning with 'HG:' are removed.
181 HG: Enter commit message. Lines beginning with 'HG:' are removed.
182 HG: Leave message empty to use default message.
182 HG: Leave message empty to use default message.
183 HG: --
183 HG: --
184 HG: user: test
184 HG: user: test
185 HG: branch 'default'
185 HG: branch 'default'
186 HG: added file2
186 HG: added file2
187 ====
187 ====
188 note: commit message saved in .hg/last-message.txt
188 note: commit message saved in .hg/last-message.txt
189 transaction abort!
189 transaction abort!
190 rollback completed
190 rollback completed
191 qrefresh interrupted while patch was popped! (revert --all, qpush to recover)
191 qrefresh interrupted while patch was popped! (revert --all, qpush to recover)
192 abort: pretxncommit.unexpectedabort hook exited with status 1
192 abort: pretxncommit.unexpectedabort hook exited with status 1
193 [255]
193 [255]
194 $ cat .hg/last-message.txt
194 $ cat .hg/last-message.txt
195 Fifth commit message
195 Fifth commit message
196 This is the 5th log message
196 This is the 5th log message
197
197
198
198
199
199
200 test saving last-message.txt
200 test saving last-message.txt
201
201
202 Test visibility of in-memory distate changes outside transaction to
202 Test visibility of in-memory distate changes outside transaction to
203 external process
203 external process
204
204
205 $ cat > $TESTTMP/checkvisibility.sh <<EOF
205 $ cat > $TESTTMP/checkvisibility.sh <<EOF
206 > echo "===="
206 > echo "===="
207 > hg parents --template "{rev}:{node|short}\n"
207 > hg parents --template "{rev}:{node|short}\n"
208 > hg status -arm
208 > hg status -arm
209 > echo "===="
209 > echo "===="
210 > EOF
210 > EOF
211
211
212 == test visibility to external editor
212 == test visibility to external editor
213
213
214 $ hg update -C -q first-patch
214 $ hg update -C -q first-patch
215 $ rm -f file2
215 $ rm -f file2
216 $ hg qpush -q second-patch --config hooks.pretxncommit.unexpectedabort=
216 $ hg qpush -q second-patch --config hooks.pretxncommit.unexpectedabort=
217 now at: second-patch
217 now at: second-patch
218 $ echo bbbb >> file2
218 $ echo bbbb >> file2
219
219
220 $ sh "$TESTTMP/checkvisibility.sh"
220 $ sh "$TESTTMP/checkvisibility.sh"
221 ====
221 ====
222 1:e30108269082
222 1:e30108269082
223 M file2
223 M file2
224 ====
224 ====
225
225
226 $ HGEDITOR='sh "$TESTTMP/checkvisibility.sh"' hg qrefresh -e
226 $ HGEDITOR="sh \"$TESTTMP/checkvisibility.sh\"" hg qrefresh -e
227 ====
227 ====
228 0:25e397dabed2
228 0:25e397dabed2
229 A file2
229 A file2
230 ====
230 ====
231 note: commit message saved in .hg/last-message.txt
231 note: commit message saved in .hg/last-message.txt
232 transaction abort!
232 transaction abort!
233 rollback completed
233 rollback completed
234 qrefresh interrupted while patch was popped! (revert --all, qpush to recover)
234 qrefresh interrupted while patch was popped! (revert --all, qpush to recover)
235 abort: pretxncommit.unexpectedabort hook exited with status 1
235 abort: pretxncommit.unexpectedabort hook exited with status 1
236 [255]
236 [255]
237
237
238 (rebuilding at failure of qrefresh bases on rev #0, and it causes
238 (rebuilding at failure of qrefresh bases on rev #0, and it causes
239 dropping status of "file2")
239 dropping status of "file2")
240
240
241 $ sh "$TESTTMP/checkvisibility.sh"
241 $ sh "$TESTTMP/checkvisibility.sh"
242 ====
242 ====
243 0:25e397dabed2
243 0:25e397dabed2
244 ====
244 ====
245
245
246 == test visibility to precommit external hook
246 == test visibility to precommit external hook
247
247
248 $ hg update -C -q
248 $ hg update -C -q
249 $ rm -f file2
249 $ rm -f file2
250 $ hg qpush -q second-patch --config hooks.pretxncommit.unexpectedabort=
250 $ hg qpush -q second-patch --config hooks.pretxncommit.unexpectedabort=
251 now at: second-patch
251 now at: second-patch
252 $ echo bbbb >> file2
252 $ echo bbbb >> file2
253
253
254 $ cat >> .hg/hgrc <<EOF
254 $ cat >> .hg/hgrc <<EOF
255 > [hooks]
255 > [hooks]
256 > precommit.checkvisibility = sh "$TESTTMP/checkvisibility.sh"
256 > precommit.checkvisibility = sh "$TESTTMP/checkvisibility.sh"
257 > EOF
257 > EOF
258
258
259 $ sh "$TESTTMP/checkvisibility.sh"
259 $ sh "$TESTTMP/checkvisibility.sh"
260 ====
260 ====
261 1:e30108269082
261 1:e30108269082
262 M file2
262 M file2
263 ====
263 ====
264
264
265 $ hg qrefresh
265 $ hg qrefresh
266 ====
266 ====
267 0:25e397dabed2
267 0:25e397dabed2
268 A file2
268 A file2
269 ====
269 ====
270 transaction abort!
270 transaction abort!
271 rollback completed
271 rollback completed
272 qrefresh interrupted while patch was popped! (revert --all, qpush to recover)
272 qrefresh interrupted while patch was popped! (revert --all, qpush to recover)
273 abort: pretxncommit.unexpectedabort hook exited with status 1
273 abort: pretxncommit.unexpectedabort hook exited with status 1
274 [255]
274 [255]
275
275
276 $ sh "$TESTTMP/checkvisibility.sh"
276 $ sh "$TESTTMP/checkvisibility.sh"
277 ====
277 ====
278 0:25e397dabed2
278 0:25e397dabed2
279 ====
279 ====
280
280
281 $ cat >> .hg/hgrc <<EOF
281 $ cat >> .hg/hgrc <<EOF
282 > [hooks]
282 > [hooks]
283 > precommit.checkvisibility =
283 > precommit.checkvisibility =
284 > EOF
284 > EOF
285
285
286 == test visibility to pretxncommit external hook
286 == test visibility to pretxncommit external hook
287
287
288 $ hg update -C -q
288 $ hg update -C -q
289 $ rm -f file2
289 $ rm -f file2
290 $ hg qpush -q second-patch --config hooks.pretxncommit.unexpectedabort=
290 $ hg qpush -q second-patch --config hooks.pretxncommit.unexpectedabort=
291 now at: second-patch
291 now at: second-patch
292 $ echo bbbb >> file2
292 $ echo bbbb >> file2
293
293
294 $ cat >> .hg/hgrc <<EOF
294 $ cat >> .hg/hgrc <<EOF
295 > [hooks]
295 > [hooks]
296 > pretxncommit.checkvisibility = sh "$TESTTMP/checkvisibility.sh"
296 > pretxncommit.checkvisibility = sh "$TESTTMP/checkvisibility.sh"
297 > # make checkvisibility run before unexpectedabort
297 > # make checkvisibility run before unexpectedabort
298 > priority.pretxncommit.checkvisibility = 10
298 > priority.pretxncommit.checkvisibility = 10
299 > EOF
299 > EOF
300
300
301 $ sh "$TESTTMP/checkvisibility.sh"
301 $ sh "$TESTTMP/checkvisibility.sh"
302 ====
302 ====
303 1:e30108269082
303 1:e30108269082
304 M file2
304 M file2
305 ====
305 ====
306
306
307 $ hg qrefresh
307 $ hg qrefresh
308 ====
308 ====
309 0:25e397dabed2
309 0:25e397dabed2
310 A file2
310 A file2
311 ====
311 ====
312 transaction abort!
312 transaction abort!
313 rollback completed
313 rollback completed
314 qrefresh interrupted while patch was popped! (revert --all, qpush to recover)
314 qrefresh interrupted while patch was popped! (revert --all, qpush to recover)
315 abort: pretxncommit.unexpectedabort hook exited with status 1
315 abort: pretxncommit.unexpectedabort hook exited with status 1
316 [255]
316 [255]
317
317
318 $ sh "$TESTTMP/checkvisibility.sh"
318 $ sh "$TESTTMP/checkvisibility.sh"
319 ====
319 ====
320 0:25e397dabed2
320 0:25e397dabed2
321 ====
321 ====
322
322
323 $ cat >> .hg/hgrc <<EOF
323 $ cat >> .hg/hgrc <<EOF
324 > [hooks]
324 > [hooks]
325 > pretxncommit.checkvisibility =
325 > pretxncommit.checkvisibility =
326 > EOF
326 > EOF
General Comments 0
You need to be logged in to leave comments. Login now