##// END OF EJS Templates
tests: use TESTTMP instead of TESTDIR...
Sean Farley -
r20859:e259d4c4 stable
parent child Browse files
Show More
@@ -1,355 +1,355 b''
1 commit date test
1 commit date test
2
2
3 $ hg init test
3 $ hg init test
4 $ cd test
4 $ cd test
5 $ echo foo > foo
5 $ echo foo > foo
6 $ hg add foo
6 $ hg add foo
7 $ HGEDITOR=true hg commit -m ""
7 $ HGEDITOR=true hg commit -m ""
8 abort: empty commit message
8 abort: empty commit message
9 [255]
9 [255]
10 $ hg commit -d '0 0' -m commit-1
10 $ hg commit -d '0 0' -m commit-1
11 $ echo foo >> foo
11 $ echo foo >> foo
12 $ hg commit -d '1 4444444' -m commit-3
12 $ hg commit -d '1 4444444' -m commit-3
13 abort: impossible time zone offset: 4444444
13 abort: impossible time zone offset: 4444444
14 [255]
14 [255]
15 $ hg commit -d '1 15.1' -m commit-4
15 $ hg commit -d '1 15.1' -m commit-4
16 abort: invalid date: '1\t15.1'
16 abort: invalid date: '1\t15.1'
17 [255]
17 [255]
18 $ hg commit -d 'foo bar' -m commit-5
18 $ hg commit -d 'foo bar' -m commit-5
19 abort: invalid date: 'foo bar'
19 abort: invalid date: 'foo bar'
20 [255]
20 [255]
21 $ hg commit -d ' 1 4444' -m commit-6
21 $ hg commit -d ' 1 4444' -m commit-6
22 $ hg commit -d '111111111111 0' -m commit-7
22 $ hg commit -d '111111111111 0' -m commit-7
23 abort: date exceeds 32 bits: 111111111111
23 abort: date exceeds 32 bits: 111111111111
24 [255]
24 [255]
25 $ hg commit -d '-7654321 3600' -m commit-7
25 $ hg commit -d '-7654321 3600' -m commit-7
26 abort: negative date value: -7654321
26 abort: negative date value: -7654321
27 [255]
27 [255]
28
28
29 commit added file that has been deleted
29 commit added file that has been deleted
30
30
31 $ echo bar > bar
31 $ echo bar > bar
32 $ hg add bar
32 $ hg add bar
33 $ rm bar
33 $ rm bar
34 $ hg commit -m commit-8
34 $ hg commit -m commit-8
35 nothing changed (1 missing files, see 'hg status')
35 nothing changed (1 missing files, see 'hg status')
36 [1]
36 [1]
37 $ hg commit -m commit-8-2 bar
37 $ hg commit -m commit-8-2 bar
38 abort: bar: file not found!
38 abort: bar: file not found!
39 [255]
39 [255]
40
40
41 $ hg -q revert -a --no-backup
41 $ hg -q revert -a --no-backup
42
42
43 $ mkdir dir
43 $ mkdir dir
44 $ echo boo > dir/file
44 $ echo boo > dir/file
45 $ hg add
45 $ hg add
46 adding dir/file (glob)
46 adding dir/file (glob)
47 $ hg -v commit -m commit-9 dir
47 $ hg -v commit -m commit-9 dir
48 dir/file
48 dir/file
49 committed changeset 2:d2a76177cb42
49 committed changeset 2:d2a76177cb42
50
50
51 $ echo > dir.file
51 $ echo > dir.file
52 $ hg add
52 $ hg add
53 adding dir.file
53 adding dir.file
54 $ hg commit -m commit-10 dir dir.file
54 $ hg commit -m commit-10 dir dir.file
55 abort: dir: no match under directory!
55 abort: dir: no match under directory!
56 [255]
56 [255]
57
57
58 $ echo >> dir/file
58 $ echo >> dir/file
59 $ mkdir bleh
59 $ mkdir bleh
60 $ mkdir dir2
60 $ mkdir dir2
61 $ cd bleh
61 $ cd bleh
62 $ hg commit -m commit-11 .
62 $ hg commit -m commit-11 .
63 abort: bleh: no match under directory!
63 abort: bleh: no match under directory!
64 [255]
64 [255]
65 $ hg commit -m commit-12 ../dir ../dir2
65 $ hg commit -m commit-12 ../dir ../dir2
66 abort: dir2: no match under directory!
66 abort: dir2: no match under directory!
67 [255]
67 [255]
68 $ hg -v commit -m commit-13 ../dir
68 $ hg -v commit -m commit-13 ../dir
69 dir/file
69 dir/file
70 committed changeset 3:1cd62a2d8db5
70 committed changeset 3:1cd62a2d8db5
71 $ cd ..
71 $ cd ..
72
72
73 $ hg commit -m commit-14 does-not-exist
73 $ hg commit -m commit-14 does-not-exist
74 abort: does-not-exist: * (glob)
74 abort: does-not-exist: * (glob)
75 [255]
75 [255]
76
76
77 #if symlink
77 #if symlink
78 $ ln -s foo baz
78 $ ln -s foo baz
79 $ hg commit -m commit-15 baz
79 $ hg commit -m commit-15 baz
80 abort: baz: file not tracked!
80 abort: baz: file not tracked!
81 [255]
81 [255]
82 #endif
82 #endif
83
83
84 $ touch quux
84 $ touch quux
85 $ hg commit -m commit-16 quux
85 $ hg commit -m commit-16 quux
86 abort: quux: file not tracked!
86 abort: quux: file not tracked!
87 [255]
87 [255]
88 $ echo >> dir/file
88 $ echo >> dir/file
89 $ hg -v commit -m commit-17 dir/file
89 $ hg -v commit -m commit-17 dir/file
90 dir/file
90 dir/file
91 committed changeset 4:49176991390e
91 committed changeset 4:49176991390e
92
92
93 An empty date was interpreted as epoch origin
93 An empty date was interpreted as epoch origin
94
94
95 $ echo foo >> foo
95 $ echo foo >> foo
96 $ hg commit -d '' -m commit-no-date
96 $ hg commit -d '' -m commit-no-date
97 $ hg tip --template '{date|isodate}\n' | grep '1970'
97 $ hg tip --template '{date|isodate}\n' | grep '1970'
98 [1]
98 [1]
99
99
100 Make sure we do not obscure unknown requires file entries (issue2649)
100 Make sure we do not obscure unknown requires file entries (issue2649)
101
101
102 $ echo foo >> foo
102 $ echo foo >> foo
103 $ echo fake >> .hg/requires
103 $ echo fake >> .hg/requires
104 $ hg commit -m bla
104 $ hg commit -m bla
105 abort: unknown repository format: requires features 'fake' (upgrade Mercurial)!
105 abort: unknown repository format: requires features 'fake' (upgrade Mercurial)!
106 [255]
106 [255]
107
107
108 $ cd ..
108 $ cd ..
109
109
110
110
111 partial subdir commit test
111 partial subdir commit test
112
112
113 $ hg init test2
113 $ hg init test2
114 $ cd test2
114 $ cd test2
115 $ mkdir foo
115 $ mkdir foo
116 $ echo foo > foo/foo
116 $ echo foo > foo/foo
117 $ mkdir bar
117 $ mkdir bar
118 $ echo bar > bar/bar
118 $ echo bar > bar/bar
119 $ hg add
119 $ hg add
120 adding bar/bar (glob)
120 adding bar/bar (glob)
121 adding foo/foo (glob)
121 adding foo/foo (glob)
122 $ hg ci -m commit-subdir-1 foo
122 $ hg ci -m commit-subdir-1 foo
123 $ hg ci -m commit-subdir-2 bar
123 $ hg ci -m commit-subdir-2 bar
124
124
125 subdir log 1
125 subdir log 1
126
126
127 $ hg log -v foo
127 $ hg log -v foo
128 changeset: 0:f97e73a25882
128 changeset: 0:f97e73a25882
129 user: test
129 user: test
130 date: Thu Jan 01 00:00:00 1970 +0000
130 date: Thu Jan 01 00:00:00 1970 +0000
131 files: foo/foo
131 files: foo/foo
132 description:
132 description:
133 commit-subdir-1
133 commit-subdir-1
134
134
135
135
136
136
137 subdir log 2
137 subdir log 2
138
138
139 $ hg log -v bar
139 $ hg log -v bar
140 changeset: 1:aa809156d50d
140 changeset: 1:aa809156d50d
141 tag: tip
141 tag: tip
142 user: test
142 user: test
143 date: Thu Jan 01 00:00:00 1970 +0000
143 date: Thu Jan 01 00:00:00 1970 +0000
144 files: bar/bar
144 files: bar/bar
145 description:
145 description:
146 commit-subdir-2
146 commit-subdir-2
147
147
148
148
149
149
150 full log
150 full log
151
151
152 $ hg log -v
152 $ hg log -v
153 changeset: 1:aa809156d50d
153 changeset: 1:aa809156d50d
154 tag: tip
154 tag: tip
155 user: test
155 user: test
156 date: Thu Jan 01 00:00:00 1970 +0000
156 date: Thu Jan 01 00:00:00 1970 +0000
157 files: bar/bar
157 files: bar/bar
158 description:
158 description:
159 commit-subdir-2
159 commit-subdir-2
160
160
161
161
162 changeset: 0:f97e73a25882
162 changeset: 0:f97e73a25882
163 user: test
163 user: test
164 date: Thu Jan 01 00:00:00 1970 +0000
164 date: Thu Jan 01 00:00:00 1970 +0000
165 files: foo/foo
165 files: foo/foo
166 description:
166 description:
167 commit-subdir-1
167 commit-subdir-1
168
168
169
169
170 $ cd ..
170 $ cd ..
171
171
172
172
173 dot and subdir commit test
173 dot and subdir commit test
174
174
175 $ hg init test3
175 $ hg init test3
176 $ cd test3
176 $ cd test3
177 $ mkdir foo
177 $ mkdir foo
178 $ echo foo content > foo/plain-file
178 $ echo foo content > foo/plain-file
179 $ hg add foo/plain-file
179 $ hg add foo/plain-file
180 $ hg ci -m commit-foo-subdir foo
180 $ hg ci -m commit-foo-subdir foo
181 $ echo modified foo content > foo/plain-file
181 $ echo modified foo content > foo/plain-file
182 $ hg ci -m commit-foo-dot .
182 $ hg ci -m commit-foo-dot .
183
183
184 full log
184 full log
185
185
186 $ hg log -v
186 $ hg log -v
187 changeset: 1:95b38e3a5b2e
187 changeset: 1:95b38e3a5b2e
188 tag: tip
188 tag: tip
189 user: test
189 user: test
190 date: Thu Jan 01 00:00:00 1970 +0000
190 date: Thu Jan 01 00:00:00 1970 +0000
191 files: foo/plain-file
191 files: foo/plain-file
192 description:
192 description:
193 commit-foo-dot
193 commit-foo-dot
194
194
195
195
196 changeset: 0:65d4e9386227
196 changeset: 0:65d4e9386227
197 user: test
197 user: test
198 date: Thu Jan 01 00:00:00 1970 +0000
198 date: Thu Jan 01 00:00:00 1970 +0000
199 files: foo/plain-file
199 files: foo/plain-file
200 description:
200 description:
201 commit-foo-subdir
201 commit-foo-subdir
202
202
203
203
204
204
205 subdir log
205 subdir log
206
206
207 $ cd foo
207 $ cd foo
208 $ hg log .
208 $ hg log .
209 changeset: 1:95b38e3a5b2e
209 changeset: 1:95b38e3a5b2e
210 tag: tip
210 tag: tip
211 user: test
211 user: test
212 date: Thu Jan 01 00:00:00 1970 +0000
212 date: Thu Jan 01 00:00:00 1970 +0000
213 summary: commit-foo-dot
213 summary: commit-foo-dot
214
214
215 changeset: 0:65d4e9386227
215 changeset: 0:65d4e9386227
216 user: test
216 user: test
217 date: Thu Jan 01 00:00:00 1970 +0000
217 date: Thu Jan 01 00:00:00 1970 +0000
218 summary: commit-foo-subdir
218 summary: commit-foo-subdir
219
219
220 $ cd ..
220 $ cd ..
221 $ cd ..
221 $ cd ..
222
222
223 Issue1049: Hg permits partial commit of merge without warning
223 Issue1049: Hg permits partial commit of merge without warning
224
224
225 $ hg init issue1049
225 $ hg init issue1049
226 $ cd issue1049
226 $ cd issue1049
227 $ echo a > a
227 $ echo a > a
228 $ hg ci -Ama
228 $ hg ci -Ama
229 adding a
229 adding a
230 $ echo a >> a
230 $ echo a >> a
231 $ hg ci -mb
231 $ hg ci -mb
232 $ hg up 0
232 $ hg up 0
233 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
233 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
234 $ echo b >> a
234 $ echo b >> a
235 $ hg ci -mc
235 $ hg ci -mc
236 created new head
236 created new head
237 $ HGMERGE=true hg merge
237 $ HGMERGE=true hg merge
238 merging a
238 merging a
239 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
239 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
240 (branch merge, don't forget to commit)
240 (branch merge, don't forget to commit)
241
241
242 should fail because we are specifying a file name
242 should fail because we are specifying a file name
243
243
244 $ hg ci -mmerge a
244 $ hg ci -mmerge a
245 abort: cannot partially commit a merge (do not specify files or patterns)
245 abort: cannot partially commit a merge (do not specify files or patterns)
246 [255]
246 [255]
247
247
248 should fail because we are specifying a pattern
248 should fail because we are specifying a pattern
249
249
250 $ hg ci -mmerge -I a
250 $ hg ci -mmerge -I a
251 abort: cannot partially commit a merge (do not specify files or patterns)
251 abort: cannot partially commit a merge (do not specify files or patterns)
252 [255]
252 [255]
253
253
254 should succeed
254 should succeed
255
255
256 $ hg ci -mmerge
256 $ hg ci -mmerge
257 $ cd ..
257 $ cd ..
258
258
259
259
260 test commit message content
260 test commit message content
261
261
262 $ hg init commitmsg
262 $ hg init commitmsg
263 $ cd commitmsg
263 $ cd commitmsg
264 $ echo changed > changed
264 $ echo changed > changed
265 $ echo removed > removed
265 $ echo removed > removed
266 $ hg book currentbookmark
266 $ hg book currentbookmark
267 $ hg ci -qAm init
267 $ hg ci -qAm init
268
268
269 $ hg rm removed
269 $ hg rm removed
270 $ echo changed >> changed
270 $ echo changed >> changed
271 $ echo added > added
271 $ echo added > added
272 $ hg add added
272 $ hg add added
273 $ HGEDITOR=cat hg ci -A
273 $ HGEDITOR=cat hg ci -A
274
274
275
275
276 HG: Enter commit message. Lines beginning with 'HG:' are removed.
276 HG: Enter commit message. Lines beginning with 'HG:' are removed.
277 HG: Leave message empty to abort commit.
277 HG: Leave message empty to abort commit.
278 HG: --
278 HG: --
279 HG: user: test
279 HG: user: test
280 HG: branch 'default'
280 HG: branch 'default'
281 HG: bookmark 'currentbookmark'
281 HG: bookmark 'currentbookmark'
282 HG: added added
282 HG: added added
283 HG: changed changed
283 HG: changed changed
284 HG: removed removed
284 HG: removed removed
285 abort: empty commit message
285 abort: empty commit message
286 [255]
286 [255]
287
287
288 test saving last-message.txt
288 test saving last-message.txt
289
289
290 $ hg init sub
290 $ hg init sub
291 $ echo a > sub/a
291 $ echo a > sub/a
292 $ hg -R sub add sub/a
292 $ hg -R sub add sub/a
293 $ cat > sub/.hg/hgrc <<EOF
293 $ cat > sub/.hg/hgrc <<EOF
294 > [hooks]
294 > [hooks]
295 > precommit.test-saving-last-message = false
295 > precommit.test-saving-last-message = false
296 > EOF
296 > EOF
297
297
298 $ echo 'sub = sub' > .hgsub
298 $ echo 'sub = sub' > .hgsub
299 $ hg add .hgsub
299 $ hg add .hgsub
300
300
301 $ cat > $TESTDIR/editor.sh <<EOF
301 $ cat > $TESTTMP/editor.sh <<EOF
302 > echo "==== before editing:"
302 > echo "==== before editing:"
303 > cat \$1
303 > cat \$1
304 > echo "===="
304 > echo "===="
305 > echo "test saving last-message.txt" >> \$1
305 > echo "test saving last-message.txt" >> \$1
306 > EOF
306 > EOF
307
307
308 $ rm -f .hg/last-message.txt
308 $ rm -f .hg/last-message.txt
309 $ HGEDITOR="sh $TESTDIR/editor.sh" hg commit -S -q
309 $ HGEDITOR="sh $TESTTMP/editor.sh" hg commit -S -q
310 ==== before editing:
310 ==== before editing:
311
311
312
312
313 HG: Enter commit message. Lines beginning with 'HG:' are removed.
313 HG: Enter commit message. Lines beginning with 'HG:' are removed.
314 HG: Leave message empty to abort commit.
314 HG: Leave message empty to abort commit.
315 HG: --
315 HG: --
316 HG: user: test
316 HG: user: test
317 HG: branch 'default'
317 HG: branch 'default'
318 HG: bookmark 'currentbookmark'
318 HG: bookmark 'currentbookmark'
319 HG: subrepo sub
319 HG: subrepo sub
320 HG: added .hgsub
320 HG: added .hgsub
321 HG: added added
321 HG: added added
322 HG: changed .hgsubstate
322 HG: changed .hgsubstate
323 HG: changed changed
323 HG: changed changed
324 HG: removed removed
324 HG: removed removed
325 ====
325 ====
326 abort: precommit.test-saving-last-message hook exited with status 1 (in subrepo sub)
326 abort: precommit.test-saving-last-message hook exited with status 1 (in subrepo sub)
327 [255]
327 [255]
328 $ cat .hg/last-message.txt
328 $ cat .hg/last-message.txt
329
329
330
330
331 test saving last-message.txt
331 test saving last-message.txt
332
332
333 $ cd ..
333 $ cd ..
334
334
335
335
336 commit copy
336 commit copy
337
337
338 $ hg init dir2
338 $ hg init dir2
339 $ cd dir2
339 $ cd dir2
340 $ echo bleh > bar
340 $ echo bleh > bar
341 $ hg add bar
341 $ hg add bar
342 $ hg ci -m 'add bar'
342 $ hg ci -m 'add bar'
343
343
344 $ hg cp bar foo
344 $ hg cp bar foo
345 $ echo >> bar
345 $ echo >> bar
346 $ hg ci -m 'cp bar foo; change bar'
346 $ hg ci -m 'cp bar foo; change bar'
347
347
348 $ hg debugrename foo
348 $ hg debugrename foo
349 foo renamed from bar:26d3ca0dfd18e44d796b564e38dd173c9668d3a9
349 foo renamed from bar:26d3ca0dfd18e44d796b564e38dd173c9668d3a9
350 $ hg debugindex bar
350 $ hg debugindex bar
351 rev offset length ..... linkrev nodeid p1 p2 (re)
351 rev offset length ..... linkrev nodeid p1 p2 (re)
352 0 0 6 ..... 0 26d3ca0dfd18 000000000000 000000000000 (re)
352 0 0 6 ..... 0 26d3ca0dfd18 000000000000 000000000000 (re)
353 1 6 7 ..... 1 d267bddd54f7 26d3ca0dfd18 000000000000 (re)
353 1 6 7 ..... 1 d267bddd54f7 26d3ca0dfd18 000000000000 (re)
354
354
355 $ cd ..
355 $ cd ..
@@ -1,364 +1,364 b''
1 Test histedit extention: Fold commands
1 Test histedit extention: Fold commands
2 ======================================
2 ======================================
3
3
4 This test file is dedicated to testing the fold command in non conflicting
4 This test file is dedicated to testing the fold command in non conflicting
5 case.
5 case.
6
6
7 Initialization
7 Initialization
8 ---------------
8 ---------------
9
9
10
10
11 $ . "$TESTDIR/histedit-helpers.sh"
11 $ . "$TESTDIR/histedit-helpers.sh"
12
12
13 $ cat >> $HGRCPATH <<EOF
13 $ cat >> $HGRCPATH <<EOF
14 > [alias]
14 > [alias]
15 > logt = log --template '{rev}:{node|short} {desc|firstline}\n'
15 > logt = log --template '{rev}:{node|short} {desc|firstline}\n'
16 > [extensions]
16 > [extensions]
17 > histedit=
17 > histedit=
18 > EOF
18 > EOF
19
19
20
20
21 Simple folding
21 Simple folding
22 --------------------
22 --------------------
23 $ initrepo ()
23 $ initrepo ()
24 > {
24 > {
25 > hg init r
25 > hg init r
26 > cd r
26 > cd r
27 > for x in a b c d e f ; do
27 > for x in a b c d e f ; do
28 > echo $x > $x
28 > echo $x > $x
29 > hg add $x
29 > hg add $x
30 > hg ci -m $x
30 > hg ci -m $x
31 > done
31 > done
32 > }
32 > }
33
33
34 $ initrepo
34 $ initrepo
35
35
36 log before edit
36 log before edit
37 $ hg logt --graph
37 $ hg logt --graph
38 @ 5:652413bf663e f
38 @ 5:652413bf663e f
39 |
39 |
40 o 4:e860deea161a e
40 o 4:e860deea161a e
41 |
41 |
42 o 3:055a42cdd887 d
42 o 3:055a42cdd887 d
43 |
43 |
44 o 2:177f92b77385 c
44 o 2:177f92b77385 c
45 |
45 |
46 o 1:d2ae7f538514 b
46 o 1:d2ae7f538514 b
47 |
47 |
48 o 0:cb9a9f314b8b a
48 o 0:cb9a9f314b8b a
49
49
50
50
51 $ hg histedit 177f92b77385 --commands - 2>&1 <<EOF | fixbundle
51 $ hg histedit 177f92b77385 --commands - 2>&1 <<EOF | fixbundle
52 > pick e860deea161a e
52 > pick e860deea161a e
53 > pick 652413bf663e f
53 > pick 652413bf663e f
54 > fold 177f92b77385 c
54 > fold 177f92b77385 c
55 > pick 055a42cdd887 d
55 > pick 055a42cdd887 d
56 > EOF
56 > EOF
57 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
57 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
58 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
58 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
59 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
59 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
60 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
60 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
61 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
61 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
62 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
62 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
63 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
63 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
64
64
65 log after edit
65 log after edit
66 $ hg logt --graph
66 $ hg logt --graph
67 @ 4:9c277da72c9b d
67 @ 4:9c277da72c9b d
68 |
68 |
69 o 3:6de59d13424a f
69 o 3:6de59d13424a f
70 |
70 |
71 o 2:ee283cb5f2d5 e
71 o 2:ee283cb5f2d5 e
72 |
72 |
73 o 1:d2ae7f538514 b
73 o 1:d2ae7f538514 b
74 |
74 |
75 o 0:cb9a9f314b8b a
75 o 0:cb9a9f314b8b a
76
76
77
77
78 post-fold manifest
78 post-fold manifest
79 $ hg manifest
79 $ hg manifest
80 a
80 a
81 b
81 b
82 c
82 c
83 d
83 d
84 e
84 e
85 f
85 f
86
86
87
87
88 check histedit_source
88 check histedit_source
89
89
90 $ hg log --debug --rev 3
90 $ hg log --debug --rev 3
91 changeset: 3:6de59d13424a8a13acd3e975514aed29dd0d9b2d
91 changeset: 3:6de59d13424a8a13acd3e975514aed29dd0d9b2d
92 phase: draft
92 phase: draft
93 parent: 2:ee283cb5f2d5955443f23a27b697a04339e9a39a
93 parent: 2:ee283cb5f2d5955443f23a27b697a04339e9a39a
94 parent: -1:0000000000000000000000000000000000000000
94 parent: -1:0000000000000000000000000000000000000000
95 manifest: 3:81eede616954057198ead0b2c73b41d1f392829a
95 manifest: 3:81eede616954057198ead0b2c73b41d1f392829a
96 user: test
96 user: test
97 date: Thu Jan 01 00:00:00 1970 +0000
97 date: Thu Jan 01 00:00:00 1970 +0000
98 files+: c f
98 files+: c f
99 extra: branch=default
99 extra: branch=default
100 extra: histedit_source=a4f7421b80f79fcc59fff01bcbf4a53d127dd6d3,177f92b773850b59254aa5e923436f921b55483b
100 extra: histedit_source=a4f7421b80f79fcc59fff01bcbf4a53d127dd6d3,177f92b773850b59254aa5e923436f921b55483b
101 description:
101 description:
102 f
102 f
103 ***
103 ***
104 c
104 c
105
105
106
106
107
107
108 check saving last-message.txt
108 check saving last-message.txt
109
109
110 $ cat > $TESTDIR/abortfolding.py <<EOF
110 $ cat > $TESTTMP/abortfolding.py <<EOF
111 > from mercurial import util
111 > from mercurial import util
112 > def abortfolding(ui, repo, hooktype, **kwargs):
112 > def abortfolding(ui, repo, hooktype, **kwargs):
113 > ctx = repo[kwargs.get('node')]
113 > ctx = repo[kwargs.get('node')]
114 > if set(ctx.files()) == set(['c', 'd', 'f']):
114 > if set(ctx.files()) == set(['c', 'd', 'f']):
115 > return True # abort folding commit only
115 > return True # abort folding commit only
116 > ui.warn('allow non-folding commit\\n')
116 > ui.warn('allow non-folding commit\\n')
117 > EOF
117 > EOF
118 $ cat > .hg/hgrc <<EOF
118 $ cat > .hg/hgrc <<EOF
119 > [hooks]
119 > [hooks]
120 > pretxncommit.abortfolding = python:$TESTDIR/abortfolding.py:abortfolding
120 > pretxncommit.abortfolding = python:$TESTTMP/abortfolding.py:abortfolding
121 > EOF
121 > EOF
122
122
123 $ cat > $TESTDIR/editor.sh << EOF
123 $ cat > $TESTTMP/editor.sh << EOF
124 > echo "==== before editing"
124 > echo "==== before editing"
125 > cat \$1
125 > cat \$1
126 > echo "===="
126 > echo "===="
127 > echo "check saving last-message.txt" >> \$1
127 > echo "check saving last-message.txt" >> \$1
128 > EOF
128 > EOF
129
129
130 $ rm -f .hg/last-message.txt
130 $ rm -f .hg/last-message.txt
131 $ HGEDITOR="sh $TESTDIR/editor.sh" hg histedit 6de59d13424a --commands - 2>&1 <<EOF | fixbundle
131 $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit 6de59d13424a --commands - 2>&1 <<EOF | fixbundle
132 > pick 6de59d13424a f
132 > pick 6de59d13424a f
133 > fold 9c277da72c9b d
133 > fold 9c277da72c9b d
134 > EOF
134 > EOF
135 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
135 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
136 allow non-folding commit
136 allow non-folding commit
137 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
137 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
138 ==== before editing
138 ==== before editing
139 f
139 f
140 ***
140 ***
141 c
141 c
142 ***
142 ***
143 d
143 d
144
144
145
145
146
146
147 HG: Enter commit message. Lines beginning with 'HG:' are removed.
147 HG: Enter commit message. Lines beginning with 'HG:' are removed.
148 HG: Leave message empty to abort commit.
148 HG: Leave message empty to abort commit.
149 HG: --
149 HG: --
150 HG: user: test
150 HG: user: test
151 HG: branch 'default'
151 HG: branch 'default'
152 HG: changed c
152 HG: changed c
153 HG: changed d
153 HG: changed d
154 HG: changed f
154 HG: changed f
155 ====
155 ====
156 transaction abort!
156 transaction abort!
157 rollback completed
157 rollback completed
158 abort: pretxncommit.abortfolding hook failed
158 abort: pretxncommit.abortfolding hook failed
159
159
160 $ cat .hg/last-message.txt
160 $ cat .hg/last-message.txt
161 f
161 f
162 ***
162 ***
163 c
163 c
164 ***
164 ***
165 d
165 d
166
166
167
167
168
168
169 check saving last-message.txt
169 check saving last-message.txt
170
170
171 $ cd ..
171 $ cd ..
172
172
173 folding and creating no new change doesn't break:
173 folding and creating no new change doesn't break:
174 -------------------------------------------------
174 -------------------------------------------------
175
175
176 folded content is dropped during a merge. The folded commit should properly disapear.
176 folded content is dropped during a merge. The folded commit should properly disapear.
177
177
178 $ mkdir fold-to-empty-test
178 $ mkdir fold-to-empty-test
179 $ cd fold-to-empty-test
179 $ cd fold-to-empty-test
180 $ hg init
180 $ hg init
181 $ printf "1\n2\n3\n" > file
181 $ printf "1\n2\n3\n" > file
182 $ hg add file
182 $ hg add file
183 $ hg commit -m '1+2+3'
183 $ hg commit -m '1+2+3'
184 $ echo 4 >> file
184 $ echo 4 >> file
185 $ hg commit -m '+4'
185 $ hg commit -m '+4'
186 $ echo 5 >> file
186 $ echo 5 >> file
187 $ hg commit -m '+5'
187 $ hg commit -m '+5'
188 $ echo 6 >> file
188 $ echo 6 >> file
189 $ hg commit -m '+6'
189 $ hg commit -m '+6'
190 $ hg logt --graph
190 $ hg logt --graph
191 @ 3:251d831eeec5 +6
191 @ 3:251d831eeec5 +6
192 |
192 |
193 o 2:888f9082bf99 +5
193 o 2:888f9082bf99 +5
194 |
194 |
195 o 1:617f94f13c0f +4
195 o 1:617f94f13c0f +4
196 |
196 |
197 o 0:0189ba417d34 1+2+3
197 o 0:0189ba417d34 1+2+3
198
198
199
199
200 $ hg histedit 1 --commands - << EOF
200 $ hg histedit 1 --commands - << EOF
201 > pick 617f94f13c0f 1 +4
201 > pick 617f94f13c0f 1 +4
202 > drop 888f9082bf99 2 +5
202 > drop 888f9082bf99 2 +5
203 > fold 251d831eeec5 3 +6
203 > fold 251d831eeec5 3 +6
204 > EOF
204 > EOF
205 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
205 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
206 merging file
206 merging file
207 warning: conflicts during merge.
207 warning: conflicts during merge.
208 merging file incomplete! (edit conflicts, then use 'hg resolve --mark')
208 merging file incomplete! (edit conflicts, then use 'hg resolve --mark')
209 Fix up the change and run hg histedit --continue
209 Fix up the change and run hg histedit --continue
210 [1]
210 [1]
211 There were conflicts, we keep P1 content. This
211 There were conflicts, we keep P1 content. This
212 should effectively drop the changes from +6.
212 should effectively drop the changes from +6.
213 $ hg status
213 $ hg status
214 M file
214 M file
215 ? file.orig
215 ? file.orig
216 $ hg resolve -l
216 $ hg resolve -l
217 U file
217 U file
218 $ hg revert -r 'p1()' file
218 $ hg revert -r 'p1()' file
219 $ hg resolve --mark file
219 $ hg resolve --mark file
220 $ hg histedit --continue
220 $ hg histedit --continue
221 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
221 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
222 saved backup bundle to $TESTTMP/*-backup.hg (glob)
222 saved backup bundle to $TESTTMP/*-backup.hg (glob)
223 $ hg logt --graph
223 $ hg logt --graph
224 @ 1:617f94f13c0f +4
224 @ 1:617f94f13c0f +4
225 |
225 |
226 o 0:0189ba417d34 1+2+3
226 o 0:0189ba417d34 1+2+3
227
227
228
228
229 $ cd ..
229 $ cd ..
230
230
231
231
232 Test fold through dropped
232 Test fold through dropped
233 -------------------------
233 -------------------------
234
234
235
235
236 Test corner case where folded revision is separated from its parent by a
236 Test corner case where folded revision is separated from its parent by a
237 dropped revision.
237 dropped revision.
238
238
239
239
240 $ hg init fold-with-dropped
240 $ hg init fold-with-dropped
241 $ cd fold-with-dropped
241 $ cd fold-with-dropped
242 $ printf "1\n2\n3\n" > file
242 $ printf "1\n2\n3\n" > file
243 $ hg commit -Am '1+2+3'
243 $ hg commit -Am '1+2+3'
244 adding file
244 adding file
245 $ echo 4 >> file
245 $ echo 4 >> file
246 $ hg commit -m '+4'
246 $ hg commit -m '+4'
247 $ echo 5 >> file
247 $ echo 5 >> file
248 $ hg commit -m '+5'
248 $ hg commit -m '+5'
249 $ echo 6 >> file
249 $ echo 6 >> file
250 $ hg commit -m '+6'
250 $ hg commit -m '+6'
251 $ hg logt -G
251 $ hg logt -G
252 @ 3:251d831eeec5 +6
252 @ 3:251d831eeec5 +6
253 |
253 |
254 o 2:888f9082bf99 +5
254 o 2:888f9082bf99 +5
255 |
255 |
256 o 1:617f94f13c0f +4
256 o 1:617f94f13c0f +4
257 |
257 |
258 o 0:0189ba417d34 1+2+3
258 o 0:0189ba417d34 1+2+3
259
259
260 $ hg histedit 1 --commands - << EOF
260 $ hg histedit 1 --commands - << EOF
261 > pick 617f94f13c0f 1 +4
261 > pick 617f94f13c0f 1 +4
262 > drop 888f9082bf99 2 +5
262 > drop 888f9082bf99 2 +5
263 > fold 251d831eeec5 3 +6
263 > fold 251d831eeec5 3 +6
264 > EOF
264 > EOF
265 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
265 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
266 merging file
266 merging file
267 warning: conflicts during merge.
267 warning: conflicts during merge.
268 merging file incomplete! (edit conflicts, then use 'hg resolve --mark')
268 merging file incomplete! (edit conflicts, then use 'hg resolve --mark')
269 Fix up the change and run hg histedit --continue
269 Fix up the change and run hg histedit --continue
270 [1]
270 [1]
271 $ cat > file << EOF
271 $ cat > file << EOF
272 > 1
272 > 1
273 > 2
273 > 2
274 > 3
274 > 3
275 > 4
275 > 4
276 > 5
276 > 5
277 > EOF
277 > EOF
278 $ hg resolve --mark file
278 $ hg resolve --mark file
279 $ hg commit -m '+5.2'
279 $ hg commit -m '+5.2'
280 created new head
280 created new head
281 $ echo 6 >> file
281 $ echo 6 >> file
282 $ HGEDITOR=cat hg histedit --continue
282 $ HGEDITOR=cat hg histedit --continue
283 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
283 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
284 +4
284 +4
285 ***
285 ***
286 +5.2
286 +5.2
287 ***
287 ***
288 +6
288 +6
289
289
290
290
291
291
292 HG: Enter commit message. Lines beginning with 'HG:' are removed.
292 HG: Enter commit message. Lines beginning with 'HG:' are removed.
293 HG: Leave message empty to abort commit.
293 HG: Leave message empty to abort commit.
294 HG: --
294 HG: --
295 HG: user: test
295 HG: user: test
296 HG: branch 'default'
296 HG: branch 'default'
297 HG: changed file
297 HG: changed file
298 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
298 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
299 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
299 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
300 saved backup bundle to $TESTTMP/fold-with-dropped/.hg/strip-backup/617f94f13c0f-backup.hg (glob)
300 saved backup bundle to $TESTTMP/fold-with-dropped/.hg/strip-backup/617f94f13c0f-backup.hg (glob)
301 $ hg logt -G
301 $ hg logt -G
302 @ 1:10c647b2cdd5 +4
302 @ 1:10c647b2cdd5 +4
303 |
303 |
304 o 0:0189ba417d34 1+2+3
304 o 0:0189ba417d34 1+2+3
305
305
306 $ hg export tip
306 $ hg export tip
307 # HG changeset patch
307 # HG changeset patch
308 # User test
308 # User test
309 # Date 0 0
309 # Date 0 0
310 # Thu Jan 01 00:00:00 1970 +0000
310 # Thu Jan 01 00:00:00 1970 +0000
311 # Node ID 10c647b2cdd54db0603ecb99b2ff5ce66d5a5323
311 # Node ID 10c647b2cdd54db0603ecb99b2ff5ce66d5a5323
312 # Parent 0189ba417d34df9dda55f88b637dcae9917b5964
312 # Parent 0189ba417d34df9dda55f88b637dcae9917b5964
313 +4
313 +4
314 ***
314 ***
315 +5.2
315 +5.2
316 ***
316 ***
317 +6
317 +6
318
318
319 diff -r 0189ba417d34 -r 10c647b2cdd5 file
319 diff -r 0189ba417d34 -r 10c647b2cdd5 file
320 --- a/file Thu Jan 01 00:00:00 1970 +0000
320 --- a/file Thu Jan 01 00:00:00 1970 +0000
321 +++ b/file Thu Jan 01 00:00:00 1970 +0000
321 +++ b/file Thu Jan 01 00:00:00 1970 +0000
322 @@ -1,3 +1,6 @@
322 @@ -1,3 +1,6 @@
323 1
323 1
324 2
324 2
325 3
325 3
326 +4
326 +4
327 +5
327 +5
328 +6
328 +6
329 $ cd ..
329 $ cd ..
330
330
331
331
332 Folding with initial rename (issue3729)
332 Folding with initial rename (issue3729)
333 ---------------------------------------
333 ---------------------------------------
334
334
335 $ hg init fold-rename
335 $ hg init fold-rename
336 $ cd fold-rename
336 $ cd fold-rename
337 $ echo a > a.txt
337 $ echo a > a.txt
338 $ hg add a.txt
338 $ hg add a.txt
339 $ hg commit -m a
339 $ hg commit -m a
340 $ hg rename a.txt b.txt
340 $ hg rename a.txt b.txt
341 $ hg commit -m rename
341 $ hg commit -m rename
342 $ echo b >> b.txt
342 $ echo b >> b.txt
343 $ hg commit -m b
343 $ hg commit -m b
344
344
345 $ hg logt --follow b.txt
345 $ hg logt --follow b.txt
346 2:e0371e0426bc b
346 2:e0371e0426bc b
347 1:1c4f440a8085 rename
347 1:1c4f440a8085 rename
348 0:6c795aa153cb a
348 0:6c795aa153cb a
349
349
350 $ hg histedit 1c4f440a8085 --commands - 2>&1 << EOF | fixbundle
350 $ hg histedit 1c4f440a8085 --commands - 2>&1 << EOF | fixbundle
351 > pick 1c4f440a8085 rename
351 > pick 1c4f440a8085 rename
352 > fold e0371e0426bc b
352 > fold e0371e0426bc b
353 > EOF
353 > EOF
354 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
354 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
355 reverting b.txt
355 reverting b.txt
356 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
356 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
357 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
357 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
358 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
358 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
359
359
360 $ hg logt --follow b.txt
360 $ hg logt --follow b.txt
361 1:cf858d235c76 rename
361 1:cf858d235c76 rename
362 0:6c795aa153cb a
362 0:6c795aa153cb a
363
363
364 $ cd ..
364 $ cd ..
@@ -1,180 +1,180 b''
1 $ echo "[extensions]" >> $HGRCPATH
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
3 $ echo "[mq]" >> $HGRCPATH
3 $ echo "[mq]" >> $HGRCPATH
4 $ echo "git=keep" >> $HGRCPATH
4 $ echo "git=keep" >> $HGRCPATH
5 $ echo "[diff]" >> $HGRCPATH
5 $ echo "[diff]" >> $HGRCPATH
6 $ echo "nodates=1" >> $HGRCPATH
6 $ echo "nodates=1" >> $HGRCPATH
7
7
8 init:
8 init:
9
9
10 $ hg init repo
10 $ hg init repo
11 $ cd repo
11 $ cd repo
12 $ echo a > a
12 $ echo a > a
13 $ hg ci -Am adda
13 $ hg ci -Am adda
14 adding a
14 adding a
15 $ echo a >> a
15 $ echo a >> a
16 $ hg qnew -f p1
16 $ hg qnew -f p1
17 $ echo b >> a
17 $ echo b >> a
18 $ hg qnew -f p2
18 $ hg qnew -f p2
19 $ echo c >> a
19 $ echo c >> a
20 $ hg qnew -f p3
20 $ hg qnew -f p3
21
21
22 Fold in the middle of the queue:
22 Fold in the middle of the queue:
23
23
24 $ hg qpop p1
24 $ hg qpop p1
25 popping p3
25 popping p3
26 popping p2
26 popping p2
27 now at: p1
27 now at: p1
28
28
29 $ hg qdiff
29 $ hg qdiff
30 diff -r 07f494440405 a
30 diff -r 07f494440405 a
31 --- a/a
31 --- a/a
32 +++ b/a
32 +++ b/a
33 @@ -1,1 +1,2 @@
33 @@ -1,1 +1,2 @@
34 a
34 a
35 +a
35 +a
36
36
37 $ hg qfold p2
37 $ hg qfold p2
38 $ grep git .hg/patches/p1 && echo 'git patch found!'
38 $ grep git .hg/patches/p1 && echo 'git patch found!'
39 [1]
39 [1]
40
40
41 $ hg qser
41 $ hg qser
42 p1
42 p1
43 p3
43 p3
44
44
45 $ hg qdiff
45 $ hg qdiff
46 diff -r 07f494440405 a
46 diff -r 07f494440405 a
47 --- a/a
47 --- a/a
48 +++ b/a
48 +++ b/a
49 @@ -1,1 +1,3 @@
49 @@ -1,1 +1,3 @@
50 a
50 a
51 +a
51 +a
52 +b
52 +b
53
53
54 Fold with local changes:
54 Fold with local changes:
55
55
56 $ echo d >> a
56 $ echo d >> a
57 $ hg qfold p3
57 $ hg qfold p3
58 abort: local changes found, refresh first
58 abort: local changes found, refresh first
59 [255]
59 [255]
60
60
61 $ hg diff -c .
61 $ hg diff -c .
62 diff -r 07f494440405 -r ???????????? a (glob)
62 diff -r 07f494440405 -r ???????????? a (glob)
63 --- a/a
63 --- a/a
64 +++ b/a
64 +++ b/a
65 @@ -1,1 +1,3 @@
65 @@ -1,1 +1,3 @@
66 a
66 a
67 +a
67 +a
68 +b
68 +b
69
69
70 $ hg revert -a --no-backup
70 $ hg revert -a --no-backup
71 reverting a
71 reverting a
72
72
73 Fold git patch into a regular patch, expect git patch:
73 Fold git patch into a regular patch, expect git patch:
74
74
75 $ echo a >> a
75 $ echo a >> a
76 $ hg qnew -f regular
76 $ hg qnew -f regular
77 $ hg cp a aa
77 $ hg cp a aa
78 $ hg qnew --git -f git
78 $ hg qnew --git -f git
79
79
80 $ hg qpop
80 $ hg qpop
81 popping git
81 popping git
82 now at: regular
82 now at: regular
83
83
84 $ hg qfold git
84 $ hg qfold git
85
85
86 $ cat .hg/patches/regular
86 $ cat .hg/patches/regular
87 # HG changeset patch
87 # HG changeset patch
88 # Parent ???????????????????????????????????????? (glob)
88 # Parent ???????????????????????????????????????? (glob)
89
89
90 diff --git a/a b/a
90 diff --git a/a b/a
91 --- a/a
91 --- a/a
92 +++ b/a
92 +++ b/a
93 @@ -1,3 +1,4 @@
93 @@ -1,3 +1,4 @@
94 a
94 a
95 a
95 a
96 b
96 b
97 +a
97 +a
98 diff --git a/a b/aa
98 diff --git a/a b/aa
99 copy from a
99 copy from a
100 copy to aa
100 copy to aa
101 --- a/a
101 --- a/a
102 +++ b/aa
102 +++ b/aa
103 @@ -1,3 +1,4 @@
103 @@ -1,3 +1,4 @@
104 a
104 a
105 a
105 a
106 b
106 b
107 +a
107 +a
108
108
109 $ hg qpop
109 $ hg qpop
110 popping regular
110 popping regular
111 now at: p1
111 now at: p1
112
112
113 $ hg qdel regular
113 $ hg qdel regular
114
114
115 Fold regular patch into a git patch, expect git patch:
115 Fold regular patch into a git patch, expect git patch:
116
116
117 $ hg cp a aa
117 $ hg cp a aa
118 $ hg qnew --git -f git
118 $ hg qnew --git -f git
119 $ echo b >> aa
119 $ echo b >> aa
120 $ hg qnew -f regular
120 $ hg qnew -f regular
121
121
122 $ hg qpop
122 $ hg qpop
123 popping regular
123 popping regular
124 now at: git
124 now at: git
125
125
126 $ hg qfold regular
126 $ hg qfold regular
127
127
128 $ cat .hg/patches/git
128 $ cat .hg/patches/git
129 # HG changeset patch
129 # HG changeset patch
130 # Parent ???????????????????????????????????????? (glob)
130 # Parent ???????????????????????????????????????? (glob)
131
131
132 diff --git a/a b/aa
132 diff --git a/a b/aa
133 copy from a
133 copy from a
134 copy to aa
134 copy to aa
135 --- a/a
135 --- a/a
136 +++ b/aa
136 +++ b/aa
137 @@ -1,3 +1,4 @@
137 @@ -1,3 +1,4 @@
138 a
138 a
139 a
139 a
140 b
140 b
141 +b
141 +b
142
142
143 Test saving last-message.txt:
143 Test saving last-message.txt:
144
144
145 $ hg qrefresh -m "original message"
145 $ hg qrefresh -m "original message"
146
146
147 $ cat > $TESTDIR/commitfailure.py <<EOF
147 $ cat > $TESTTMP/commitfailure.py <<EOF
148 > from mercurial import util
148 > from mercurial import util
149 > def reposetup(ui, repo):
149 > def reposetup(ui, repo):
150 > class commitfailure(repo.__class__):
150 > class commitfailure(repo.__class__):
151 > def commit(self, *args, **kwargs):
151 > def commit(self, *args, **kwargs):
152 > raise util.Abort('emulating unexpected abort')
152 > raise util.Abort('emulating unexpected abort')
153 > repo.__class__ = commitfailure
153 > repo.__class__ = commitfailure
154 > EOF
154 > EOF
155
155
156 $ cat > .hg/hgrc <<EOF
156 $ cat > .hg/hgrc <<EOF
157 > [extensions]
157 > [extensions]
158 > commitfailure = $TESTDIR/commitfailure.py
158 > commitfailure = $TESTTMP/commitfailure.py
159 > EOF
159 > EOF
160
160
161 $ cat > $TESTDIR/editor.sh << EOF
161 $ cat > $TESTTMP/editor.sh << EOF
162 > echo "==== before editing"
162 > echo "==== before editing"
163 > cat \$1
163 > cat \$1
164 > echo "===="
164 > echo "===="
165 > (echo; echo "test saving last-message.txt") >> \$1
165 > (echo; echo "test saving last-message.txt") >> \$1
166 > EOF
166 > EOF
167
167
168 $ rm -f .hg/last-message.txt
168 $ rm -f .hg/last-message.txt
169 $ HGEDITOR="sh $TESTDIR/editor.sh" hg qfold -e p3
169 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qfold -e p3
170 ==== before editing
170 ==== before editing
171 original message====
171 original message====
172 refresh interrupted while patch was popped! (revert --all, qpush to recover)
172 refresh interrupted while patch was popped! (revert --all, qpush to recover)
173 abort: emulating unexpected abort
173 abort: emulating unexpected abort
174 [255]
174 [255]
175 $ cat .hg/last-message.txt
175 $ cat .hg/last-message.txt
176 original message
176 original message
177 test saving last-message.txt
177 test saving last-message.txt
178
178
179 $ cd ..
179 $ cd ..
180
180
@@ -1,271 +1,271 b''
1
1
2 $ catpatch() {
2 $ catpatch() {
3 > cat $1 | sed -e "s/^\(# Parent \).*/\1/"
3 > cat $1 | sed -e "s/^\(# Parent \).*/\1/"
4 > }
4 > }
5 $ echo "[extensions]" >> $HGRCPATH
5 $ echo "[extensions]" >> $HGRCPATH
6 $ echo "mq=" >> $HGRCPATH
6 $ echo "mq=" >> $HGRCPATH
7 $ runtest() {
7 $ runtest() {
8 > hg init mq
8 > hg init mq
9 > cd mq
9 > cd mq
10 >
10 >
11 > echo a > a
11 > echo a > a
12 > hg ci -Ama
12 > hg ci -Ama
13 >
13 >
14 > echo '% qnew should refuse bad patch names'
14 > echo '% qnew should refuse bad patch names'
15 > hg qnew series
15 > hg qnew series
16 > hg qnew status
16 > hg qnew status
17 > hg qnew guards
17 > hg qnew guards
18 > hg qnew .
18 > hg qnew .
19 > hg qnew ..
19 > hg qnew ..
20 > hg qnew .hgignore
20 > hg qnew .hgignore
21 > hg qnew .mqfoo
21 > hg qnew .mqfoo
22 > hg qnew 'foo#bar'
22 > hg qnew 'foo#bar'
23 > hg qnew 'foo:bar'
23 > hg qnew 'foo:bar'
24 >
24 >
25 > hg qinit -c
25 > hg qinit -c
26 >
26 >
27 > echo '% qnew with name containing slash'
27 > echo '% qnew with name containing slash'
28 > hg qnew foo/
28 > hg qnew foo/
29 > hg qnew foo/bar.patch
29 > hg qnew foo/bar.patch
30 > hg qnew foo
30 > hg qnew foo
31 > hg qseries
31 > hg qseries
32 > hg qpop
32 > hg qpop
33 > hg qdelete foo/bar.patch
33 > hg qdelete foo/bar.patch
34 >
34 >
35 > echo '% qnew with uncommitted changes'
35 > echo '% qnew with uncommitted changes'
36 > echo a > somefile
36 > echo a > somefile
37 > hg add somefile
37 > hg add somefile
38 > hg qnew uncommitted.patch
38 > hg qnew uncommitted.patch
39 > hg st
39 > hg st
40 > hg qseries
40 > hg qseries
41 >
41 >
42 > echo '% qnew implies add'
42 > echo '% qnew implies add'
43 > hg -R .hg/patches st
43 > hg -R .hg/patches st
44 >
44 >
45 > echo '% qnew missing'
45 > echo '% qnew missing'
46 > hg qnew missing.patch missing
46 > hg qnew missing.patch missing
47 >
47 >
48 > echo '% qnew -m'
48 > echo '% qnew -m'
49 > hg qnew -m 'foo bar' mtest.patch
49 > hg qnew -m 'foo bar' mtest.patch
50 > catpatch .hg/patches/mtest.patch
50 > catpatch .hg/patches/mtest.patch
51 >
51 >
52 > echo '% qnew twice'
52 > echo '% qnew twice'
53 > hg qnew first.patch
53 > hg qnew first.patch
54 > hg qnew first.patch
54 > hg qnew first.patch
55 >
55 >
56 > touch ../first.patch
56 > touch ../first.patch
57 > hg qimport ../first.patch
57 > hg qimport ../first.patch
58 >
58 >
59 > echo '% qnew -f from a subdirectory'
59 > echo '% qnew -f from a subdirectory'
60 > hg qpop -a
60 > hg qpop -a
61 > mkdir d
61 > mkdir d
62 > cd d
62 > cd d
63 > echo b > b
63 > echo b > b
64 > hg ci -Am t
64 > hg ci -Am t
65 > echo b >> b
65 > echo b >> b
66 > hg st
66 > hg st
67 > hg qnew -g -f p
67 > hg qnew -g -f p
68 > catpatch ../.hg/patches/p
68 > catpatch ../.hg/patches/p
69 >
69 >
70 > echo '% qnew -u with no username configured'
70 > echo '% qnew -u with no username configured'
71 > HGUSER= hg qnew -u blue red
71 > HGUSER= hg qnew -u blue red
72 > catpatch ../.hg/patches/red
72 > catpatch ../.hg/patches/red
73 >
73 >
74 > echo '% qnew -e -u with no username configured'
74 > echo '% qnew -e -u with no username configured'
75 > HGUSER= hg qnew -e -u chartreuse fucsia
75 > HGUSER= hg qnew -e -u chartreuse fucsia
76 > catpatch ../.hg/patches/fucsia
76 > catpatch ../.hg/patches/fucsia
77 >
77 >
78 > echo '% fail when trying to import a merge'
78 > echo '% fail when trying to import a merge'
79 > hg init merge
79 > hg init merge
80 > cd merge
80 > cd merge
81 > touch a
81 > touch a
82 > hg ci -Am null
82 > hg ci -Am null
83 > echo a >> a
83 > echo a >> a
84 > hg ci -m a
84 > hg ci -m a
85 > hg up -r 0
85 > hg up -r 0
86 > echo b >> a
86 > echo b >> a
87 > hg ci -m b
87 > hg ci -m b
88 > hg merge -f 1
88 > hg merge -f 1
89 > hg resolve --mark a
89 > hg resolve --mark a
90 > hg qnew -f merge
90 > hg qnew -f merge
91 >
91 >
92 > cd ../../..
92 > cd ../../..
93 > rm -r mq
93 > rm -r mq
94 > }
94 > }
95
95
96 plain headers
96 plain headers
97
97
98 $ echo "[mq]" >> $HGRCPATH
98 $ echo "[mq]" >> $HGRCPATH
99 $ echo "plain=true" >> $HGRCPATH
99 $ echo "plain=true" >> $HGRCPATH
100 $ mkdir sandbox
100 $ mkdir sandbox
101 $ (cd sandbox ; runtest)
101 $ (cd sandbox ; runtest)
102 adding a
102 adding a
103 % qnew should refuse bad patch names
103 % qnew should refuse bad patch names
104 abort: "series" cannot be used as the name of a patch
104 abort: "series" cannot be used as the name of a patch
105 abort: "status" cannot be used as the name of a patch
105 abort: "status" cannot be used as the name of a patch
106 abort: "guards" cannot be used as the name of a patch
106 abort: "guards" cannot be used as the name of a patch
107 abort: "." cannot be used as the name of a patch
107 abort: "." cannot be used as the name of a patch
108 abort: ".." cannot be used as the name of a patch
108 abort: ".." cannot be used as the name of a patch
109 abort: patch name cannot begin with ".hg"
109 abort: patch name cannot begin with ".hg"
110 abort: patch name cannot begin with ".mq"
110 abort: patch name cannot begin with ".mq"
111 abort: "#" cannot be used in the name of a patch
111 abort: "#" cannot be used in the name of a patch
112 abort: ":" cannot be used in the name of a patch
112 abort: ":" cannot be used in the name of a patch
113 % qnew with name containing slash
113 % qnew with name containing slash
114 abort: path ends in directory separator: foo/ (glob)
114 abort: path ends in directory separator: foo/ (glob)
115 abort: "foo" already exists as a directory
115 abort: "foo" already exists as a directory
116 foo/bar.patch
116 foo/bar.patch
117 popping foo/bar.patch
117 popping foo/bar.patch
118 patch queue now empty
118 patch queue now empty
119 % qnew with uncommitted changes
119 % qnew with uncommitted changes
120 uncommitted.patch
120 uncommitted.patch
121 % qnew implies add
121 % qnew implies add
122 A .hgignore
122 A .hgignore
123 A series
123 A series
124 A uncommitted.patch
124 A uncommitted.patch
125 % qnew missing
125 % qnew missing
126 abort: missing: * (glob)
126 abort: missing: * (glob)
127 % qnew -m
127 % qnew -m
128 foo bar
128 foo bar
129
129
130 % qnew twice
130 % qnew twice
131 abort: patch "first.patch" already exists
131 abort: patch "first.patch" already exists
132 abort: patch "first.patch" already exists
132 abort: patch "first.patch" already exists
133 % qnew -f from a subdirectory
133 % qnew -f from a subdirectory
134 popping first.patch
134 popping first.patch
135 popping mtest.patch
135 popping mtest.patch
136 popping uncommitted.patch
136 popping uncommitted.patch
137 patch queue now empty
137 patch queue now empty
138 adding d/b
138 adding d/b
139 M d/b
139 M d/b
140 diff --git a/d/b b/d/b
140 diff --git a/d/b b/d/b
141 --- a/d/b
141 --- a/d/b
142 +++ b/d/b
142 +++ b/d/b
143 @@ -1,1 +1,2 @@
143 @@ -1,1 +1,2 @@
144 b
144 b
145 +b
145 +b
146 % qnew -u with no username configured
146 % qnew -u with no username configured
147 From: blue
147 From: blue
148
148
149 % qnew -e -u with no username configured
149 % qnew -e -u with no username configured
150 From: chartreuse
150 From: chartreuse
151
151
152 % fail when trying to import a merge
152 % fail when trying to import a merge
153 adding a
153 adding a
154 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
154 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
155 created new head
155 created new head
156 merging a
156 merging a
157 warning: conflicts during merge.
157 warning: conflicts during merge.
158 merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
158 merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
159 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
159 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
160 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
160 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
161 abort: cannot manage merge changesets
161 abort: cannot manage merge changesets
162 $ rm -r sandbox
162 $ rm -r sandbox
163
163
164 hg headers
164 hg headers
165
165
166 $ echo "plain=false" >> $HGRCPATH
166 $ echo "plain=false" >> $HGRCPATH
167 $ mkdir sandbox
167 $ mkdir sandbox
168 $ (cd sandbox ; runtest)
168 $ (cd sandbox ; runtest)
169 adding a
169 adding a
170 % qnew should refuse bad patch names
170 % qnew should refuse bad patch names
171 abort: "series" cannot be used as the name of a patch
171 abort: "series" cannot be used as the name of a patch
172 abort: "status" cannot be used as the name of a patch
172 abort: "status" cannot be used as the name of a patch
173 abort: "guards" cannot be used as the name of a patch
173 abort: "guards" cannot be used as the name of a patch
174 abort: "." cannot be used as the name of a patch
174 abort: "." cannot be used as the name of a patch
175 abort: ".." cannot be used as the name of a patch
175 abort: ".." cannot be used as the name of a patch
176 abort: patch name cannot begin with ".hg"
176 abort: patch name cannot begin with ".hg"
177 abort: patch name cannot begin with ".mq"
177 abort: patch name cannot begin with ".mq"
178 abort: "#" cannot be used in the name of a patch
178 abort: "#" cannot be used in the name of a patch
179 abort: ":" cannot be used in the name of a patch
179 abort: ":" cannot be used in the name of a patch
180 % qnew with name containing slash
180 % qnew with name containing slash
181 abort: path ends in directory separator: foo/ (glob)
181 abort: path ends in directory separator: foo/ (glob)
182 abort: "foo" already exists as a directory
182 abort: "foo" already exists as a directory
183 foo/bar.patch
183 foo/bar.patch
184 popping foo/bar.patch
184 popping foo/bar.patch
185 patch queue now empty
185 patch queue now empty
186 % qnew with uncommitted changes
186 % qnew with uncommitted changes
187 uncommitted.patch
187 uncommitted.patch
188 % qnew implies add
188 % qnew implies add
189 A .hgignore
189 A .hgignore
190 A series
190 A series
191 A uncommitted.patch
191 A uncommitted.patch
192 % qnew missing
192 % qnew missing
193 abort: missing: * (glob)
193 abort: missing: * (glob)
194 % qnew -m
194 % qnew -m
195 # HG changeset patch
195 # HG changeset patch
196 # Parent
196 # Parent
197 foo bar
197 foo bar
198
198
199 % qnew twice
199 % qnew twice
200 abort: patch "first.patch" already exists
200 abort: patch "first.patch" already exists
201 abort: patch "first.patch" already exists
201 abort: patch "first.patch" already exists
202 % qnew -f from a subdirectory
202 % qnew -f from a subdirectory
203 popping first.patch
203 popping first.patch
204 popping mtest.patch
204 popping mtest.patch
205 popping uncommitted.patch
205 popping uncommitted.patch
206 patch queue now empty
206 patch queue now empty
207 adding d/b
207 adding d/b
208 M d/b
208 M d/b
209 # HG changeset patch
209 # HG changeset patch
210 # Parent
210 # Parent
211 diff --git a/d/b b/d/b
211 diff --git a/d/b b/d/b
212 --- a/d/b
212 --- a/d/b
213 +++ b/d/b
213 +++ b/d/b
214 @@ -1,1 +1,2 @@
214 @@ -1,1 +1,2 @@
215 b
215 b
216 +b
216 +b
217 % qnew -u with no username configured
217 % qnew -u with no username configured
218 # HG changeset patch
218 # HG changeset patch
219 # Parent
219 # Parent
220 # User blue
220 # User blue
221 % qnew -e -u with no username configured
221 % qnew -e -u with no username configured
222 # HG changeset patch
222 # HG changeset patch
223 # Parent
223 # Parent
224 # User chartreuse
224 # User chartreuse
225 % fail when trying to import a merge
225 % fail when trying to import a merge
226 adding a
226 adding a
227 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
227 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
228 created new head
228 created new head
229 merging a
229 merging a
230 warning: conflicts during merge.
230 warning: conflicts during merge.
231 merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
231 merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
232 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
232 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
233 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
233 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
234 abort: cannot manage merge changesets
234 abort: cannot manage merge changesets
235 $ rm -r sandbox
235 $ rm -r sandbox
236
236
237 Test saving last-message.txt
237 Test saving last-message.txt
238
238
239 $ hg init repo
239 $ hg init repo
240 $ cd repo
240 $ cd repo
241
241
242 $ cat > $TESTDIR/commitfailure.py <<EOF
242 $ cat > $TESTTMP/commitfailure.py <<EOF
243 > from mercurial import util
243 > from mercurial import util
244 > def reposetup(ui, repo):
244 > def reposetup(ui, repo):
245 > class commitfailure(repo.__class__):
245 > class commitfailure(repo.__class__):
246 > def commit(self, *args, **kwargs):
246 > def commit(self, *args, **kwargs):
247 > raise util.Abort('emulating unexpected abort')
247 > raise util.Abort('emulating unexpected abort')
248 > repo.__class__ = commitfailure
248 > repo.__class__ = commitfailure
249 > EOF
249 > EOF
250 $ cat > .hg/hgrc <<EOF
250 $ cat > .hg/hgrc <<EOF
251 > [extensions]
251 > [extensions]
252 > commitfailure = $TESTDIR/commitfailure.py
252 > commitfailure = $TESTTMP/commitfailure.py
253 > EOF
253 > EOF
254
254
255 $ cat > $TESTDIR/editor.sh << EOF
255 $ cat > $TESTTMP/editor.sh << EOF
256 > echo "==== before editing"
256 > echo "==== before editing"
257 > cat \$1
257 > cat \$1
258 > echo "===="
258 > echo "===="
259 > echo "test saving last-message.txt" >> \$1
259 > echo "test saving last-message.txt" >> \$1
260 > EOF
260 > EOF
261
261
262 $ rm -f .hg/last-message.txt
262 $ rm -f .hg/last-message.txt
263 $ HGEDITOR="sh $TESTDIR/editor.sh" hg qnew -e patch
263 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qnew -e patch
264 ==== before editing
264 ==== before editing
265 ====
265 ====
266 abort: emulating unexpected abort
266 abort: emulating unexpected abort
267 [255]
267 [255]
268 $ cat .hg/last-message.txt
268 $ cat .hg/last-message.txt
269 test saving last-message.txt
269 test saving last-message.txt
270
270
271 $ cd ..
271 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now