##// END OF EJS Templates
tests: convert histedit tests to .t...
Mads Kiilerich -
r17085:35729bdd default
parent child Browse files
Show More
@@ -1,5 +1,3 b''
1 #!/bin/sh
2
3 fixbundle() {
1 fixbundle() {
4 grep -v 'saving bundle' | grep -v 'saved backup' | \
2 grep -v 'saving bundle' | grep -v 'saved backup' | \
5 grep -v added | grep -v adding | \
3 grep -v added | grep -v adding | \
@@ -1,97 +1,359 b''
1 #!/bin/sh
1 $ . "$TESTDIR/histedit-helpers.sh"
2
3 $ cat >> $HGRCPATH <<EOF
4 > [extensions]
5 > graphlog=
6 > histedit=
7 > EOF
2
8
3 . "$TESTDIR/histedit-helpers.sh"
9 $ EDITED=`pwd`/editedhistory
10 $ cat > $EDITED <<EOF
11 > pick 177f92b77385 c
12 > pick e860deea161a e
13 > pick 652413bf663e f
14 > pick 055a42cdd887 d
15 > EOF
16 $ initrepo ()
17 > {
18 > hg init r
19 > cd r
20 > for x in a b c d e f ; do
21 > echo $x > $x
22 > hg add $x
23 > hg ci -m $x
24 > done
25 > }
26
27 $ initrepo
4
28
5 cat >> $HGRCPATH <<EOF
29 log before edit
6 [extensions]
30 $ hg log --graph
7 graphlog=
31 @ changeset: 5:652413bf663e
8 histedit=
32 | tag: tip
9 EOF
33 | user: test
34 | date: Thu Jan 01 00:00:00 1970 +0000
35 | summary: f
36 |
37 o changeset: 4:e860deea161a
38 | user: test
39 | date: Thu Jan 01 00:00:00 1970 +0000
40 | summary: e
41 |
42 o changeset: 3:055a42cdd887
43 | user: test
44 | date: Thu Jan 01 00:00:00 1970 +0000
45 | summary: d
46 |
47 o changeset: 2:177f92b77385
48 | user: test
49 | date: Thu Jan 01 00:00:00 1970 +0000
50 | summary: c
51 |
52 o changeset: 1:d2ae7f538514
53 | user: test
54 | date: Thu Jan 01 00:00:00 1970 +0000
55 | summary: b
56 |
57 o changeset: 0:cb9a9f314b8b
58 user: test
59 date: Thu Jan 01 00:00:00 1970 +0000
60 summary: a
10
61
11 EDITED=`pwd`/editedhistory
62
12 cat > $EDITED <<EOF
63 show the edit commands offered
64 $ HGEDITOR=cat hg histedit 177f92b77385
65 pick 177f92b77385 2 c
66 pick 055a42cdd887 3 d
67 pick e860deea161a 4 e
68 pick 652413bf663e 5 f
69
70 # Edit history between 177f92b77385 and 652413bf663e
71 #
72 # Commands:
73 # p, pick = use commit
74 # e, edit = use commit, but stop for amending
75 # f, fold = use commit, but fold into previous commit (combines N and N-1)
76 # d, drop = remove commit from history
77 # m, mess = edit message without changing commit content
78 #
79 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
80
81 edit the history
82 $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
83 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
84 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
85 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
86 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
87
88 rules should end up in .hg/histedit-last-edit.txt:
89 $ cat .hg/histedit-last-edit.txt
13 pick 177f92b77385 c
90 pick 177f92b77385 c
14 pick e860deea161a e
91 pick e860deea161a e
15 pick 652413bf663e f
92 pick 652413bf663e f
16 pick 055a42cdd887 d
93 pick 055a42cdd887 d
17 EOF
18 initrepo ()
19 {
20 hg init r
21 cd r
22 for x in a b c d e f ; do
23 echo $x > $x
24 hg add $x
25 hg ci -m $x
26 done
27 }
28
94
29 initrepo
95 log after edit
96 $ hg log --graph
97 @ changeset: 5:853c68da763f
98 | tag: tip
99 | user: test
100 | date: Thu Jan 01 00:00:00 1970 +0000
101 | summary: d
102 |
103 o changeset: 4:26f6a030ae82
104 | user: test
105 | date: Thu Jan 01 00:00:00 1970 +0000
106 | summary: f
107 |
108 o changeset: 3:b069cc29fb22
109 | user: test
110 | date: Thu Jan 01 00:00:00 1970 +0000
111 | summary: e
112 |
113 o changeset: 2:177f92b77385
114 | user: test
115 | date: Thu Jan 01 00:00:00 1970 +0000
116 | summary: c
117 |
118 o changeset: 1:d2ae7f538514
119 | user: test
120 | date: Thu Jan 01 00:00:00 1970 +0000
121 | summary: b
122 |
123 o changeset: 0:cb9a9f314b8b
124 user: test
125 date: Thu Jan 01 00:00:00 1970 +0000
126 summary: a
30
127
31 echo % log before edit
128
32 hg log --graph
129 put things back
33
130
34 echo % show the edit commands offered
131 $ cat > $EDITED <<EOF
35 HGEDITOR=cat hg histedit 177f92b77385
132 > pick 177f92b77385 c
133 > pick 853c68da763f d
134 > pick b069cc29fb22 e
135 > pick 26f6a030ae82 f
136 > EOF
137 $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
138 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
139 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
140 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
141 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
36
142
37 echo % edit the history
143 $ hg log --graph
38 HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
144 @ changeset: 5:652413bf663e
145 | tag: tip
146 | user: test
147 | date: Thu Jan 01 00:00:00 1970 +0000
148 | summary: f
149 |
150 o changeset: 4:e860deea161a
151 | user: test
152 | date: Thu Jan 01 00:00:00 1970 +0000
153 | summary: e
154 |
155 o changeset: 3:055a42cdd887
156 | user: test
157 | date: Thu Jan 01 00:00:00 1970 +0000
158 | summary: d
159 |
160 o changeset: 2:177f92b77385
161 | user: test
162 | date: Thu Jan 01 00:00:00 1970 +0000
163 | summary: c
164 |
165 o changeset: 1:d2ae7f538514
166 | user: test
167 | date: Thu Jan 01 00:00:00 1970 +0000
168 | summary: b
169 |
170 o changeset: 0:cb9a9f314b8b
171 user: test
172 date: Thu Jan 01 00:00:00 1970 +0000
173 summary: a
39
174
40 echo % rules should end up in .hg/histedit-last-edit.txt:
41 cat .hg/histedit-last-edit.txt
42 echo '**** end of rules file ****'
43
175
44 echo % log after edit
176 slightly different this time
45 hg log --graph
46
177
47 echo % put things back
178 $ cat > $EDITED <<EOF
48
179 > pick 055a42cdd887 d
49 cat > $EDITED <<EOF
180 > pick 652413bf663e f
50 pick 177f92b77385 c
181 > pick e860deea161a e
51 pick 853c68da763f d
182 > pick 177f92b77385 c
52 pick b069cc29fb22 e
183 > EOF
53 pick 26f6a030ae82 f
184 $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
54 EOF
185 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
55 HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
186 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
56
187 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
57 hg log --graph
188 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
189 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
190 $ hg log --graph
191 @ changeset: 5:99a62755c625
192 | tag: tip
193 | user: test
194 | date: Thu Jan 01 00:00:00 1970 +0000
195 | summary: c
196 |
197 o changeset: 4:7c6fdd608667
198 | user: test
199 | date: Thu Jan 01 00:00:00 1970 +0000
200 | summary: e
201 |
202 o changeset: 3:c4f52e213402
203 | user: test
204 | date: Thu Jan 01 00:00:00 1970 +0000
205 | summary: f
206 |
207 o changeset: 2:bfe4a5a76b37
208 | user: test
209 | date: Thu Jan 01 00:00:00 1970 +0000
210 | summary: d
211 |
212 o changeset: 1:d2ae7f538514
213 | user: test
214 | date: Thu Jan 01 00:00:00 1970 +0000
215 | summary: b
216 |
217 o changeset: 0:cb9a9f314b8b
218 user: test
219 date: Thu Jan 01 00:00:00 1970 +0000
220 summary: a
58
221
59
222
60 echo % slightly different this time
223 keep prevents stripping dead revs
61
224 $ cat > $EDITED <<EOF
62 cat > $EDITED <<EOF
225 > pick bfe4a5a76b37 d
63 pick 055a42cdd887 d
226 > pick c4f52e213402 f
64 pick 652413bf663e f
227 > pick 99a62755c625 c
65 pick e860deea161a e
228 > pick 7c6fdd608667 e
66 pick 177f92b77385 c
229 > EOF
67 EOF
230 $ HGEDITOR="cat $EDITED > " hg histedit bfe4a5a76b37 --keep 2>&1 | fixbundle
68 HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
231 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
69 hg log --graph
232 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
233 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
234 $ hg log --graph
235 > cat > $EDITED <<EOF
236 > pick 7c6fdd608667 e
237 > pick 99a62755c625 c
238 > EOF
239 @ changeset: 7:99e266581538
240 | tag: tip
241 | user: test
242 | date: Thu Jan 01 00:00:00 1970 +0000
243 | summary: e
244 |
245 o changeset: 6:5ad36efb0653
246 | parent: 3:c4f52e213402
247 | user: test
248 | date: Thu Jan 01 00:00:00 1970 +0000
249 | summary: c
250 |
251 | o changeset: 5:99a62755c625
252 | | user: test
253 | | date: Thu Jan 01 00:00:00 1970 +0000
254 | | summary: c
255 | |
256 | o changeset: 4:7c6fdd608667
257 |/ user: test
258 | date: Thu Jan 01 00:00:00 1970 +0000
259 | summary: e
260 |
261 o changeset: 3:c4f52e213402
262 | user: test
263 | date: Thu Jan 01 00:00:00 1970 +0000
264 | summary: f
265 |
266 o changeset: 2:bfe4a5a76b37
267 | user: test
268 | date: Thu Jan 01 00:00:00 1970 +0000
269 | summary: d
270 |
271 o changeset: 1:d2ae7f538514
272 | user: test
273 | date: Thu Jan 01 00:00:00 1970 +0000
274 | summary: b
275 |
276 o changeset: 0:cb9a9f314b8b
277 user: test
278 date: Thu Jan 01 00:00:00 1970 +0000
279 summary: a
70
280
71
281
72 echo % keep prevents stripping dead revs
282 try with --rev
73 cat > $EDITED <<EOF
283 $ hg histedit --commands "$EDITED" --rev -2 2>&1 | fixbundle
74 pick bfe4a5a76b37 d
284 abort: may not use changesets other than the ones listed
75 pick c4f52e213402 f
285 $ hg log --graph
76 pick 99a62755c625 c
286 @ changeset: 7:99e266581538
77 pick 7c6fdd608667 e
287 | tag: tip
78 EOF
288 | user: test
79 HGEDITOR="cat $EDITED > " hg histedit bfe4a5a76b37 --keep 2>&1 | fixbundle
289 | date: Thu Jan 01 00:00:00 1970 +0000
80 hg log --graph
290 | summary: e
291 |
292 o changeset: 6:5ad36efb0653
293 | parent: 3:c4f52e213402
294 | user: test
295 | date: Thu Jan 01 00:00:00 1970 +0000
296 | summary: c
297 |
298 | o changeset: 5:99a62755c625
299 | | user: test
300 | | date: Thu Jan 01 00:00:00 1970 +0000
301 | | summary: c
302 | |
303 | o changeset: 4:7c6fdd608667
304 |/ user: test
305 | date: Thu Jan 01 00:00:00 1970 +0000
306 | summary: e
307 |
308 o changeset: 3:c4f52e213402
309 | user: test
310 | date: Thu Jan 01 00:00:00 1970 +0000
311 | summary: f
312 |
313 o changeset: 2:bfe4a5a76b37
314 | user: test
315 | date: Thu Jan 01 00:00:00 1970 +0000
316 | summary: d
317 |
318 o changeset: 1:d2ae7f538514
319 | user: test
320 | date: Thu Jan 01 00:00:00 1970 +0000
321 | summary: b
322 |
323 o changeset: 0:cb9a9f314b8b
324 user: test
325 date: Thu Jan 01 00:00:00 1970 +0000
326 summary: a
81
327
82 echo '% try with --rev'
83 cat > $EDITED <<EOF
84 pick 7c6fdd608667 e
85 pick 99a62755c625 c
86 EOF
87 hg histedit --commands "$EDITED" --rev -2 2>&1 | fixbundle
88 hg log --graph
89
328
90 echo % should also work if a commit message is missing
329 should also work if a commit message is missing
91 BUNDLE="$TESTDIR/missing-comment.hg"
330 $ BUNDLE="$TESTDIR/missing-comment.hg"
92 hg init missing
331 $ hg init missing
93 cd missing
332 $ cd missing
94 hg unbundle $BUNDLE
333 $ hg unbundle $BUNDLE
95 hg co tip
334 adding changesets
96 hg log --graph
335 adding manifests
97 hg histedit 0
336 adding file changes
337 added 3 changesets with 3 changes to 1 files
338 (run 'hg update' to get a working copy)
339 $ hg co tip
340 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
341 $ hg log --graph
342 @ changeset: 2:bd22688093b3
343 | tag: tip
344 | user: Robert Altman <robert.altman@telventDTN.com>
345 | date: Mon Nov 28 16:40:04 2011 +0000
346 | summary: Update file.
347 |
348 o changeset: 1:3b3e956f9171
349 | user: Robert Altman <robert.altman@telventDTN.com>
350 | date: Mon Nov 28 16:37:57 2011 +0000
351 |
352 o changeset: 0:141947992243
353 user: Robert Altman <robert.altman@telventDTN.com>
354 date: Mon Nov 28 16:35:28 2011 +0000
355 summary: Checked in text file
356
357 $ hg histedit 0
358 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
359 $ cd ..
@@ -1,43 +1,107 b''
1 #!/bin/sh
1 $ . "$TESTDIR/histedit-helpers.sh"
2
2
3 . "$TESTDIR/histedit-helpers.sh"
3 $ cat >> $HGRCPATH <<EOF
4 > [extensions]
5 > graphlog=
6 > histedit=
7 > EOF
4
8
5 cat >> $HGRCPATH <<EOF
9 $ EDITED=`pwd`/editedhistory
6 [extensions]
10 $ cat > $EDITED <<EOF
7 graphlog=
11 > drop 177f92b77385 c
8 histedit=
12 > pick e860deea161a e
9 EOF
13 > pick 652413bf663e f
14 > pick 055a42cdd887 d
15 > EOF
16 $ initrepo ()
17 > {
18 > hg init r
19 > cd r
20 > for x in a b c d e f ; do
21 > echo $x > $x
22 > hg add $x
23 > hg ci -m $x
24 > done
25 > }
26
27 $ initrepo
10
28
11 EDITED=`pwd`/editedhistory
29 log before edit
12 cat > $EDITED <<EOF
30 $ hg log --graph
13 drop 177f92b77385 c
31 @ changeset: 5:652413bf663e
14 pick e860deea161a e
32 | tag: tip
15 pick 652413bf663e f
33 | user: test
16 pick 055a42cdd887 d
34 | date: Thu Jan 01 00:00:00 1970 +0000
17 EOF
35 | summary: f
18 initrepo ()
36 |
19 {
37 o changeset: 4:e860deea161a
20 hg init r
38 | user: test
21 cd r
39 | date: Thu Jan 01 00:00:00 1970 +0000
22 for x in a b c d e f ; do
40 | summary: e
23 echo $x > $x
41 |
24 hg add $x
42 o changeset: 3:055a42cdd887
25 hg ci -m $x
43 | user: test
26 done
44 | date: Thu Jan 01 00:00:00 1970 +0000
27 }
45 | summary: d
46 |
47 o changeset: 2:177f92b77385
48 | user: test
49 | date: Thu Jan 01 00:00:00 1970 +0000
50 | summary: c
51 |
52 o changeset: 1:d2ae7f538514
53 | user: test
54 | date: Thu Jan 01 00:00:00 1970 +0000
55 | summary: b
56 |
57 o changeset: 0:cb9a9f314b8b
58 user: test
59 date: Thu Jan 01 00:00:00 1970 +0000
60 summary: a
61
28
62
29 initrepo
63 edit the history
30
64 $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
31 echo % log before edit
65 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
32 hg log --graph
66 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
33
67 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 echo % edit the history
68 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
35 HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
36
69
37 echo % log after edit
70 log after edit
38 hg log --graph
71 $ hg log --graph
72 @ changeset: 4:708943196e52
73 | tag: tip
74 | user: test
75 | date: Thu Jan 01 00:00:00 1970 +0000
76 | summary: d
77 |
78 o changeset: 3:75cbdffecadb
79 | user: test
80 | date: Thu Jan 01 00:00:00 1970 +0000
81 | summary: f
82 |
83 o changeset: 2:493dc0964412
84 | user: test
85 | date: Thu Jan 01 00:00:00 1970 +0000
86 | summary: e
87 |
88 o changeset: 1:d2ae7f538514
89 | user: test
90 | date: Thu Jan 01 00:00:00 1970 +0000
91 | summary: b
92 |
93 o changeset: 0:cb9a9f314b8b
94 user: test
95 date: Thu Jan 01 00:00:00 1970 +0000
96 summary: a
39
97
40 echo % manifest after edit
41 hg manifest
42
98
43 echo % EOF
99 manifest after edit
100 $ hg manifest
101 a
102 b
103 d
104 e
105 f
106
107 $ cd ..
@@ -1,80 +1,180 b''
1 #!/bin/sh
1 $ . "$TESTDIR/histedit-helpers.sh"
2
2
3 . "$TESTDIR/histedit-helpers.sh"
3 $ cat >> $HGRCPATH <<EOF
4 > [extensions]
5 > graphlog=
6 > histedit=
7 > EOF
4
8
5 cat >> $HGRCPATH <<EOF
9 $ EDITED=`pwd`/editedhistory
6 [extensions]
10 $ cat > $EDITED <<EOF
7 graphlog=
11 > pick 177f92b77385 c
8 histedit=
12 > pick 055a42cdd887 d
9 EOF
13 > edit e860deea161a e
14 > pick 652413bf663e f
15 > EOF
16 $ initrepo ()
17 > {
18 > hg init r
19 > cd r
20 > for x in a b c d e f ; do
21 > echo $x > $x
22 > hg add $x
23 > hg ci -m $x
24 > done
25 > }
26
27 $ initrepo
10
28
11 EDITED=`pwd`/editedhistory
29 log before edit
12 cat > $EDITED <<EOF
30 $ hg log --graph
13 pick 177f92b77385 c
31 @ changeset: 5:652413bf663e
14 pick 055a42cdd887 d
32 | tag: tip
15 edit e860deea161a e
33 | user: test
16 pick 652413bf663e f
34 | date: Thu Jan 01 00:00:00 1970 +0000
17 EOF
35 | summary: f
18 initrepo ()
36 |
19 {
37 o changeset: 4:e860deea161a
20 hg init r
38 | user: test
21 cd r
39 | date: Thu Jan 01 00:00:00 1970 +0000
22 for x in a b c d e f ; do
40 | summary: e
23 echo $x > $x
41 |
24 hg add $x
42 o changeset: 3:055a42cdd887
25 hg ci -m $x
43 | user: test
26 done
44 | date: Thu Jan 01 00:00:00 1970 +0000
27 }
45 | summary: d
46 |
47 o changeset: 2:177f92b77385
48 | user: test
49 | date: Thu Jan 01 00:00:00 1970 +0000
50 | summary: c
51 |
52 o changeset: 1:d2ae7f538514
53 | user: test
54 | date: Thu Jan 01 00:00:00 1970 +0000
55 | summary: b
56 |
57 o changeset: 0:cb9a9f314b8b
58 user: test
59 date: Thu Jan 01 00:00:00 1970 +0000
60 summary: a
28
61
29 initrepo
62
63 edit the history
64 $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
65 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
66 abort: Make changes as needed, you may commit or record as needed now.
67 When you are finished, run hg histedit --continue to resume.
30
68
31 echo % log before edit
69 commit, then edit the revision
32 hg log --graph
70 $ hg ci -m 'wat'
33
71 created new head
34 echo % edit the history
72 $ echo a > e
35 HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
73 $ HGEDITOR='echo "foobaz" > ' hg histedit --continue 2>&1 | fixbundle
74 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
75 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
36
76
37 echo % commit, then edit the revision
77 $ hg log --graph
38 hg ci -m 'wat'
78 @ changeset: 6:bf757c081cd0
39 echo a > e
79 | tag: tip
40 HGEDITOR='echo "foobaz" > ' hg histedit --continue 2>&1 | fixbundle
80 | user: test
41
81 | date: Thu Jan 01 00:00:00 1970 +0000
42 hg log --graph
82 | summary: f
43
83 |
44 echo '% contents of e:'
84 o changeset: 5:d6b15fed32d4
45 hg cat e
85 | user: test
86 | date: Thu Jan 01 00:00:00 1970 +0000
87 | summary: foobaz
88 |
89 o changeset: 4:1a60820cd1f6
90 | user: test
91 | date: Thu Jan 01 00:00:00 1970 +0000
92 | summary: wat
93 |
94 o changeset: 3:055a42cdd887
95 | user: test
96 | date: Thu Jan 01 00:00:00 1970 +0000
97 | summary: d
98 |
99 o changeset: 2:177f92b77385
100 | user: test
101 | date: Thu Jan 01 00:00:00 1970 +0000
102 | summary: c
103 |
104 o changeset: 1:d2ae7f538514
105 | user: test
106 | date: Thu Jan 01 00:00:00 1970 +0000
107 | summary: b
108 |
109 o changeset: 0:cb9a9f314b8b
110 user: test
111 date: Thu Jan 01 00:00:00 1970 +0000
112 summary: a
46
113
47 cat > $EDITED <<EOF
48 edit bf757c081cd0 f
49 EOF
50 HGEDITOR="cat $EDITED > " hg histedit tip 2>&1 | fixbundle
51 hg status
52 HGEDITOR='true' hg histedit --continue
53 hg status
54
114
55 echo % log after edit
115 $ hg cat e
56 hg log --limit 1
116 a
57
117
58 echo "% say we'll change the message, but don't."
118 $ cat > $EDITED <<EOF
59 cat > ../edit.sh <<EOF
119 > edit bf757c081cd0 f
60 #!/bin/sh
120 > EOF
61 cat \$1 | sed s/pick/mess/ > tmp
121 $ HGEDITOR="cat $EDITED > " hg histedit tip 2>&1 | fixbundle
62 mv tmp \$1
122 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
63 EOF
123 abort: Make changes as needed, you may commit or record as needed now.
64 chmod +x ../edit.sh
124 When you are finished, run hg histedit --continue to resume.
65 HGEDITOR="../edit.sh" hg histedit tip 2>&1 | fixbundle
125 $ hg status
66 hg status
126 A f
67 hg log --limit 1
127 $ HGEDITOR='true' hg histedit --continue
128 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
129 $ hg status
130
131 log after edit
132 $ hg log --limit 1
133 changeset: 6:bf757c081cd0
134 tag: tip
135 user: test
136 date: Thu Jan 01 00:00:00 1970 +0000
137 summary: f
138
68
139
69 echo % modify the message
140 say we'll change the message, but don't.
70 cat > $EDITED <<EOF
141 $ cat > ../edit.sh <<EOF
71 mess bf757c081cd0 f
142 > #!/bin/sh
72 EOF
143 > cat \$1 | sed s/pick/mess/ > tmp
73 HGEDITOR="cat $EDITED > " hg histedit tip 2>&1 | fixbundle
144 > mv tmp \$1
74 hg status
145 > EOF
75 hg log --limit 1
146 $ chmod +x ../edit.sh
147 $ HGEDITOR="../edit.sh" hg histedit tip 2>&1 | fixbundle
148 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
149 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 $ hg status
151 $ hg log --limit 1
152 changeset: 6:bf757c081cd0
153 tag: tip
154 user: test
155 date: Thu Jan 01 00:00:00 1970 +0000
156 summary: f
157
76
158
77 echo % rollback should not work after a histedit
159 modify the message
78 hg rollback
160 $ cat > $EDITED <<EOF
161 > mess bf757c081cd0 f
162 > EOF
163 $ HGEDITOR="cat $EDITED > " hg histedit tip 2>&1 | fixbundle
164 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
165 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
166 $ hg status
167 $ hg log --limit 1
168 changeset: 6:0b16746f8e89
169 tag: tip
170 user: test
171 date: Thu Jan 01 00:00:00 1970 +0000
172 summary: mess bf757c081cd0 f
79
173
80 echo % EOF
174
175 rollback should not work after a histedit
176 $ hg rollback
177 no rollback information available
178 [1]
179
180 $ cd ..
@@ -1,65 +1,146 b''
1 #!/bin/sh
1 $ . "$TESTDIR/histedit-helpers.sh"
2
2
3 . "$TESTDIR/histedit-helpers.sh"
3 $ cat >> $HGRCPATH <<EOF
4 > [extensions]
5 > graphlog=
6 > histedit=
7 > EOF
4
8
5 cat >> $HGRCPATH <<EOF
9 $ EDITED=`pwd`/editedhistory
6 [extensions]
10 $ cat > $EDITED <<EOF
7 graphlog=
11 > pick 177f92b77385 c
8 histedit=
12 > pick 055a42cdd887 d
9 EOF
13 > fold bfa474341cc9 does not commute with e
14 > pick e860deea161a e
15 > pick 652413bf663e f
16 > EOF
17 $ initrepo ()
18 > {
19 > hg init $1
20 > cd $1
21 > for x in a b c d e f ; do
22 > echo $x > $x
23 > hg add $x
24 > hg ci -m $x
25 > done
26 > echo a >> e
27 > hg ci -m 'does not commute with e'
28 > cd ..
29 > }
30
31 $ initrepo r
32 $ cd r
10
33
11 EDITED=`pwd`/editedhistory
34 log before edit
12 cat > $EDITED <<EOF
35 $ hg log --graph
13 pick 177f92b77385 c
36 @ changeset: 6:bfa474341cc9
14 pick 055a42cdd887 d
37 | tag: tip
15 fold bfa474341cc9 does not commute with e
38 | user: test
16 pick e860deea161a e
39 | date: Thu Jan 01 00:00:00 1970 +0000
17 pick 652413bf663e f
40 | summary: does not commute with e
18 EOF
41 |
19 initrepo ()
42 o changeset: 5:652413bf663e
20 {
43 | user: test
21 hg init r
44 | date: Thu Jan 01 00:00:00 1970 +0000
22 cd r
45 | summary: f
23 for x in a b c d e f ; do
46 |
24 echo $x > $x
47 o changeset: 4:e860deea161a
25 hg add $x
48 | user: test
26 hg ci -m $x
49 | date: Thu Jan 01 00:00:00 1970 +0000
27 done
50 | summary: e
28 echo a >> e
51 |
29 hg ci -m 'does not commute with e'
52 o changeset: 3:055a42cdd887
30 }
53 | user: test
31
54 | date: Thu Jan 01 00:00:00 1970 +0000
32 initrepo
55 | summary: d
33
56 |
34 echo % log before edit
57 o changeset: 2:177f92b77385
35 hg log --graph
58 | user: test
36
59 | date: Thu Jan 01 00:00:00 1970 +0000
37 echo % edit the history
60 | summary: c
38 HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
61 |
39
62 o changeset: 1:d2ae7f538514
40 echo % fix up
63 | user: test
41 echo a > e
64 | date: Thu Jan 01 00:00:00 1970 +0000
42 hg add e
65 | summary: b
43 cat > cat.py <<EOF
66 |
44 import sys
67 o changeset: 0:cb9a9f314b8b
45 print open(sys.argv[1]).read()
68 user: test
46 print
69 date: Thu Jan 01 00:00:00 1970 +0000
47 print
70 summary: a
48 EOF
49 HGEDITOR="python cat.py" hg histedit --continue 2>&1 | fixbundle | grep -v '2 files removed'
50
51 echo
52 echo % just continue this time
53 hg histedit --continue 2>&1 | fixbundle
54
71
55
72
56 echo % log after edit
73 edit the history
57 hg log --graph
74 $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
75 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
76 1 out of 1 hunks FAILED -- saving rejects to file e.rej
77 abort: Fix up the change and run hg histedit --continue
78
79 fix up
80 $ echo a > e
81 $ hg add e
82 $ cat > cat.py <<EOF
83 > import sys
84 > print open(sys.argv[1]).read()
85 > print
86 > print
87 > EOF
88 $ HGEDITOR="python cat.py" hg histedit --continue 2>&1 | fixbundle | grep -v '2 files removed'
89 d
90 ***
91 does not commute with e
92
93
94 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
95 file e already exists
96 1 out of 1 hunks FAILED -- saving rejects to file e.rej
97 abort: Fix up the change and run hg histedit --continue
98
99 just continue this time
100 $ hg histedit --continue 2>&1 | fixbundle
101 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
102 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
58
103
59 echo % contents of e
104 log after edit
60 hg cat e
105 $ hg log --graph
106 @ changeset: 4:f768fd60ca34
107 | tag: tip
108 | user: test
109 | date: Thu Jan 01 00:00:00 1970 +0000
110 | summary: f
111 |
112 o changeset: 3:671efe372e33
113 | user: test
114 | date: Thu Jan 01 00:00:00 1970 +0000
115 | summary: d
116 |
117 o changeset: 2:177f92b77385
118 | user: test
119 | date: Thu Jan 01 00:00:00 1970 +0000
120 | summary: c
121 |
122 o changeset: 1:d2ae7f538514
123 | user: test
124 | date: Thu Jan 01 00:00:00 1970 +0000
125 | summary: b
126 |
127 o changeset: 0:cb9a9f314b8b
128 user: test
129 date: Thu Jan 01 00:00:00 1970 +0000
130 summary: a
61
131
62 echo % manifest
132
63 hg manifest
133 contents of e
134 $ hg cat e
135 a
64
136
65 echo % EOF
137 manifest
138 $ hg manifest
139 a
140 b
141 c
142 d
143 e
144 f
145
146 $ cd ..
@@ -1,43 +1,110 b''
1 #!/bin/sh
1 $ . "$TESTDIR/histedit-helpers.sh"
2
2
3 . "$TESTDIR/histedit-helpers.sh"
3 $ cat >> $HGRCPATH <<EOF
4 > [extensions]
5 > graphlog=
6 > histedit=
7 > EOF
4
8
5 cat >> $HGRCPATH <<EOF
9 $ EDITED=`pwd`/editedhistory
6 [extensions]
10 $ cat > $EDITED <<EOF
7 graphlog=
11 > pick e860deea161a e
8 histedit=
12 > pick 652413bf663e f
9 EOF
13 > fold 177f92b77385 c
14 > pick 055a42cdd887 d
15 > EOF
16 $ initrepo ()
17 > {
18 > hg init r
19 > cd r
20 > for x in a b c d e f ; do
21 > echo $x > $x
22 > hg add $x
23 > hg ci -m $x
24 > done
25 > }
26
27 $ initrepo
10
28
11 EDITED=`pwd`/editedhistory
29 log before edit
12 cat > $EDITED <<EOF
30 $ hg log --graph
13 pick e860deea161a e
31 @ changeset: 5:652413bf663e
14 pick 652413bf663e f
32 | tag: tip
15 fold 177f92b77385 c
33 | user: test
16 pick 055a42cdd887 d
34 | date: Thu Jan 01 00:00:00 1970 +0000
17 EOF
35 | summary: f
18 initrepo ()
36 |
19 {
37 o changeset: 4:e860deea161a
20 hg init r
38 | user: test
21 cd r
39 | date: Thu Jan 01 00:00:00 1970 +0000
22 for x in a b c d e f ; do
40 | summary: e
23 echo $x > $x
41 |
24 hg add $x
42 o changeset: 3:055a42cdd887
25 hg ci -m $x
43 | user: test
26 done
44 | date: Thu Jan 01 00:00:00 1970 +0000
27 }
45 | summary: d
46 |
47 o changeset: 2:177f92b77385
48 | user: test
49 | date: Thu Jan 01 00:00:00 1970 +0000
50 | summary: c
51 |
52 o changeset: 1:d2ae7f538514
53 | user: test
54 | date: Thu Jan 01 00:00:00 1970 +0000
55 | summary: b
56 |
57 o changeset: 0:cb9a9f314b8b
58 user: test
59 date: Thu Jan 01 00:00:00 1970 +0000
60 summary: a
61
28
62
29 initrepo
63 edit the history
30
64 $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
31 echo % log before edit
65 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
32 hg log --graph
66 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
33
67 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 echo % edit the history
68 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
35 HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
69 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
70 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
36
71
37 echo % log after edit
72 log after edit
38 hg log --graph
73 $ hg log --graph
74 @ changeset: 4:82b0c1ff1777
75 | tag: tip
76 | user: test
77 | date: Thu Jan 01 00:00:00 1970 +0000
78 | summary: d
79 |
80 o changeset: 3:150aafb44a91
81 | user: test
82 | date: Thu Jan 01 00:00:00 1970 +0000
83 | summary: pick e860deea161a e
84 |
85 o changeset: 2:493dc0964412
86 | user: test
87 | date: Thu Jan 01 00:00:00 1970 +0000
88 | summary: e
89 |
90 o changeset: 1:d2ae7f538514
91 | user: test
92 | date: Thu Jan 01 00:00:00 1970 +0000
93 | summary: b
94 |
95 o changeset: 0:cb9a9f314b8b
96 user: test
97 date: Thu Jan 01 00:00:00 1970 +0000
98 summary: a
39
99
40 echo % post-fold manifest
41 hg manifest
42
100
43 echo % EOF
101 post-fold manifest
102 $ hg manifest
103 a
104 b
105 c
106 d
107 e
108 f
109
110 $ cd ..
@@ -1,110 +1,189 b''
1 #!/bin/sh
1 test for old histedit issue #6:
2 editing a changeset without any actual change would corrupt the repository
2
3
3 # test for issue #6:
4 $ . "$TESTDIR/histedit-helpers.sh"
4 # editing a changeset without any actual change would corrupt the repository
5
6 . "$TESTDIR/histedit-helpers.sh"
7
5
8 cat >> $HGRCPATH <<EOF
6 $ cat >> $HGRCPATH <<EOF
9 [extensions]
7 > [extensions]
10 graphlog=
8 > graphlog=
11 histedit=
9 > histedit=
12 EOF
10 > EOF
13
14 initrepo ()
15 {
16 dir="$1"
17 comment="$2"
18
11
19 if [ -n "${comment}" ]; then
12 $ initrepo ()
20 echo % ${comment}
13 > {
21 echo % ${comment} | sed 's:.:-:g'
14 > dir="$1"
22 fi
15 > comment="$2"
23
16 > if [ -n "${comment}" ]; then
24 hg init ${dir}
17 > echo % ${comment}
25 cd ${dir}
18 > echo % ${comment} | sed 's:.:-:g'
26 for x in a b c d e f ; do
19 > fi
27 echo $x > $x
20 > hg init ${dir}
28 hg add $x
21 > cd ${dir}
29 hg ci -m $x
22 > for x in a b c d e f ; do
30 done
23 > echo $x > $x
31 }
24 > hg add $x
32
25 > hg ci -m $x
33 geneditor ()
26 > done
34 {
27 > cd ..
35 # generate an editor script for selecting changesets to be edited
28 > }
36
37 choice=$1 # changesets that should be edited (using sed line ranges)
38
39 cat <<EOF | sed 's:^....::'
40 #!/bin/sh
41
29
42 # editing the rules, replacing 'pick' with 'edit' for the chosen lines
30 $ geneditor ()
43 sed '${choice}s:^pick:edit:' \$1 > \${1}.tmp
31 > {
44 mv \${1}.tmp \$1
32 > # generate an editor script for selecting changesets to be edited
45
33 > choice=$1 # changesets that should be edited (using sed line ranges)
46 # displaying the resulting rules, minus comments and empty lines
34 > cat <<EOF | sed 's:^....::'
47 sed '/^#/d;/^$/d;s:^:| :' \$1 >&2
35 > #!/bin/sh
48 EOF
36 > # editing the rules, replacing 'pick' with 'edit' for the chosen lines
49 }
37 > sed '${choice}s:^pick:edit:' \$1 > \${1}.tmp
50
38 > mv \${1}.tmp \$1
51 startediting ()
39 > # displaying the resulting rules, minus comments and empty lines
52 {
40 > sed '/^#/d;/^$/d;s:^:| :' \$1 >&2
53 # begin an editing session
41 > EOF
54
42 > }
55 choice="$1" # changesets that should be edited
56 number="$2" # number of changesets considered (from tip)
57 comment="$3"
58
59 geneditor "${choice}" > edit.sh
60 chmod +x edit.sh
61
43
62 echo % start editing the history ${comment}
44 $ startediting ()
63 HGEDITOR=./edit.sh hg histedit -- -${number} 2>&1 | fixbundle
45 > {
64 }
46 > # begin an editing session
65
47 > choice="$1" # changesets that should be edited
66 continueediting ()
48 > number="$2" # number of changesets considered (from tip)
67 {
49 > comment="$3"
68 # continue an edit already in progress
50 > geneditor "${choice}" > edit.sh
69
51 > chmod +x edit.sh
70 editor="$1" # message editor when finalizing editing
52 > echo % start editing the history ${comment}
71 comment="$2"
53 > HGEDITOR=./edit.sh hg histedit -- -${number} 2>&1 | fixbundle
54 > }
72
55
73 echo % finalize changeset editing ${comment}
56 $ continueediting ()
74 HGEDITOR=${editor} hg histedit --continue 2>&1 | fixbundle
57 > {
75 }
58 > # continue an edit already in progress
59 > editor="$1" # message editor when finalizing editing
60 > comment="$2"
61 > echo % finalize changeset editing ${comment}
62 > HGEDITOR=${editor} hg histedit --continue 2>&1 | fixbundle
63 > }
76
64
77 graphlog ()
65 $ graphlog ()
78 {
66 > {
79 comment="${1:-log}"
67 > comment="${1:-log}"
80
68 > echo % "${comment}"
81 echo % "${comment}"
69 > hg glog --template '{rev} {node} \"{desc|firstline}\"\n'
82 hg glog --template '{rev} {node} \"{desc|firstline}\"\n'
70 > }
83 }
84
71
85
72
73 $ initrepo r1 "test editing with no change"
74 % test editing with no change
75 -----------------------------
76 $ cd r1
77 $ graphlog "log before editing"
78 % log before editing
79 @ 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
80 |
81 o 4 e860deea161a2f77de56603b340ebbb4536308ae "e"
82 |
83 o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
84 |
85 o 2 177f92b773850b59254aa5e923436f921b55483b "c"
86 |
87 o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
88 |
89 o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
86
90
87 initrepo r1 "test editing with no change"
91 $ startediting 2 3 "(not changing anything)" # edit the 2nd of 3 changesets
88 graphlog "log before editing"
92 % start editing the history (not changing anything)
89 startediting 2 3 "(not changing anything)" # edit the 2nd of 3 changesets
93 | pick 055a42cdd887 3 d
90 continueediting true "(leaving commit message unaltered)"
94 | edit e860deea161a 4 e
95 | pick 652413bf663e 5 f
96 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
97 abort: Make changes as needed, you may commit or record as needed now.
98 When you are finished, run hg histedit --continue to resume.
99 $ continueediting true "(leaving commit message unaltered)"
100 % finalize changeset editing (leaving commit message unaltered)
101 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
91
102
92 echo "% check state of working copy"
103 check state of working copy
93 hg id
104 $ hg id
105 652413bf663e tip
94
106
95 graphlog "log after history editing"
107 $ graphlog "log after history editing"
108 % log after history editing
109 @ 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
110 |
111 o 4 e860deea161a2f77de56603b340ebbb4536308ae "e"
112 |
113 o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
114 |
115 o 2 177f92b773850b59254aa5e923436f921b55483b "c"
116 |
117 o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
118 |
119 o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
96
120
97
121
98 cd ..
122 $ cd ..
99 initrepo r2 "test editing with no change, then abort"
123
100 graphlog "log before editing"
124 $ initrepo r2 "test editing with no change, then abort"
101 startediting 1,2 3 "(not changing anything)" # edit the 1st two of 3 changesets
125 % test editing with no change, then abort
102 continueediting true "(leaving commit message unaltered)"
126 -----------------------------------------
103 graphlog "log after first edit"
127 $ cd r2
128 $ graphlog "log before editing"
129 % log before editing
130 @ 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
131 |
132 o 4 e860deea161a2f77de56603b340ebbb4536308ae "e"
133 |
134 o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
135 |
136 o 2 177f92b773850b59254aa5e923436f921b55483b "c"
137 |
138 o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
139 |
140 o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
104
141
105 echo % abort editing session
142 $ startediting 1,2 3 "(not changing anything)" # edit the 1st two of 3 changesets
106 hg histedit --abort 2>&1 | fixbundle
143 % start editing the history (not changing anything)
144 | edit 055a42cdd887 3 d
145 | edit e860deea161a 4 e
146 | pick 652413bf663e 5 f
147 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
148 abort: Make changes as needed, you may commit or record as needed now.
149 When you are finished, run hg histedit --continue to resume.
150 $ continueediting true "(leaving commit message unaltered)"
151 % finalize changeset editing (leaving commit message unaltered)
152 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
153 abort: Make changes as needed, you may commit or record as needed now.
154 When you are finished, run hg histedit --continue to resume.
155 $ graphlog "log after first edit"
156 % log after first edit
157 o 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
158 |
159 o 4 e860deea161a2f77de56603b340ebbb4536308ae "e"
160 |
161 @ 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
162 |
163 o 2 177f92b773850b59254aa5e923436f921b55483b "c"
164 |
165 o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
166 |
167 o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
107
168
108 graphlog "log after abort"
169
170 abort editing session
171 $ hg histedit --abort 2>&1 | fixbundle
172 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
109
173
110 echo % EOF
174 $ graphlog "log after abort"
175 % log after abort
176 @ 5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
177 |
178 o 4 e860deea161a2f77de56603b340ebbb4536308ae "e"
179 |
180 o 3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
181 |
182 o 2 177f92b773850b59254aa5e923436f921b55483b "c"
183 |
184 o 1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
185 |
186 o 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
187
188
189 $ cd ..
@@ -1,50 +1,131 b''
1 #!/bin/sh
1 $ . "$TESTDIR/histedit-helpers.sh"
2
2
3 . "$TESTDIR/histedit-helpers.sh"
3 $ cat >> $HGRCPATH <<EOF
4 > [extensions]
5 > graphlog=
6 > histedit=
7 > EOF
4
8
5 cat >> $HGRCPATH <<EOF
9 $ EDITED=`pwd`/editedhistory
6 [extensions]
10 $ cat > $EDITED <<EOF
7 graphlog=
11 > pick 177f92b77385 c
8 histedit=
12 > pick 055a42cdd887 d
9 EOF
13 > pick bfa474341cc9 does not commute with e
14 > pick e860deea161a e
15 > pick 652413bf663e f
16 > EOF
17 $ initrepo ()
18 > {
19 > hg init r
20 > cd r
21 > for x in a b c d e f ; do
22 > echo $x > $x
23 > hg add $x
24 > hg ci -m $x
25 > done
26 > echo a >> e
27 > hg ci -m 'does not commute with e'
28 > cd ..
29 > }
30
31 $ initrepo
32 $ cd r
10
33
11 EDITED=`pwd`/editedhistory
34 log before edit
12 cat > $EDITED <<EOF
35 $ hg log --graph
13 pick 177f92b77385 c
36 @ changeset: 6:bfa474341cc9
14 pick 055a42cdd887 d
37 | tag: tip
15 pick bfa474341cc9 does not commute with e
38 | user: test
16 pick e860deea161a e
39 | date: Thu Jan 01 00:00:00 1970 +0000
17 pick 652413bf663e f
40 | summary: does not commute with e
18 EOF
41 |
19 initrepo ()
42 o changeset: 5:652413bf663e
20 {
43 | user: test
21 hg init r
44 | date: Thu Jan 01 00:00:00 1970 +0000
22 cd r
45 | summary: f
23 for x in a b c d e f ; do
46 |
24 echo $x > $x
47 o changeset: 4:e860deea161a
25 hg add $x
48 | user: test
26 hg ci -m $x
49 | date: Thu Jan 01 00:00:00 1970 +0000
27 done
50 | summary: e
28 echo a >> e
51 |
29 hg ci -m 'does not commute with e'
52 o changeset: 3:055a42cdd887
30 }
53 | user: test
54 | date: Thu Jan 01 00:00:00 1970 +0000
55 | summary: d
56 |
57 o changeset: 2:177f92b77385
58 | user: test
59 | date: Thu Jan 01 00:00:00 1970 +0000
60 | summary: c
61 |
62 o changeset: 1:d2ae7f538514
63 | user: test
64 | date: Thu Jan 01 00:00:00 1970 +0000
65 | summary: b
66 |
67 o changeset: 0:cb9a9f314b8b
68 user: test
69 date: Thu Jan 01 00:00:00 1970 +0000
70 summary: a
71
72
73 edit the history
74 $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
75 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
76 1 out of 1 hunks FAILED -- saving rejects to file e.rej
77 abort: Fix up the change and run hg histedit --continue
31
78
32 initrepo
79 fix up (pre abort)
80 $ echo a > e
81 $ hg add e
82 $ hg histedit --continue 2>&1 | fixbundle
83 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 file e already exists
85 1 out of 1 hunks FAILED -- saving rejects to file e.rej
86 abort: Fix up the change and run hg histedit --continue
33
87
34 echo % log before edit
88 abort the edit
35 hg log --graph
89 $ hg histedit --abort 2>&1 | fixbundle
36
90 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
37 echo % edit the history
38 HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
39
91
40 echo '% fix up (pre abort)'
92 log after abort
41 echo a > e
93 $ hg log --graph
42 hg add e
94 @ changeset: 6:bfa474341cc9
43 hg histedit --continue 2>&1 | fixbundle
95 | tag: tip
96 | user: test
97 | date: Thu Jan 01 00:00:00 1970 +0000
98 | summary: does not commute with e
99 |
100 o changeset: 5:652413bf663e
101 | user: test
102 | date: Thu Jan 01 00:00:00 1970 +0000
103 | summary: f
104 |
105 o changeset: 4:e860deea161a
106 | user: test
107 | date: Thu Jan 01 00:00:00 1970 +0000
108 | summary: e
109 |
110 o changeset: 3:055a42cdd887
111 | user: test
112 | date: Thu Jan 01 00:00:00 1970 +0000
113 | summary: d
114 |
115 o changeset: 2:177f92b77385
116 | user: test
117 | date: Thu Jan 01 00:00:00 1970 +0000
118 | summary: c
119 |
120 o changeset: 1:d2ae7f538514
121 | user: test
122 | date: Thu Jan 01 00:00:00 1970 +0000
123 | summary: b
124 |
125 o changeset: 0:cb9a9f314b8b
126 user: test
127 date: Thu Jan 01 00:00:00 1970 +0000
128 summary: a
44
129
45 echo % abort the edit
46 hg histedit --abort 2>&1 | fixbundle
47
130
48 echo % log after abort
131 $ cd ..
49 hg log --graph
50 echo % EOF
@@ -1,90 +1,244 b''
1 #!/bin/sh
1 $ . "$TESTDIR/histedit-helpers.sh"
2
2
3 . "$TESTDIR/histedit-helpers.sh"
3 $ cat >> $HGRCPATH <<EOF
4 > [extensions]
5 > graphlog=
6 > histedit=
7 > EOF
4
8
5 cat >> $HGRCPATH <<EOF
9 $ EDITED=`pwd`/editedhistory
6 [extensions]
10 $ cat > $EDITED <<EOF
7 graphlog=
11 > pick 177f92b77385 c
8 histedit=
12 > pick 055a42cdd887 d
9 EOF
13 > pick bfa474341cc9 does not commute with e
14 > pick e860deea161a e
15 > pick 652413bf663e f
16 > EOF
17 $ initrepo ()
18 > {
19 > hg init $1
20 > cd $1
21 > for x in a b c d e f ; do
22 > echo $x > $x
23 > hg add $x
24 > hg ci -m $x
25 > done
26 > echo a >> e
27 > hg ci -m 'does not commute with e'
28 > cd ..
29 > }
30
31 $ initrepo r1
32 $ cd r1
10
33
11 EDITED=`pwd`/editedhistory
34 log before edit
12 cat > $EDITED <<EOF
35 $ hg log --graph
13 pick 177f92b77385 c
36 @ changeset: 6:bfa474341cc9
14 pick 055a42cdd887 d
37 | tag: tip
15 pick bfa474341cc9 does not commute with e
38 | user: test
16 pick e860deea161a e
39 | date: Thu Jan 01 00:00:00 1970 +0000
17 pick 652413bf663e f
40 | summary: does not commute with e
18 EOF
41 |
19 initrepo ()
42 o changeset: 5:652413bf663e
20 {
43 | user: test
21 hg init r
44 | date: Thu Jan 01 00:00:00 1970 +0000
22 cd r
45 | summary: f
23 for x in a b c d e f ; do
46 |
24 echo $x > $x
47 o changeset: 4:e860deea161a
25 hg add $x
48 | user: test
26 hg ci -m $x
49 | date: Thu Jan 01 00:00:00 1970 +0000
27 done
50 | summary: e
28 echo a >> e
51 |
29 hg ci -m 'does not commute with e'
52 o changeset: 3:055a42cdd887
30 }
53 | user: test
54 | date: Thu Jan 01 00:00:00 1970 +0000
55 | summary: d
56 |
57 o changeset: 2:177f92b77385
58 | user: test
59 | date: Thu Jan 01 00:00:00 1970 +0000
60 | summary: c
61 |
62 o changeset: 1:d2ae7f538514
63 | user: test
64 | date: Thu Jan 01 00:00:00 1970 +0000
65 | summary: b
66 |
67 o changeset: 0:cb9a9f314b8b
68 user: test
69 date: Thu Jan 01 00:00:00 1970 +0000
70 summary: a
71
31
72
32 initrepo
73 edit the history
74 $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
75 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
76 1 out of 1 hunks FAILED -- saving rejects to file e.rej
77 abort: Fix up the change and run hg histedit --continue
33
78
34 echo % log before edit
79 abort the edit
35 hg log --graph
80 $ hg histedit --abort 2>&1 | fixbundle
81 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
82
83
84 second edit set
36
85
37 echo % edit the history
86 $ hg log --graph
38 HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
87 @ changeset: 6:bfa474341cc9
39
88 | tag: tip
40 echo % abort the edit
89 | user: test
41 hg histedit --abort 2>&1 | fixbundle
90 | date: Thu Jan 01 00:00:00 1970 +0000
91 | summary: does not commute with e
92 |
93 o changeset: 5:652413bf663e
94 | user: test
95 | date: Thu Jan 01 00:00:00 1970 +0000
96 | summary: f
97 |
98 o changeset: 4:e860deea161a
99 | user: test
100 | date: Thu Jan 01 00:00:00 1970 +0000
101 | summary: e
102 |
103 o changeset: 3:055a42cdd887
104 | user: test
105 | date: Thu Jan 01 00:00:00 1970 +0000
106 | summary: d
107 |
108 o changeset: 2:177f92b77385
109 | user: test
110 | date: Thu Jan 01 00:00:00 1970 +0000
111 | summary: c
112 |
113 o changeset: 1:d2ae7f538514
114 | user: test
115 | date: Thu Jan 01 00:00:00 1970 +0000
116 | summary: b
117 |
118 o changeset: 0:cb9a9f314b8b
119 user: test
120 date: Thu Jan 01 00:00:00 1970 +0000
121 summary: a
42
122
43 echo
123
44 echo
124 edit the history
45 echo % second edit set
125 $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
126 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
127 1 out of 1 hunks FAILED -- saving rejects to file e.rej
128 abort: Fix up the change and run hg histedit --continue
46
129
47 hg log --graph
130 fix up
131 $ echo a > e
132 $ hg add e
133 $ hg histedit --continue 2>&1 | fixbundle
134 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
135 file e already exists
136 1 out of 1 hunks FAILED -- saving rejects to file e.rej
137 abort: Fix up the change and run hg histedit --continue
48
138
49 echo % edit the history
139 just continue this time
50 HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
140 $ hg histedit --continue 2>&1 | fixbundle
141 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
142 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
51
143
52 echo % fix up
144 log after edit
53 echo a > e
145 $ hg log --graph
54 hg add e
146 @ changeset: 5:9ab84894b459
55 hg histedit --continue 2>&1 | fixbundle
147 | tag: tip
148 | user: test
149 | date: Thu Jan 01 00:00:00 1970 +0000
150 | summary: f
151 |
152 o changeset: 4:1fff3ae8199d
153 | user: test
154 | date: Thu Jan 01 00:00:00 1970 +0000
155 | summary: does not commute with e
156 |
157 o changeset: 3:055a42cdd887
158 | user: test
159 | date: Thu Jan 01 00:00:00 1970 +0000
160 | summary: d
161 |
162 o changeset: 2:177f92b77385
163 | user: test
164 | date: Thu Jan 01 00:00:00 1970 +0000
165 | summary: c
166 |
167 o changeset: 1:d2ae7f538514
168 | user: test
169 | date: Thu Jan 01 00:00:00 1970 +0000
170 | summary: b
171 |
172 o changeset: 0:cb9a9f314b8b
173 user: test
174 date: Thu Jan 01 00:00:00 1970 +0000
175 summary: a
56
176
57 echo
58 echo % just continue this time
59 hg histedit --continue 2>&1 | fixbundle
60
177
61 echo % log after edit
178 start over
62 hg log --graph
63
179
64 echo % start over
180 $ cd ..
65
181
66 cd ..
182 $ initrepo r2
67 rm -r r
183 $ cd r2
68 initrepo
184 $ cat > $EDITED <<EOF
69 cat > $EDITED <<EOF
185 > pick 177f92b77385 c
70 pick 177f92b77385 c
186 > pick 055a42cdd887 d
71 pick 055a42cdd887 d
187 > mess bfa474341cc9 does not commute with e
72 mess bfa474341cc9 does not commute with e
188 > pick e860deea161a e
73 pick e860deea161a e
189 > pick 652413bf663e f
74 pick 652413bf663e f
190 > EOF
75 EOF
191
192 edit the history, this time with a fold action
193 $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
194 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
195 1 out of 1 hunks FAILED -- saving rejects to file e.rej
196 abort: Fix up the change and run hg histedit --continue
197
198 $ echo a > e
199 $ hg add e
200 $ HGEDITOR="cat $EDITED > " hg histedit --continue 2>&1 | fixbundle
201 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
202 file e already exists
203 1 out of 1 hunks FAILED -- saving rejects to file e.rej
204 abort: Fix up the change and run hg histedit --continue
205 second edit also fails, but just continue
206 $ hg histedit --continue 2>&1 | fixbundle
207 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
208 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
76
209
77 echo % edit the history, this time with a fold action
210 post message fix
78 HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
211 $ hg log --graph
212 @ changeset: 5:6459970fb49b
213 | tag: tip
214 | user: test
215 | date: Thu Jan 01 00:00:00 1970 +0000
216 | summary: f
217 |
218 o changeset: 4:556f27c874b0
219 | user: test
220 | date: Thu Jan 01 00:00:00 1970 +0000
221 | summary: pick 177f92b77385 c
222 |
223 o changeset: 3:055a42cdd887
224 | user: test
225 | date: Thu Jan 01 00:00:00 1970 +0000
226 | summary: d
227 |
228 o changeset: 2:177f92b77385
229 | user: test
230 | date: Thu Jan 01 00:00:00 1970 +0000
231 | summary: c
232 |
233 o changeset: 1:d2ae7f538514
234 | user: test
235 | date: Thu Jan 01 00:00:00 1970 +0000
236 | summary: b
237 |
238 o changeset: 0:cb9a9f314b8b
239 user: test
240 date: Thu Jan 01 00:00:00 1970 +0000
241 summary: a
79
242
80 echo
81 echo a > e
82 hg add e
83 HGEDITOR="cat $EDITED > " hg histedit --continue 2>&1 | fixbundle
84 echo % second edit also fails, but just continue
85 hg histedit --continue 2>&1 | fixbundle
86
243
87 echo % post message fix
244 $ cd ..
88 hg log --graph
89
90 echo % EOF
@@ -1,61 +1,91 b''
1 #!/bin/sh
1 $ cat >> $HGRCPATH <<EOF
2
2 > [extensions]
3 cat >> $HGRCPATH <<EOF
3 > graphlog=
4 [extensions]
4 > histedit=
5 graphlog=
5 > EOF
6 histedit=
7 EOF
8
6
9 EDITED=`pwd`/editedhistory
7 $ EDITED=`pwd`/editedhistory
10 cat > $EDITED <<EOF
8 $ cat > $EDITED <<EOF
11 pick 177f92b77385 c
9 > pick 177f92b77385 c
12 pick e860deea161a e
10 > pick e860deea161a e
13 pick 652413bf663e f
11 > pick 652413bf663e f
14 pick 055a42cdd887 d
12 > pick 055a42cdd887 d
15 EOF
13 > EOF
16 initrepo ()
14 $ initrepos ()
17 {
15 > {
18 hg init r
16 > hg init r
19 cd r
17 > cd r
20 for x in a b c ; do
18 > for x in a b c ; do
21 echo $x > $x
19 > echo $x > $x
22 hg add $x
20 > hg add $x
23 hg ci -m $x
21 > hg ci -m $x
24 done
22 > done
23 > cd ..
24 > hg clone r r2 | grep -v updating
25 > cd r2
26 > for x in d e f ; do
27 > echo $x > $x
28 > hg add $x
29 > hg ci -m $x
30 > done
31 > cd ..
32 > hg init r3
33 > cd r3
34 > for x in g h i ; do
35 > echo $x > $x
36 > hg add $x
37 > hg ci -m $x
38 > done
39 > cd ..
40 > }
41
42 $ initrepos
43 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
25
44
26 cd ..
45 show the edit commands offered by outgoing
27 hg clone r r2 | grep -v updating
46 $ cd r2
28 cd r2
47 $ HGEDITOR=cat hg histedit --outgoing ../r | grep -v comparing | grep -v searching
29 for x in d e f ; do
48 pick 055a42cdd887 3 d
30 echo $x > $x
49 pick e860deea161a 4 e
31 hg add $x
50 pick 652413bf663e 5 f
32 hg ci -m $x
51
33 done
52 # Edit history between 055a42cdd887 and 652413bf663e
53 #
54 # Commands:
55 # p, pick = use commit
56 # e, edit = use commit, but stop for amending
57 # f, fold = use commit, but fold into previous commit (combines N and N-1)
58 # d, drop = remove commit from history
59 # m, mess = edit message without changing commit content
60 #
61 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
62 $ cd ..
34
63
35 cd ..
64 show the error from unrelated repos
36 hg init r3
65 $ cd r3
37 cd r3
66 $ HGEDITOR=cat hg histedit --outgoing ../r | grep -v comparing | grep -v searching
38 for x in g h i ; do
67 abort: repository is unrelated
39 echo $x > $x
68 [1]
40 hg add $x
69 $ cd ..
41 hg ci -m $x
42 done
43 cd ..
44 }
45
46 initrepo
47
70
48 echo % show the edit commands offered by outgoing
71 show the error from unrelated repos
49 cd r2
72 $ cd r3
50 HGEDITOR=cat hg histedit --outgoing ../r | grep -v comparing | grep -v searching
73 $ HGEDITOR=cat hg histedit --force --outgoing ../r
51 cd ..
74 comparing with ../r
75 searching for changes
76 warning: repository is unrelated
77 pick 2a4042b45417 0 g
78 pick 68c46b4927ce 1 h
79 pick 51281e65ba79 2 i
52
80
53 echo % show the error from unrelated repos
81 # Edit history between 2a4042b45417 and 51281e65ba79
54 cd r3
82 #
55 HGEDITOR=cat hg histedit --outgoing ../r | grep -v comparing | grep -v searching
83 # Commands:
56 cd ..
84 # p, pick = use commit
57
85 # e, edit = use commit, but stop for amending
58 echo % show the error from unrelated repos
86 # f, fold = use commit, but fold into previous commit (combines N and N-1)
59 cd r3
87 # d, drop = remove commit from history
60 HGEDITOR=cat hg histedit --force --outgoing ../r
88 # m, mess = edit message without changing commit content
61 cd ..
89 #
90 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 $ cd ..
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now