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