Show More
@@ -1,5 +1,3 b'' | |||
|
1 | #!/bin/sh | |
|
2 | ||
|
3 | 1 |
|
|
4 | 2 | grep -v 'saving bundle' | grep -v 'saved backup' | \ |
|
5 | 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 | |
|
6 | [extensions] | |
|
7 | graphlog= | |
|
8 | histedit= | |
|
9 | EOF | |
|
29 | log before edit | |
|
30 | $ hg log --graph | |
|
31 | @ changeset: 5:652413bf663e | |
|
32 | | tag: tip | |
|
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 | |
|
61 | ||
|
62 | ||
|
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 | |
|
10 | 87 | |
|
11 | EDITED=`pwd`/editedhistory | |
|
12 | cat > $EDITED <<EOF | |
|
13 | pick 177f92b77385 c | |
|
14 | pick e860deea161a e | |
|
15 | pick 652413bf663e f | |
|
16 | 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 | } | |
|
88 | rules should end up in .hg/histedit-last-edit.txt: | |
|
89 | $ cat .hg/histedit-last-edit.txt | |
|
90 | pick 177f92b77385 c | |
|
91 | pick e860deea161a e | |
|
92 | pick 652413bf663e f | |
|
93 | pick 055a42cdd887 d | |
|
94 | ||
|
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 | |
|
127 | ||
|
128 | ||
|
129 | put things back | |
|
28 | 130 | |
|
29 | initrepo | |
|
30 | ||
|
31 | echo % log before edit | |
|
32 | hg log --graph | |
|
33 | ||
|
34 | echo % show the edit commands offered | |
|
35 | HGEDITOR=cat hg histedit 177f92b77385 | |
|
131 | $ cat > $EDITED <<EOF | |
|
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 | |
|
38 | HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle | |
|
143 | $ hg log --graph | |
|
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 | |
|
174 | ||
|
39 | 175 | |
|
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 | ||
|
44 | echo % log after edit | |
|
45 | hg log --graph | |
|
46 | ||
|
47 | echo % put things back | |
|
176 | slightly different this time | |
|
48 | 177 | |
|
49 | cat > $EDITED <<EOF | |
|
50 | pick 177f92b77385 c | |
|
51 | pick 853c68da763f d | |
|
52 | pick b069cc29fb22 e | |
|
53 | pick 26f6a030ae82 f | |
|
54 | EOF | |
|
55 | HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle | |
|
56 | ||
|
57 | hg log --graph | |
|
58 | ||
|
59 | ||
|
60 | echo % slightly different this time | |
|
61 | ||
|
62 | cat > $EDITED <<EOF | |
|
63 | pick 055a42cdd887 d | |
|
64 | pick 652413bf663e f | |
|
65 | pick e860deea161a e | |
|
66 | pick 177f92b77385 c | |
|
67 | EOF | |
|
68 | HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle | |
|
69 | hg log --graph | |
|
70 | ||
|
178 | $ cat > $EDITED <<EOF | |
|
179 | > pick 055a42cdd887 d | |
|
180 | > pick 652413bf663e f | |
|
181 | > pick e860deea161a e | |
|
182 | > pick 177f92b77385 c | |
|
183 | > EOF | |
|
184 | $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle | |
|
185 | 0 files updated, 0 files merged, 4 files removed, 0 files unresolved | |
|
186 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
187 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
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 | |
|
221 | ||
|
71 | 222 | |
|
72 |
|
|
|
73 | cat > $EDITED <<EOF | |
|
74 | pick bfe4a5a76b37 d | |
|
75 | pick c4f52e213402 f | |
|
76 | pick 99a62755c625 c | |
|
77 | pick 7c6fdd608667 e | |
|
78 | EOF | |
|
79 | HGEDITOR="cat $EDITED > " hg histedit bfe4a5a76b37 --keep 2>&1 | fixbundle | |
|
80 | hg log --graph | |
|
223 | keep prevents stripping dead revs | |
|
224 | $ cat > $EDITED <<EOF | |
|
225 | > pick bfe4a5a76b37 d | |
|
226 | > pick c4f52e213402 f | |
|
227 | > pick 99a62755c625 c | |
|
228 | > pick 7c6fdd608667 e | |
|
229 | > EOF | |
|
230 | $ HGEDITOR="cat $EDITED > " hg histedit bfe4a5a76b37 --keep 2>&1 | fixbundle | |
|
231 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
|
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 | |
|
280 | ||
|
81 | 281 | |
|
82 |
|
|
|
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 | |
|
282 | try with --rev | |
|
283 | $ hg histedit --commands "$EDITED" --rev -2 2>&1 | fixbundle | |
|
284 | abort: may not use changesets other than the ones listed | |
|
285 | $ hg log --graph | |
|
286 | @ changeset: 7:99e266581538 | |
|
287 | | tag: tip | |
|
288 | | user: test | |
|
289 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
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 | |
|
327 | ||
|
89 | 328 | |
|
90 |
|
|
|
91 | BUNDLE="$TESTDIR/missing-comment.hg" | |
|
92 | hg init missing | |
|
93 | cd missing | |
|
94 | hg unbundle $BUNDLE | |
|
95 | hg co tip | |
|
96 | hg log --graph | |
|
97 | hg histedit 0 | |
|
329 | should also work if a commit message is missing | |
|
330 | $ BUNDLE="$TESTDIR/missing-comment.hg" | |
|
331 | $ hg init missing | |
|
332 | $ cd missing | |
|
333 | $ hg unbundle $BUNDLE | |
|
334 | adding changesets | |
|
335 | adding manifests | |
|
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 | |
|
6 | [extensions] | |
|
7 | graphlog= | |
|
8 | histedit= | |
|
9 | EOF | |
|
9 | $ EDITED=`pwd`/editedhistory | |
|
10 | $ cat > $EDITED <<EOF | |
|
11 | > drop 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 | |
|
10 | 28 | |
|
11 | EDITED=`pwd`/editedhistory | |
|
12 | cat > $EDITED <<EOF | |
|
13 | drop 177f92b77385 c | |
|
14 | pick e860deea161a e | |
|
15 | pick 652413bf663e f | |
|
16 | 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 | } | |
|
29 | log before edit | |
|
30 | $ hg log --graph | |
|
31 | @ changeset: 5:652413bf663e | |
|
32 | | tag: tip | |
|
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 | |
|
61 | ||
|
28 | 62 | |
|
29 | initrepo | |
|
30 | ||
|
31 | echo % log before edit | |
|
32 | hg log --graph | |
|
33 | ||
|
34 | echo % edit the history | |
|
35 | HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle | |
|
63 | edit the history | |
|
64 | $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle | |
|
65 | 0 files updated, 0 files merged, 4 files removed, 0 files unresolved | |
|
66 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
67 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
68 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
36 | 69 | |
|
37 |
|
|
|
38 | hg log --graph | |
|
70 | log after edit | |
|
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 | |
|
97 | ||
|
39 | 98 | |
|
40 |
|
|
|
41 | hg manifest | |
|
99 | manifest after edit | |
|
100 | $ hg manifest | |
|
101 | a | |
|
102 | b | |
|
103 | d | |
|
104 | e | |
|
105 | f | |
|
42 | 106 | |
|
43 | echo % EOF | |
|
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 | |
|
6 | [extensions] | |
|
7 | graphlog= | |
|
8 | histedit= | |
|
9 | EOF | |
|
9 | $ EDITED=`pwd`/editedhistory | |
|
10 | $ cat > $EDITED <<EOF | |
|
11 | > pick 177f92b77385 c | |
|
12 | > pick 055a42cdd887 d | |
|
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 | |
|
12 | cat > $EDITED <<EOF | |
|
13 | pick 177f92b77385 c | |
|
14 | pick 055a42cdd887 d | |
|
15 | edit e860deea161a e | |
|
16 | pick 652413bf663e f | |
|
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 | } | |
|
29 | log before edit | |
|
30 | $ hg log --graph | |
|
31 | @ changeset: 5:652413bf663e | |
|
32 | | tag: tip | |
|
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 | |
|
61 | ||
|
28 | 62 | |
|
29 | initrepo | |
|
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 | |
|
32 | hg log --graph | |
|
33 | ||
|
34 | echo % edit the history | |
|
35 |
HGEDITOR= |
|
|
69 | commit, then edit the revision | |
|
70 | $ hg ci -m 'wat' | |
|
71 | created new head | |
|
72 | $ echo a > e | |
|
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 | |
|
38 | hg ci -m 'wat' | |
|
39 | echo a > e | |
|
40 | HGEDITOR='echo "foobaz" > ' hg histedit --continue 2>&1 | fixbundle | |
|
41 | ||
|
42 | hg log --graph | |
|
43 | ||
|
44 | echo '% contents of e:' | |
|
45 | hg cat e | |
|
77 | $ hg log --graph | |
|
78 | @ changeset: 6:bf757c081cd0 | |
|
79 | | tag: tip | |
|
80 | | user: test | |
|
81 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
82 | | summary: f | |
|
83 | | | |
|
84 | o changeset: 5:d6b15fed32d4 | |
|
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 | |
|
113 | ||
|
46 | 114 | |
|
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 | ||
|
55 | echo % log after edit | |
|
56 | hg log --limit 1 | |
|
115 | $ hg cat e | |
|
116 | a | |
|
57 | 117 | |
|
58 | echo "% say we'll change the message, but don't." | |
|
59 | cat > ../edit.sh <<EOF | |
|
60 | #!/bin/sh | |
|
61 | cat \$1 | sed s/pick/mess/ > tmp | |
|
62 | mv tmp \$1 | |
|
63 | EOF | |
|
64 | chmod +x ../edit.sh | |
|
65 | HGEDITOR="../edit.sh" hg histedit tip 2>&1 | fixbundle | |
|
66 | hg status | |
|
67 | hg log --limit 1 | |
|
118 | $ cat > $EDITED <<EOF | |
|
119 | > edit bf757c081cd0 f | |
|
120 | > EOF | |
|
121 | $ HGEDITOR="cat $EDITED > " hg histedit tip 2>&1 | fixbundle | |
|
122 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
|
123 | abort: Make changes as needed, you may commit or record as needed now. | |
|
124 | When you are finished, run hg histedit --continue to resume. | |
|
125 | $ hg status | |
|
126 | A f | |
|
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 | |
|
70 | cat > $EDITED <<EOF | |
|
71 | mess bf757c081cd0 f | |
|
72 | EOF | |
|
73 | HGEDITOR="cat $EDITED > " hg histedit tip 2>&1 | fixbundle | |
|
74 | hg status | |
|
75 | hg log --limit 1 | |
|
140 | say we'll change the message, but don't. | |
|
141 | $ cat > ../edit.sh <<EOF | |
|
142 | > #!/bin/sh | |
|
143 | > cat \$1 | sed s/pick/mess/ > tmp | |
|
144 | > mv tmp \$1 | |
|
145 | > EOF | |
|
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 | |
|
78 | hg rollback | |
|
159 | modify the message | |
|
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 | |
|
173 | ||
|
79 | 174 | |
|
80 | echo % EOF | |
|
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 | |
|
6 | [extensions] | |
|
7 | graphlog= | |
|
8 | histedit= | |
|
9 | EOF | |
|
9 | $ EDITED=`pwd`/editedhistory | |
|
10 | $ cat > $EDITED <<EOF | |
|
11 | > pick 177f92b77385 c | |
|
12 | > pick 055a42cdd887 d | |
|
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 | |
|
12 | cat > $EDITED <<EOF | |
|
13 | pick 177f92b77385 c | |
|
14 | pick 055a42cdd887 d | |
|
15 | fold bfa474341cc9 does not commute with e | |
|
16 | pick e860deea161a e | |
|
17 | pick 652413bf663e f | |
|
18 | EOF | |
|
19 | initrepo () | |
|
20 | { | |
|
21 | hg init r | |
|
22 | cd r | |
|
23 | for x in a b c d e f ; do | |
|
24 | echo $x > $x | |
|
25 | hg add $x | |
|
26 | hg ci -m $x | |
|
27 | done | |
|
28 | echo a >> e | |
|
29 | hg ci -m 'does not commute with e' | |
|
30 | } | |
|
31 | ||
|
32 | initrepo | |
|
34 | log before edit | |
|
35 | $ hg log --graph | |
|
36 | @ changeset: 6:bfa474341cc9 | |
|
37 | | tag: tip | |
|
38 | | user: test | |
|
39 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
40 | | summary: does not commute with e | |
|
41 | | | |
|
42 | o changeset: 5:652413bf663e | |
|
43 | | user: test | |
|
44 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
45 | | summary: f | |
|
46 | | | |
|
47 | o changeset: 4:e860deea161a | |
|
48 | | user: test | |
|
49 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
50 | | summary: e | |
|
51 | | | |
|
52 | o changeset: 3:055a42cdd887 | |
|
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 | ||
|
33 | 72 | |
|
34 | echo % log before edit | |
|
35 | hg log --graph | |
|
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 | |
|
36 | 78 | |
|
37 | echo % edit the history | |
|
38 | HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle | |
|
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 | ||
|
86 | ||
|
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 | |
|
39 | 103 | |
|
40 | echo % fix up | |
|
41 | echo a > e | |
|
42 | hg add e | |
|
43 | cat > cat.py <<EOF | |
|
44 | import sys | |
|
45 | print open(sys.argv[1]).read() | |
|
46 | ||
|
47 | ||
|
48 | EOF | |
|
49 | HGEDITOR="python cat.py" hg histedit --continue 2>&1 | fixbundle | grep -v '2 files removed' | |
|
104 | log after edit | |
|
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 | |
|
131 | ||
|
50 | 132 | |
|
51 | echo | |
|
52 | echo % just continue this time | |
|
53 | hg histedit --continue 2>&1 | fixbundle | |
|
54 | ||
|
55 | ||
|
56 | echo % log after edit | |
|
57 | hg log --graph | |
|
133 | contents of e | |
|
134 | $ hg cat e | |
|
135 | a | |
|
58 | 136 | |
|
59 | echo % contents of e | |
|
60 | hg cat e | |
|
137 | manifest | |
|
138 | $ hg manifest | |
|
139 | a | |
|
140 | b | |
|
141 | c | |
|
142 | d | |
|
143 | e | |
|
144 | f | |
|
61 | 145 | |
|
62 | echo % manifest | |
|
63 | hg manifest | |
|
64 | ||
|
65 | echo % EOF | |
|
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 | |
|
6 | [extensions] | |
|
7 | graphlog= | |
|
8 | histedit= | |
|
9 | EOF | |
|
9 | $ EDITED=`pwd`/editedhistory | |
|
10 | $ cat > $EDITED <<EOF | |
|
11 | > pick e860deea161a e | |
|
12 | > pick 652413bf663e f | |
|
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 | |
|
12 | cat > $EDITED <<EOF | |
|
13 | pick e860deea161a e | |
|
14 | pick 652413bf663e f | |
|
15 | fold 177f92b77385 c | |
|
16 | 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 | } | |
|
29 | log before edit | |
|
30 | $ hg log --graph | |
|
31 | @ changeset: 5:652413bf663e | |
|
32 | | tag: tip | |
|
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 | |
|
61 | ||
|
28 | 62 | |
|
29 | initrepo | |
|
30 | ||
|
31 | echo % log before edit | |
|
32 | hg log --graph | |
|
33 | ||
|
34 | echo % edit the history | |
|
35 | HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle | |
|
63 | edit the history | |
|
64 | $ HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle | |
|
65 | 0 files updated, 0 files merged, 4 files removed, 0 files unresolved | |
|
66 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
67 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
68 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
|
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 |
|
|
|
38 | hg log --graph | |
|
72 | log after edit | |
|
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 | |
|
99 | ||
|
39 | 100 | |
|
40 |
|
|
|
41 | hg manifest | |
|
101 | post-fold manifest | |
|
102 | $ hg manifest | |
|
103 | a | |
|
104 | b | |
|
105 | c | |
|
106 | d | |
|
107 | e | |
|
108 | f | |
|
42 | 109 | |
|
43 | echo % EOF | |
|
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 | # editing a changeset without any actual change would corrupt the repository | |
|
5 | ||
|
6 | . "$TESTDIR/histedit-helpers.sh" | |
|
4 | $ . "$TESTDIR/histedit-helpers.sh" | |
|
7 | 5 | |
|
8 | cat >> $HGRCPATH <<EOF | |
|
9 | [extensions] | |
|
10 | graphlog= | |
|
11 | histedit= | |
|
12 | EOF | |
|
13 | ||
|
14 | initrepo () | |
|
15 | { | |
|
16 | dir="$1" | |
|
17 | comment="$2" | |
|
6 | $ cat >> $HGRCPATH <<EOF | |
|
7 | > [extensions] | |
|
8 | > graphlog= | |
|
9 | > histedit= | |
|
10 | > EOF | |
|
18 | 11 | |
|
19 | if [ -n "${comment}" ]; then | |
|
20 | echo % ${comment} | |
|
21 | echo % ${comment} | sed 's:.:-:g' | |
|
22 | fi | |
|
23 | ||
|
24 | hg init ${dir} | |
|
25 | cd ${dir} | |
|
26 | for x in a b c d e f ; do | |
|
27 | echo $x > $x | |
|
28 | hg add $x | |
|
29 | hg ci -m $x | |
|
30 | done | |
|
31 | } | |
|
32 | ||
|
33 | geneditor () | |
|
34 | { | |
|
35 | # generate an editor script for selecting changesets to be edited | |
|
36 | ||
|
37 | choice=$1 # changesets that should be edited (using sed line ranges) | |
|
38 | ||
|
39 | cat <<EOF | sed 's:^....::' | |
|
40 | #!/bin/sh | |
|
12 | $ initrepo () | |
|
13 | > { | |
|
14 | > dir="$1" | |
|
15 | > comment="$2" | |
|
16 | > if [ -n "${comment}" ]; then | |
|
17 | > echo % ${comment} | |
|
18 | > echo % ${comment} | sed 's:.:-:g' | |
|
19 | > fi | |
|
20 | > hg init ${dir} | |
|
21 | > cd ${dir} | |
|
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 | > cd .. | |
|
28 | > } | |
|
41 | 29 | |
|
42 | # editing the rules, replacing 'pick' with 'edit' for the chosen lines | |
|
43 | sed '${choice}s:^pick:edit:' \$1 > \${1}.tmp | |
|
44 | mv \${1}.tmp \$1 | |
|
45 | ||
|
46 | # displaying the resulting rules, minus comments and empty lines | |
|
47 | sed '/^#/d;/^$/d;s:^:| :' \$1 >&2 | |
|
48 | EOF | |
|
49 | } | |
|
50 | ||
|
51 | startediting () | |
|
52 | { | |
|
53 | # begin an editing session | |
|
54 | ||
|
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 | |
|
30 | $ geneditor () | |
|
31 | > { | |
|
32 | > # generate an editor script for selecting changesets to be edited | |
|
33 | > choice=$1 # changesets that should be edited (using sed line ranges) | |
|
34 | > cat <<EOF | sed 's:^....::' | |
|
35 | > #!/bin/sh | |
|
36 | > # editing the rules, replacing 'pick' with 'edit' for the chosen lines | |
|
37 | > sed '${choice}s:^pick:edit:' \$1 > \${1}.tmp | |
|
38 | > mv \${1}.tmp \$1 | |
|
39 | > # displaying the resulting rules, minus comments and empty lines | |
|
40 | > sed '/^#/d;/^$/d;s:^:| :' \$1 >&2 | |
|
41 | > EOF | |
|
42 | > } | |
|
61 | 43 | |
|
62 | echo % start editing the history ${comment} | |
|
63 | HGEDITOR=./edit.sh hg histedit -- -${number} 2>&1 | fixbundle | |
|
64 | } | |
|
65 | ||
|
66 | continueediting () | |
|
67 | { | |
|
68 | # continue an edit already in progress | |
|
69 | ||
|
70 | editor="$1" # message editor when finalizing editing | |
|
71 | comment="$2" | |
|
44 | $ startediting () | |
|
45 | > { | |
|
46 | > # begin an editing session | |
|
47 | > choice="$1" # changesets that should be edited | |
|
48 | > number="$2" # number of changesets considered (from tip) | |
|
49 | > comment="$3" | |
|
50 | > geneditor "${choice}" > edit.sh | |
|
51 | > chmod +x edit.sh | |
|
52 | > echo % start editing the history ${comment} | |
|
53 | > HGEDITOR=./edit.sh hg histedit -- -${number} 2>&1 | fixbundle | |
|
54 | > } | |
|
72 | 55 | |
|
73 | echo % finalize changeset editing ${comment} | |
|
74 | HGEDITOR=${editor} hg histedit --continue 2>&1 | fixbundle | |
|
75 | } | |
|
56 | $ continueediting () | |
|
57 | > { | |
|
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 () | |
|
78 | { | |
|
79 | comment="${1:-log}" | |
|
80 | ||
|
81 | echo % "${comment}" | |
|
82 | hg glog --template '{rev} {node} \"{desc|firstline}\"\n' | |
|
83 | } | |
|
65 | $ graphlog () | |
|
66 | > { | |
|
67 | > comment="${1:-log}" | |
|
68 | > echo % "${comment}" | |
|
69 | > hg glog --template '{rev} {node} \"{desc|firstline}\"\n' | |
|
70 | > } | |
|
84 | 71 | |
|
85 | 72 | |
|
86 | ||
|
87 |
|
|
|
88 | graphlog "log before editing" | |
|
89 | startediting 2 3 "(not changing anything)" # edit the 2nd of 3 changesets | |
|
90 | continueediting true "(leaving commit message unaltered)" | |
|
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" | |
|
90 | ||
|
91 | $ startediting 2 3 "(not changing anything)" # edit the 2nd of 3 changesets | |
|
92 | % start editing the history (not changing anything) | |
|
93 | | pick 055a42cdd887 3 d | |
|
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 |
|
|
|
93 | hg id | |
|
103 | check state of working copy | |
|
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" | |
|
120 | ||
|
96 | 121 | |
|
122 | $ cd .. | |
|
97 | 123 | |
|
98 | cd .. | |
|
99 |
|
|
|
100 | graphlog "log before editing" | |
|
101 | startediting 1,2 3 "(not changing anything)" # edit the 1st two of 3 changesets | |
|
102 | continueediting true "(leaving commit message unaltered)" | |
|
103 | graphlog "log after first edit" | |
|
124 | $ initrepo r2 "test editing with no change, then abort" | |
|
125 | % test editing with no change, then abort | |
|
126 | ----------------------------------------- | |
|
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" | |
|
141 | ||
|
142 | $ startediting 1,2 3 "(not changing anything)" # edit the 1st two of 3 changesets | |
|
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" | |
|
168 | ||
|
104 | 169 | |
|
105 |
|
|
|
106 | hg histedit --abort 2>&1 | fixbundle | |
|
170 | abort editing session | |
|
171 | $ hg histedit --abort 2>&1 | fixbundle | |
|
172 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
107 | 173 | |
|
108 | graphlog "log after abort" | |
|
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 | ||
|
109 | 188 | |
|
110 | echo % EOF | |
|
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 | |
|
6 | [extensions] | |
|
7 | graphlog= | |
|
8 | histedit= | |
|
9 | EOF | |
|
9 | $ EDITED=`pwd`/editedhistory | |
|
10 | $ cat > $EDITED <<EOF | |
|
11 | > pick 177f92b77385 c | |
|
12 | > pick 055a42cdd887 d | |
|
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 | |
|
12 | cat > $EDITED <<EOF | |
|
13 | pick 177f92b77385 c | |
|
14 | pick 055a42cdd887 d | |
|
15 | pick bfa474341cc9 does not commute with e | |
|
16 | pick e860deea161a e | |
|
17 | pick 652413bf663e f | |
|
18 | EOF | |
|
19 | initrepo () | |
|
20 | { | |
|
21 | hg init r | |
|
22 | cd r | |
|
23 | for x in a b c d e f ; do | |
|
24 | echo $x > $x | |
|
25 | hg add $x | |
|
26 | hg ci -m $x | |
|
27 | done | |
|
28 | echo a >> e | |
|
29 | hg ci -m 'does not commute with e' | |
|
30 | } | |
|
34 | log before edit | |
|
35 | $ hg log --graph | |
|
36 | @ changeset: 6:bfa474341cc9 | |
|
37 | | tag: tip | |
|
38 | | user: test | |
|
39 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
40 | | summary: does not commute with e | |
|
41 | | | |
|
42 | o changeset: 5:652413bf663e | |
|
43 | | user: test | |
|
44 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
45 | | summary: f | |
|
46 | | | |
|
47 | o changeset: 4:e860deea161a | |
|
48 | | user: test | |
|
49 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
50 | | summary: e | |
|
51 | | | |
|
52 | o changeset: 3:055a42cdd887 | |
|
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 | |
|
35 | hg log --graph | |
|
36 | ||
|
37 | echo % edit the history | |
|
38 | HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle | |
|
88 | abort the edit | |
|
89 | $ hg histedit --abort 2>&1 | fixbundle | |
|
90 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
39 | 91 | |
|
40 | echo '% fix up (pre abort)' | |
|
41 | echo a > e | |
|
42 | hg add e | |
|
43 | hg histedit --continue 2>&1 | fixbundle | |
|
92 | log after abort | |
|
93 | $ hg log --graph | |
|
94 | @ changeset: 6:bfa474341cc9 | |
|
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 | |
|
129 | ||
|
44 | 130 | |
|
45 | echo % abort the edit | |
|
46 | hg histedit --abort 2>&1 | fixbundle | |
|
47 | ||
|
48 | echo % log after abort | |
|
49 | hg log --graph | |
|
50 | echo % EOF | |
|
131 | $ cd .. |
@@ -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 | |
|
6 | [extensions] | |
|
7 | graphlog= | |
|
8 | histedit= | |
|
9 | EOF | |
|
9 | $ EDITED=`pwd`/editedhistory | |
|
10 | $ cat > $EDITED <<EOF | |
|
11 | > pick 177f92b77385 c | |
|
12 | > pick 055a42cdd887 d | |
|
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 | |
|
12 | cat > $EDITED <<EOF | |
|
13 | pick 177f92b77385 c | |
|
14 | pick 055a42cdd887 d | |
|
15 | pick bfa474341cc9 does not commute with e | |
|
16 | pick e860deea161a e | |
|
17 | pick 652413bf663e f | |
|
18 | EOF | |
|
19 | initrepo () | |
|
20 | { | |
|
21 | hg init r | |
|
22 | cd r | |
|
23 | for x in a b c d e f ; do | |
|
24 | echo $x > $x | |
|
25 | hg add $x | |
|
26 | hg ci -m $x | |
|
27 | done | |
|
28 | echo a >> e | |
|
29 | hg ci -m 'does not commute with e' | |
|
30 | } | |
|
34 | log before edit | |
|
35 | $ hg log --graph | |
|
36 | @ changeset: 6:bfa474341cc9 | |
|
37 | | tag: tip | |
|
38 | | user: test | |
|
39 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
40 | | summary: does not commute with e | |
|
41 | | | |
|
42 | o changeset: 5:652413bf663e | |
|
43 | | user: test | |
|
44 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
45 | | summary: f | |
|
46 | | | |
|
47 | o changeset: 4:e860deea161a | |
|
48 | | user: test | |
|
49 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
50 | | summary: e | |
|
51 | | | |
|
52 | o changeset: 3:055a42cdd887 | |
|
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 | |
|
33 | ||
|
34 | echo % log before edit | |
|
35 | hg log --graph | |
|
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 | |
|
36 | 78 | |
|
37 | echo % edit the history | |
|
38 |
|
|
|
79 | abort the edit | |
|
80 | $ hg histedit --abort 2>&1 | fixbundle | |
|
81 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
39 | 82 | |
|
40 | echo % abort the edit | |
|
41 | hg histedit --abort 2>&1 | fixbundle | |
|
83 | ||
|
84 | second edit set | |
|
42 | 85 | |
|
43 | echo | |
|
44 | echo | |
|
45 | echo % second edit set | |
|
46 | ||
|
47 | hg log --graph | |
|
48 | ||
|
49 | echo % edit the history | |
|
50 | HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle | |
|
86 | $ hg log --graph | |
|
87 | @ changeset: 6:bfa474341cc9 | |
|
88 | | tag: tip | |
|
89 | | user: test | |
|
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 | |
|
122 | ||
|
51 | 123 | |
|
52 | echo % fix up | |
|
53 | echo a > e | |
|
54 | hg add e | |
|
55 | hg histedit --continue 2>&1 | fixbundle | |
|
124 | edit the history | |
|
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 | |
|
56 | 129 | |
|
57 | echo | |
|
58 | echo % just continue this time | |
|
59 | hg histedit --continue 2>&1 | fixbundle | |
|
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 | |
|
60 | 138 | |
|
61 | echo % log after edit | |
|
62 | hg log --graph | |
|
63 | ||
|
64 | echo % start over | |
|
139 | just continue this time | |
|
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 | |
|
65 | 143 | |
|
66 | cd .. | |
|
67 | rm -r r | |
|
68 | initrepo | |
|
69 | cat > $EDITED <<EOF | |
|
70 | pick 177f92b77385 c | |
|
71 | pick 055a42cdd887 d | |
|
72 | mess bfa474341cc9 does not commute with e | |
|
73 | pick e860deea161a e | |
|
74 | pick 652413bf663e f | |
|
75 | EOF | |
|
144 | log after edit | |
|
145 | $ hg log --graph | |
|
146 | @ changeset: 5:9ab84894b459 | |
|
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 | |
|
176 | ||
|
177 | ||
|
178 | start over | |
|
179 | ||
|
180 | $ cd .. | |
|
181 | ||
|
182 | $ initrepo r2 | |
|
183 | $ cd r2 | |
|
184 | $ cat > $EDITED <<EOF | |
|
185 | > pick 177f92b77385 c | |
|
186 | > pick 055a42cdd887 d | |
|
187 | > mess bfa474341cc9 does not commute with e | |
|
188 | > pick e860deea161a e | |
|
189 | > pick 652413bf663e f | |
|
190 | > EOF | |
|
76 | 191 | |
|
77 |
|
|
|
78 | HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle | |
|
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 | |
|
79 | 209 | |
|
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 | |
|
210 | post message fix | |
|
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 | |
|
242 | ||
|
86 | 243 | |
|
87 | echo % post message fix | |
|
88 | hg log --graph | |
|
89 | ||
|
90 | echo % EOF | |
|
244 | $ cd .. |
@@ -1,61 +1,91 b'' | |||
|
1 | #!/bin/sh | |
|
2 | ||
|
3 | cat >> $HGRCPATH <<EOF | |
|
4 | [extensions] | |
|
5 | graphlog= | |
|
6 | histedit= | |
|
7 | EOF | |
|
1 | $ cat >> $HGRCPATH <<EOF | |
|
2 | > [extensions] | |
|
3 | > graphlog= | |
|
4 | > histedit= | |
|
5 | > EOF | |
|
8 | 6 | |
|
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 ; do | |
|
21 | echo $x > $x | |
|
22 | hg add $x | |
|
23 | hg ci -m $x | |
|
24 | done | |
|
7 | $ EDITED=`pwd`/editedhistory | |
|
8 | $ cat > $EDITED <<EOF | |
|
9 | > pick 177f92b77385 c | |
|
10 | > pick e860deea161a e | |
|
11 | > pick 652413bf663e f | |
|
12 | > pick 055a42cdd887 d | |
|
13 | > EOF | |
|
14 | $ initrepos () | |
|
15 | > { | |
|
16 | > hg init r | |
|
17 | > cd r | |
|
18 | > for x in a b c ; do | |
|
19 | > echo $x > $x | |
|
20 | > hg add $x | |
|
21 | > hg ci -m $x | |
|
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 .. | |
|
27 | hg clone r r2 | grep -v updating | |
|
28 | cd r2 | |
|
29 | for x in d e f ; do | |
|
30 | echo $x > $x | |
|
31 | hg add $x | |
|
32 | hg ci -m $x | |
|
33 | done | |
|
45 | show the edit commands offered by outgoing | |
|
46 | $ cd r2 | |
|
47 | $ HGEDITOR=cat hg histedit --outgoing ../r | grep -v comparing | grep -v searching | |
|
48 | pick 055a42cdd887 3 d | |
|
49 | pick e860deea161a 4 e | |
|
50 | pick 652413bf663e 5 f | |
|
51 | ||
|
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 .. | |
|
36 | hg init r3 | |
|
37 | cd r3 | |
|
38 | for x in g h i ; do | |
|
39 | echo $x > $x | |
|
40 | hg add $x | |
|
41 | hg ci -m $x | |
|
42 | done | |
|
43 | cd .. | |
|
44 | } | |
|
45 | ||
|
46 | initrepo | |
|
64 | show the error from unrelated repos | |
|
65 | $ cd r3 | |
|
66 | $ HGEDITOR=cat hg histedit --outgoing ../r | grep -v comparing | grep -v searching | |
|
67 | abort: repository is unrelated | |
|
68 | [1] | |
|
69 | $ cd .. | |
|
47 | 70 | |
|
48 | echo % show the edit commands offered by outgoing | |
|
49 | cd r2 | |
|
50 |
HGEDITOR=cat hg histedit --outgoing ../r |
|
|
51 | cd .. | |
|
52 | ||
|
53 | echo % show the error from unrelated repos | |
|
54 | cd r3 | |
|
55 | HGEDITOR=cat hg histedit --outgoing ../r | grep -v comparing | grep -v searching | |
|
56 | cd .. | |
|
57 | ||
|
58 | echo % show the error from unrelated repos | |
|
59 | cd r3 | |
|
60 | HGEDITOR=cat hg histedit --force --outgoing ../r | |
|
61 | cd .. | |
|
71 | show the error from unrelated repos | |
|
72 | $ cd r3 | |
|
73 | $ HGEDITOR=cat hg histedit --force --outgoing ../r | |
|
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 | |
|
80 | ||
|
81 | # Edit history between 2a4042b45417 and 51281e65ba79 | |
|
82 | # | |
|
83 | # Commands: | |
|
84 | # p, pick = use commit | |
|
85 | # e, edit = use commit, but stop for amending | |
|
86 | # f, fold = use commit, but fold into previous commit (combines N and N-1) | |
|
87 | # d, drop = remove commit from history | |
|
88 | # m, mess = edit message without changing commit content | |
|
89 | # | |
|
90 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
91 | $ cd .. |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now