##// END OF EJS Templates
histedit: add test that an invalid editor doesn't bork client state...
Augie Fackler -
r45177:bca57ad9 default
parent child Browse files
Show More
@@ -1,303 +1,306 b''
1 $ . "$TESTDIR/histedit-helpers.sh"
1 $ . "$TESTDIR/histedit-helpers.sh"
2
2
3 $ cat >> $HGRCPATH <<EOF
3 $ cat >> $HGRCPATH <<EOF
4 > [extensions]
4 > [extensions]
5 > histedit=
5 > histedit=
6 > EOF
6 > EOF
7
7
8 $ initrepo ()
8 $ initrepo ()
9 > {
9 > {
10 > hg init $1
10 > hg init $1
11 > cd $1
11 > cd $1
12 > for x in a b c d e f ; do
12 > for x in a b c d e f ; do
13 > echo $x$x$x$x$x > $x
13 > echo $x$x$x$x$x > $x
14 > hg add $x
14 > hg add $x
15 > done
15 > done
16 > hg ci -m 'Initial commit'
16 > hg ci -m 'Initial commit'
17 > for x in a b c d e f ; do
17 > for x in a b c d e f ; do
18 > echo $x > $x
18 > echo $x > $x
19 > hg ci -m $x
19 > hg ci -m $x
20 > done
20 > done
21 > echo 'I can haz no commute' > e
21 > echo 'I can haz no commute' > e
22 > hg ci -m 'does not commute with e'
22 > hg ci -m 'does not commute with e'
23 > cd ..
23 > cd ..
24 > }
24 > }
25
25
26 $ initrepo r1
26 $ initrepo r1
27 $ cd r1
27 $ cd r1
28
28
29 Initial generation of the command files
29 Initial generation of the command files
30
30
31 $ EDITED="$TESTTMP/editedhistory"
31 $ EDITED="$TESTTMP/editedhistory"
32 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 3 >> $EDITED
32 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 3 >> $EDITED
33 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 4 >> $EDITED
33 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 4 >> $EDITED
34 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 7 >> $EDITED
34 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 7 >> $EDITED
35 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 5 >> $EDITED
35 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 5 >> $EDITED
36 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 6 >> $EDITED
36 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 6 >> $EDITED
37 $ cat $EDITED
37 $ cat $EDITED
38 pick 65a9a84f33fd 3 c
38 pick 65a9a84f33fd 3 c
39 pick 00f1c5383965 4 d
39 pick 00f1c5383965 4 d
40 pick 39522b764e3d 7 does not commute with e
40 pick 39522b764e3d 7 does not commute with e
41 pick 7b4e2f4b7bcd 5 e
41 pick 7b4e2f4b7bcd 5 e
42 pick 500cac37a696 6 f
42 pick 500cac37a696 6 f
43
43
44 log before edit
44 log before edit
45 $ hg log --graph
45 $ hg log --graph
46 @ changeset: 7:39522b764e3d
46 @ changeset: 7:39522b764e3d
47 | tag: tip
47 | tag: tip
48 | user: test
48 | user: test
49 | date: Thu Jan 01 00:00:00 1970 +0000
49 | date: Thu Jan 01 00:00:00 1970 +0000
50 | summary: does not commute with e
50 | summary: does not commute with e
51 |
51 |
52 o changeset: 6:500cac37a696
52 o changeset: 6:500cac37a696
53 | user: test
53 | user: test
54 | date: Thu Jan 01 00:00:00 1970 +0000
54 | date: Thu Jan 01 00:00:00 1970 +0000
55 | summary: f
55 | summary: f
56 |
56 |
57 o changeset: 5:7b4e2f4b7bcd
57 o changeset: 5:7b4e2f4b7bcd
58 | user: test
58 | user: test
59 | date: Thu Jan 01 00:00:00 1970 +0000
59 | date: Thu Jan 01 00:00:00 1970 +0000
60 | summary: e
60 | summary: e
61 |
61 |
62 o changeset: 4:00f1c5383965
62 o changeset: 4:00f1c5383965
63 | user: test
63 | user: test
64 | date: Thu Jan 01 00:00:00 1970 +0000
64 | date: Thu Jan 01 00:00:00 1970 +0000
65 | summary: d
65 | summary: d
66 |
66 |
67 o changeset: 3:65a9a84f33fd
67 o changeset: 3:65a9a84f33fd
68 | user: test
68 | user: test
69 | date: Thu Jan 01 00:00:00 1970 +0000
69 | date: Thu Jan 01 00:00:00 1970 +0000
70 | summary: c
70 | summary: c
71 |
71 |
72 o changeset: 2:da6535b52e45
72 o changeset: 2:da6535b52e45
73 | user: test
73 | user: test
74 | date: Thu Jan 01 00:00:00 1970 +0000
74 | date: Thu Jan 01 00:00:00 1970 +0000
75 | summary: b
75 | summary: b
76 |
76 |
77 o changeset: 1:c1f09da44841
77 o changeset: 1:c1f09da44841
78 | user: test
78 | user: test
79 | date: Thu Jan 01 00:00:00 1970 +0000
79 | date: Thu Jan 01 00:00:00 1970 +0000
80 | summary: a
80 | summary: a
81 |
81 |
82 o changeset: 0:1715188a53c7
82 o changeset: 0:1715188a53c7
83 user: test
83 user: test
84 date: Thu Jan 01 00:00:00 1970 +0000
84 date: Thu Jan 01 00:00:00 1970 +0000
85 summary: Initial commit
85 summary: Initial commit
86
86
87
87
88 edit the history
88 edit the history
89 $ hg histedit 3 --commands $EDITED 2>&1 | fixbundle
89 $ hg histedit 3 --commands $EDITED 2>&1 | fixbundle
90 merging e
90 merging e
91 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
91 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
92 Fix up the change (pick 39522b764e3d)
92 Fix up the change (pick 39522b764e3d)
93 (hg histedit --continue to resume)
93 (hg histedit --continue to resume)
94
94
95 abort the edit
95 abort the edit
96 $ hg histedit --abort 2>&1 | fixbundle
96 $ hg histedit --abort 2>&1 | fixbundle
97 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
97 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
98
98
99
99
100 second edit set
100 second edit set
101
101
102 $ hg log --graph
102 $ hg log --graph
103 @ changeset: 7:39522b764e3d
103 @ changeset: 7:39522b764e3d
104 | tag: tip
104 | tag: tip
105 | user: test
105 | user: test
106 | date: Thu Jan 01 00:00:00 1970 +0000
106 | date: Thu Jan 01 00:00:00 1970 +0000
107 | summary: does not commute with e
107 | summary: does not commute with e
108 |
108 |
109 o changeset: 6:500cac37a696
109 o changeset: 6:500cac37a696
110 | user: test
110 | user: test
111 | date: Thu Jan 01 00:00:00 1970 +0000
111 | date: Thu Jan 01 00:00:00 1970 +0000
112 | summary: f
112 | summary: f
113 |
113 |
114 o changeset: 5:7b4e2f4b7bcd
114 o changeset: 5:7b4e2f4b7bcd
115 | user: test
115 | user: test
116 | date: Thu Jan 01 00:00:00 1970 +0000
116 | date: Thu Jan 01 00:00:00 1970 +0000
117 | summary: e
117 | summary: e
118 |
118 |
119 o changeset: 4:00f1c5383965
119 o changeset: 4:00f1c5383965
120 | user: test
120 | user: test
121 | date: Thu Jan 01 00:00:00 1970 +0000
121 | date: Thu Jan 01 00:00:00 1970 +0000
122 | summary: d
122 | summary: d
123 |
123 |
124 o changeset: 3:65a9a84f33fd
124 o changeset: 3:65a9a84f33fd
125 | user: test
125 | user: test
126 | date: Thu Jan 01 00:00:00 1970 +0000
126 | date: Thu Jan 01 00:00:00 1970 +0000
127 | summary: c
127 | summary: c
128 |
128 |
129 o changeset: 2:da6535b52e45
129 o changeset: 2:da6535b52e45
130 | user: test
130 | user: test
131 | date: Thu Jan 01 00:00:00 1970 +0000
131 | date: Thu Jan 01 00:00:00 1970 +0000
132 | summary: b
132 | summary: b
133 |
133 |
134 o changeset: 1:c1f09da44841
134 o changeset: 1:c1f09da44841
135 | user: test
135 | user: test
136 | date: Thu Jan 01 00:00:00 1970 +0000
136 | date: Thu Jan 01 00:00:00 1970 +0000
137 | summary: a
137 | summary: a
138 |
138 |
139 o changeset: 0:1715188a53c7
139 o changeset: 0:1715188a53c7
140 user: test
140 user: test
141 date: Thu Jan 01 00:00:00 1970 +0000
141 date: Thu Jan 01 00:00:00 1970 +0000
142 summary: Initial commit
142 summary: Initial commit
143
143
144
144
145 edit the history
145 edit the history
146 $ hg histedit 3 --commands $EDITED 2>&1 | fixbundle
146 $ hg histedit 3 --commands $EDITED 2>&1 | fixbundle
147 merging e
147 merging e
148 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
148 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
149 Fix up the change (pick 39522b764e3d)
149 Fix up the change (pick 39522b764e3d)
150 (hg histedit --continue to resume)
150 (hg histedit --continue to resume)
151
151
152 fix up
152 fix up
153 $ echo 'I can haz no commute' > e
153 $ echo 'I can haz no commute' > e
154 $ hg resolve --mark e
154 $ hg resolve --mark e
155 (no more unresolved files)
155 (no more unresolved files)
156 continue: hg histedit --continue
156 continue: hg histedit --continue
157 $ hg histedit --continue 2>&1 | fixbundle
157 $ hg histedit --continue 2>&1 | fixbundle
158 merging e
158 merging e
159 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
159 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
160 Fix up the change (pick 7b4e2f4b7bcd)
160 Fix up the change (pick 7b4e2f4b7bcd)
161 (hg histedit --continue to resume)
161 (hg histedit --continue to resume)
162 We forcibly enable curses here so we can verify that continuing works
162 We forcibly enable curses here so we can verify that continuing works
163 with curses enabled.
163 with curses enabled.
164 $ hg histedit --continue --config ui.interactive=true \
164 $ hg histedit --continue --config ui.interactive=true \
165 > --config ui.interface=curses 2>&1 | fixbundle
165 > --config ui.interface=curses 2>&1 | fixbundle
166 abort: unresolved merge conflicts (see 'hg help resolve')
166 abort: unresolved merge conflicts (see 'hg help resolve')
167
167
168 This failure is caused by 7b4e2f4b7bcd "e" not rebasing the non commutative
168 This failure is caused by 7b4e2f4b7bcd "e" not rebasing the non commutative
169 former children.
169 former children.
170
170
171 just continue this time
171 just continue this time
172 $ hg revert -r 'p1()' e
172 $ hg revert -r 'p1()' e
173 make sure the to-be-empty commit doesn't screw up the state (issue5545)
173 make sure the to-be-empty commit doesn't screw up the state (issue5545)
174 $ hg histedit --continue 2>&1 | fixbundle
174 $ hg histedit --continue 2>&1 | fixbundle
175 abort: unresolved merge conflicts (see 'hg help resolve')
175 abort: unresolved merge conflicts (see 'hg help resolve')
176 $ hg resolve --mark e
176 $ hg resolve --mark e
177 (no more unresolved files)
177 (no more unresolved files)
178 continue: hg histedit --continue
178 continue: hg histedit --continue
179 $ hg histedit --continue 2>&1 | fixbundle
179 $ hg histedit --continue 2>&1 | fixbundle
180 7b4e2f4b7bcd: skipping changeset (no changes)
180 7b4e2f4b7bcd: skipping changeset (no changes)
181
181
182 log after edit
182 log after edit
183 $ hg log --graph
183 $ hg log --graph
184 @ changeset: 6:7efe1373e4bc
184 @ changeset: 6:7efe1373e4bc
185 | tag: tip
185 | tag: tip
186 | user: test
186 | user: test
187 | date: Thu Jan 01 00:00:00 1970 +0000
187 | date: Thu Jan 01 00:00:00 1970 +0000
188 | summary: f
188 | summary: f
189 |
189 |
190 o changeset: 5:e334d87a1e55
190 o changeset: 5:e334d87a1e55
191 | user: test
191 | user: test
192 | date: Thu Jan 01 00:00:00 1970 +0000
192 | date: Thu Jan 01 00:00:00 1970 +0000
193 | summary: does not commute with e
193 | summary: does not commute with e
194 |
194 |
195 o changeset: 4:00f1c5383965
195 o changeset: 4:00f1c5383965
196 | user: test
196 | user: test
197 | date: Thu Jan 01 00:00:00 1970 +0000
197 | date: Thu Jan 01 00:00:00 1970 +0000
198 | summary: d
198 | summary: d
199 |
199 |
200 o changeset: 3:65a9a84f33fd
200 o changeset: 3:65a9a84f33fd
201 | user: test
201 | user: test
202 | date: Thu Jan 01 00:00:00 1970 +0000
202 | date: Thu Jan 01 00:00:00 1970 +0000
203 | summary: c
203 | summary: c
204 |
204 |
205 o changeset: 2:da6535b52e45
205 o changeset: 2:da6535b52e45
206 | user: test
206 | user: test
207 | date: Thu Jan 01 00:00:00 1970 +0000
207 | date: Thu Jan 01 00:00:00 1970 +0000
208 | summary: b
208 | summary: b
209 |
209 |
210 o changeset: 1:c1f09da44841
210 o changeset: 1:c1f09da44841
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: a
213 | summary: a
214 |
214 |
215 o changeset: 0:1715188a53c7
215 o changeset: 0:1715188a53c7
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: Initial commit
218 summary: Initial commit
219
219
220
220
221 start over
221 start over
222
222
223 $ cd ..
223 $ cd ..
224
224
225 $ initrepo r2
225 $ initrepo r2
226 $ cd r2
226 $ cd r2
227 $ rm $EDITED
227 $ rm $EDITED
228 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 3 >> $EDITED
228 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 3 >> $EDITED
229 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 4 >> $EDITED
229 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 4 >> $EDITED
230 $ hg log --template 'mess {node|short} {rev} {desc}\n' -r 7 >> $EDITED
230 $ hg log --template 'mess {node|short} {rev} {desc}\n' -r 7 >> $EDITED
231 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 5 >> $EDITED
231 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 5 >> $EDITED
232 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 6 >> $EDITED
232 $ hg log --template 'pick {node|short} {rev} {desc}\n' -r 6 >> $EDITED
233 $ cat $EDITED
233 $ cat $EDITED
234 pick 65a9a84f33fd 3 c
234 pick 65a9a84f33fd 3 c
235 pick 00f1c5383965 4 d
235 pick 00f1c5383965 4 d
236 mess 39522b764e3d 7 does not commute with e
236 mess 39522b764e3d 7 does not commute with e
237 pick 7b4e2f4b7bcd 5 e
237 pick 7b4e2f4b7bcd 5 e
238 pick 500cac37a696 6 f
238 pick 500cac37a696 6 f
239
239
240 edit the history, this time with a fold action
240 edit the history, this time with a fold action
241 $ hg histedit 3 --commands $EDITED 2>&1 | fixbundle
241 $ hg histedit 3 --commands $EDITED 2>&1 | fixbundle
242 merging e
242 merging e
243 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
243 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
244 Fix up the change (mess 39522b764e3d)
244 Fix up the change (mess 39522b764e3d)
245 (hg histedit --continue to resume)
245 (hg histedit --continue to resume)
246
246
247 $ echo 'I can haz no commute' > e
247 $ echo 'I can haz no commute' > e
248 $ hg resolve --mark e
248 $ hg resolve --mark e
249 (no more unresolved files)
249 (no more unresolved files)
250 continue: hg histedit --continue
250 continue: hg histedit --continue
251 $ hg histedit --continue 2>&1 | fixbundle
251 $ hg histedit --continue 2>&1 | fixbundle
252 merging e
252 merging e
253 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
253 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
254 Fix up the change (pick 7b4e2f4b7bcd)
254 Fix up the change (pick 7b4e2f4b7bcd)
255 (hg histedit --continue to resume)
255 (hg histedit --continue to resume)
256 second edit also fails, but just continue
256 second edit also fails, but just continue
257 $ hg revert -r 'p1()' e
257 $ hg revert -r 'p1()' e
258 $ hg resolve --mark e
258 $ hg resolve --mark e
259 (no more unresolved files)
259 (no more unresolved files)
260 continue: hg histedit --continue
260 continue: hg histedit --continue
261 $ hg histedit --continue 2>&1 | fixbundle
261 $ hg histedit --continue 2>&1 | fixbundle
262 7b4e2f4b7bcd: skipping changeset (no changes)
262 7b4e2f4b7bcd: skipping changeset (no changes)
263
263
264 post message fix
264 post message fix
265 $ hg log --graph
265 $ hg log --graph
266 @ changeset: 6:7efe1373e4bc
266 @ changeset: 6:7efe1373e4bc
267 | tag: tip
267 | tag: tip
268 | user: test
268 | user: test
269 | date: Thu Jan 01 00:00:00 1970 +0000
269 | date: Thu Jan 01 00:00:00 1970 +0000
270 | summary: f
270 | summary: f
271 |
271 |
272 o changeset: 5:e334d87a1e55
272 o changeset: 5:e334d87a1e55
273 | user: test
273 | user: test
274 | date: Thu Jan 01 00:00:00 1970 +0000
274 | date: Thu Jan 01 00:00:00 1970 +0000
275 | summary: does not commute with e
275 | summary: does not commute with e
276 |
276 |
277 o changeset: 4:00f1c5383965
277 o changeset: 4:00f1c5383965
278 | user: test
278 | user: test
279 | date: Thu Jan 01 00:00:00 1970 +0000
279 | date: Thu Jan 01 00:00:00 1970 +0000
280 | summary: d
280 | summary: d
281 |
281 |
282 o changeset: 3:65a9a84f33fd
282 o changeset: 3:65a9a84f33fd
283 | user: test
283 | user: test
284 | date: Thu Jan 01 00:00:00 1970 +0000
284 | date: Thu Jan 01 00:00:00 1970 +0000
285 | summary: c
285 | summary: c
286 |
286 |
287 o changeset: 2:da6535b52e45
287 o changeset: 2:da6535b52e45
288 | user: test
288 | user: test
289 | date: Thu Jan 01 00:00:00 1970 +0000
289 | date: Thu Jan 01 00:00:00 1970 +0000
290 | summary: b
290 | summary: b
291 |
291 |
292 o changeset: 1:c1f09da44841
292 o changeset: 1:c1f09da44841
293 | user: test
293 | user: test
294 | date: Thu Jan 01 00:00:00 1970 +0000
294 | date: Thu Jan 01 00:00:00 1970 +0000
295 | summary: a
295 | summary: a
296 |
296 |
297 o changeset: 0:1715188a53c7
297 o changeset: 0:1715188a53c7
298 user: test
298 user: test
299 date: Thu Jan 01 00:00:00 1970 +0000
299 date: Thu Jan 01 00:00:00 1970 +0000
300 summary: Initial commit
300 summary: Initial commit
301
301
302
302
303 An invalid editor shouldn't leave the user in a broken state:
304 $ EDITOR=totally-not-a-thing-unsensible-editor-value hg histedit 4
305
303 $ cd ..
306 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now