Show More
@@ -1,261 +1,295 | |||||
1 | $ . "$TESTDIR/histedit-helpers.sh" |
|
1 | $ . "$TESTDIR/histedit-helpers.sh" | |
2 |
|
2 | |||
3 | $ cat >> $HGRCPATH <<EOF |
|
3 | $ cat >> $HGRCPATH <<EOF | |
4 | > [extensions] |
|
4 | > [extensions] | |
5 | > graphlog= |
|
5 | > graphlog= | |
6 | > histedit= |
|
6 | > histedit= | |
7 | > EOF |
|
7 | > EOF | |
8 |
|
8 | |||
9 | $ EDITED="$TESTTMP/editedhistory" |
|
9 | $ EDITED="$TESTTMP/editedhistory" | |
10 | $ cat > $EDITED <<EOF |
|
10 | $ cat > $EDITED <<EOF | |
11 | > pick e860deea161a e |
|
11 | > pick e860deea161a e | |
12 | > pick 652413bf663e f |
|
12 | > pick 652413bf663e f | |
13 | > fold 177f92b77385 c |
|
13 | > fold 177f92b77385 c | |
14 | > pick 055a42cdd887 d |
|
14 | > pick 055a42cdd887 d | |
15 | > EOF |
|
15 | > EOF | |
16 | $ initrepo () |
|
16 | $ initrepo () | |
17 | > { |
|
17 | > { | |
18 | > hg init r |
|
18 | > hg init r | |
19 | > cd r |
|
19 | > cd r | |
20 | > for x in a b c d e f ; do |
|
20 | > for x in a b c d e f ; do | |
21 | > echo $x > $x |
|
21 | > echo $x > $x | |
22 | > hg add $x |
|
22 | > hg add $x | |
23 | > hg ci -m $x |
|
23 | > hg ci -m $x | |
24 | > done |
|
24 | > done | |
25 | > } |
|
25 | > } | |
26 |
|
26 | |||
27 | $ initrepo |
|
27 | $ initrepo | |
28 |
|
28 | |||
29 | log before edit |
|
29 | log before edit | |
30 | $ hg log --graph |
|
30 | $ hg log --graph | |
31 | @ changeset: 5:652413bf663e |
|
31 | @ changeset: 5:652413bf663e | |
32 | | tag: tip |
|
32 | | tag: tip | |
33 | | user: test |
|
33 | | user: test | |
34 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
34 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
35 | | summary: f |
|
35 | | summary: f | |
36 | | |
|
36 | | | |
37 | o changeset: 4:e860deea161a |
|
37 | o changeset: 4:e860deea161a | |
38 | | user: test |
|
38 | | user: test | |
39 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
39 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
40 | | summary: e |
|
40 | | summary: e | |
41 | | |
|
41 | | | |
42 | o changeset: 3:055a42cdd887 |
|
42 | o changeset: 3:055a42cdd887 | |
43 | | user: test |
|
43 | | user: test | |
44 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
44 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
45 | | summary: d |
|
45 | | summary: d | |
46 | | |
|
46 | | | |
47 | o changeset: 2:177f92b77385 |
|
47 | o changeset: 2:177f92b77385 | |
48 | | user: test |
|
48 | | user: test | |
49 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
49 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
50 | | summary: c |
|
50 | | summary: c | |
51 | | |
|
51 | | | |
52 | o changeset: 1:d2ae7f538514 |
|
52 | o changeset: 1:d2ae7f538514 | |
53 | | user: test |
|
53 | | user: test | |
54 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
54 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
55 | | summary: b |
|
55 | | summary: b | |
56 | | |
|
56 | | | |
57 | o changeset: 0:cb9a9f314b8b |
|
57 | o changeset: 0:cb9a9f314b8b | |
58 | user: test |
|
58 | user: test | |
59 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
59 | date: Thu Jan 01 00:00:00 1970 +0000 | |
60 | summary: a |
|
60 | summary: a | |
61 |
|
61 | |||
62 |
|
62 | |||
63 | edit the history |
|
63 | edit the history | |
64 | $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle |
|
64 | $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle | |
65 | 0 files updated, 0 files merged, 4 files removed, 0 files unresolved |
|
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 |
|
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 |
|
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 |
|
68 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
69 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
69 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
70 | 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 | |
71 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
71 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
72 |
|
72 | |||
73 | log after edit |
|
73 | log after edit | |
74 | $ hg log --graph |
|
74 | $ hg log --graph | |
75 | @ changeset: 4:82b0c1ff1777 |
|
75 | @ changeset: 4:82b0c1ff1777 | |
76 | | tag: tip |
|
76 | | tag: tip | |
77 | | user: test |
|
77 | | user: test | |
78 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
78 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
79 | | summary: d |
|
79 | | summary: d | |
80 | | |
|
80 | | | |
81 | o changeset: 3:150aafb44a91 |
|
81 | o changeset: 3:150aafb44a91 | |
82 | | user: test |
|
82 | | user: test | |
83 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
83 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
84 | | summary: pick e860deea161a e |
|
84 | | summary: pick e860deea161a e | |
85 | | |
|
85 | | | |
86 | o changeset: 2:493dc0964412 |
|
86 | o changeset: 2:493dc0964412 | |
87 | | user: test |
|
87 | | user: test | |
88 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
88 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
89 | | summary: e |
|
89 | | summary: e | |
90 | | |
|
90 | | | |
91 | o changeset: 1:d2ae7f538514 |
|
91 | o changeset: 1:d2ae7f538514 | |
92 | | user: test |
|
92 | | user: test | |
93 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
93 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
94 | | summary: b |
|
94 | | summary: b | |
95 | | |
|
95 | | | |
96 | o changeset: 0:cb9a9f314b8b |
|
96 | o changeset: 0:cb9a9f314b8b | |
97 | user: test |
|
97 | user: test | |
98 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
98 | date: Thu Jan 01 00:00:00 1970 +0000 | |
99 | summary: a |
|
99 | summary: a | |
100 |
|
100 | |||
101 |
|
101 | |||
102 | post-fold manifest |
|
102 | post-fold manifest | |
103 | $ hg manifest |
|
103 | $ hg manifest | |
104 | a |
|
104 | a | |
105 | b |
|
105 | b | |
106 | c |
|
106 | c | |
107 | d |
|
107 | d | |
108 | e |
|
108 | e | |
109 | f |
|
109 | f | |
110 |
|
110 | |||
111 | $ cd .. |
|
111 | $ cd .. | |
112 |
|
112 | |||
113 | folding and creating no new change doesn't break: |
|
113 | folding and creating no new change doesn't break: | |
114 | $ mkdir fold-to-empty-test |
|
114 | $ mkdir fold-to-empty-test | |
115 | $ cd fold-to-empty-test |
|
115 | $ cd fold-to-empty-test | |
116 | $ hg init |
|
116 | $ hg init | |
117 | $ printf "1\n2\n3\n" > file |
|
117 | $ printf "1\n2\n3\n" > file | |
118 | $ hg add file |
|
118 | $ hg add file | |
119 | $ hg commit -m '1+2+3' |
|
119 | $ hg commit -m '1+2+3' | |
120 | $ echo 4 >> file |
|
120 | $ echo 4 >> file | |
121 | $ hg commit -m '+4' |
|
121 | $ hg commit -m '+4' | |
122 | $ echo 5 >> file |
|
122 | $ echo 5 >> file | |
123 | $ hg commit -m '+5' |
|
123 | $ hg commit -m '+5' | |
124 | $ echo 6 >> file |
|
124 | $ echo 6 >> file | |
125 | $ hg commit -m '+6' |
|
125 | $ hg commit -m '+6' | |
126 | $ hg log --graph |
|
126 | $ hg log --graph | |
127 | @ changeset: 3:251d831eeec5 |
|
127 | @ changeset: 3:251d831eeec5 | |
128 | | tag: tip |
|
128 | | tag: tip | |
129 | | user: test |
|
129 | | user: test | |
130 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
130 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
131 | | summary: +6 |
|
131 | | summary: +6 | |
132 | | |
|
132 | | | |
133 | o changeset: 2:888f9082bf99 |
|
133 | o changeset: 2:888f9082bf99 | |
134 | | user: test |
|
134 | | user: test | |
135 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
135 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
136 | | summary: +5 |
|
136 | | summary: +5 | |
137 | | |
|
137 | | | |
138 | o changeset: 1:617f94f13c0f |
|
138 | o changeset: 1:617f94f13c0f | |
139 | | user: test |
|
139 | | user: test | |
140 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
140 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
141 | | summary: +4 |
|
141 | | summary: +4 | |
142 | | |
|
142 | | | |
143 | o changeset: 0:0189ba417d34 |
|
143 | o changeset: 0:0189ba417d34 | |
144 | user: test |
|
144 | user: test | |
145 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
145 | date: Thu Jan 01 00:00:00 1970 +0000 | |
146 | summary: 1+2+3 |
|
146 | summary: 1+2+3 | |
147 |
|
147 | |||
148 |
|
148 | |||
149 | $ cat > editor.py <<EOF |
|
149 | $ cat > editor.py <<EOF | |
150 | > import re, sys |
|
150 | > import re, sys | |
151 | > rules = sys.argv[1] |
|
151 | > rules = sys.argv[1] | |
152 | > data = open(rules).read() |
|
152 | > data = open(rules).read() | |
153 | > data = re.sub(r'pick ([0-9a-f]{12} 2 \+5)', r'drop \1', data) |
|
153 | > data = re.sub(r'pick ([0-9a-f]{12} 2 \+5)', r'drop \1', data) | |
154 | > data = re.sub(r'pick ([0-9a-f]{12} 2 \+6)', r'fold \1', data) |
|
154 | > data = re.sub(r'pick ([0-9a-f]{12} 2 \+6)', r'fold \1', data) | |
155 | > open(rules, 'w').write(data) |
|
155 | > open(rules, 'w').write(data) | |
156 | > EOF |
|
156 | > EOF | |
157 |
|
157 | |||
158 | $ HGEDITOR='python editor.py' hg histedit 1 |
|
158 | $ HGEDITOR='python editor.py' hg histedit 1 | |
159 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
159 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
160 | merging file |
|
160 | merging file | |
161 | warning: conflicts during merge. |
|
161 | warning: conflicts during merge. | |
162 | merging file incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
162 | merging file incomplete! (edit conflicts, then use 'hg resolve --mark') | |
163 | abort: Fix up the change and run hg histedit --continue |
|
163 | abort: Fix up the change and run hg histedit --continue | |
164 | [255] |
|
164 | [255] | |
165 | There were conflicts, we keep P1 content. This |
|
165 | There were conflicts, we keep P1 content. This | |
166 | should effectively drop the changes from +6. |
|
166 | should effectively drop the changes from +6. | |
167 | $ hg status |
|
167 | $ hg status | |
168 | M file |
|
168 | M file | |
169 | ? editor.py |
|
169 | ? editor.py | |
170 | ? file.orig |
|
170 | ? file.orig | |
171 | $ hg resolve -l |
|
171 | $ hg resolve -l | |
172 | U file |
|
172 | U file | |
173 | $ hg revert -r 'p1()' file |
|
173 | $ hg revert -r 'p1()' file | |
174 | $ hg resolve --mark file |
|
174 | $ hg resolve --mark file | |
175 | $ hg histedit --continue |
|
175 | $ hg histedit --continue | |
176 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
176 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
177 | saved backup bundle to $TESTTMP/*-backup.hg (glob) |
|
177 | saved backup bundle to $TESTTMP/*-backup.hg (glob) | |
178 | $ hg log --graph |
|
178 | $ hg log --graph | |
179 | @ changeset: 1:617f94f13c0f |
|
179 | @ changeset: 1:617f94f13c0f | |
180 | | tag: tip |
|
180 | | tag: tip | |
181 | | user: test |
|
181 | | user: test | |
182 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
182 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
183 | | summary: +4 |
|
183 | | summary: +4 | |
184 | | |
|
184 | | | |
185 | o changeset: 0:0189ba417d34 |
|
185 | o changeset: 0:0189ba417d34 | |
186 | user: test |
|
186 | user: test | |
187 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
187 | date: Thu Jan 01 00:00:00 1970 +0000 | |
188 | summary: 1+2+3 |
|
188 | summary: 1+2+3 | |
189 |
|
189 | |||
190 |
|
190 | |||
191 | $ cd .. |
|
191 | $ cd .. | |
192 |
|
192 | |||
193 | Test corner case where folded revision is separated from its parent by a |
|
193 | Test corner case where folded revision is separated from its parent by a | |
194 | dropped revision. |
|
194 | dropped revision. | |
195 |
|
195 | |||
196 |
|
196 | |||
197 | $ hg init fold-with-dropped |
|
197 | $ hg init fold-with-dropped | |
198 | $ cd fold-with-dropped |
|
198 | $ cd fold-with-dropped | |
199 | $ printf "1\n2\n3\n" > file |
|
199 | $ printf "1\n2\n3\n" > file | |
200 | $ hg commit -Am '1+2+3' |
|
200 | $ hg commit -Am '1+2+3' | |
201 | adding file |
|
201 | adding file | |
202 | $ echo 4 >> file |
|
202 | $ echo 4 >> file | |
203 | $ hg commit -m '+4' |
|
203 | $ hg commit -m '+4' | |
204 | $ echo 5 >> file |
|
204 | $ echo 5 >> file | |
205 | $ hg commit -m '+5' |
|
205 | $ hg commit -m '+5' | |
206 | $ echo 6 >> file |
|
206 | $ echo 6 >> file | |
207 | $ hg commit -m '+6' |
|
207 | $ hg commit -m '+6' | |
208 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' |
|
208 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' | |
209 | @ 3:251d831eeec5 +6 |
|
209 | @ 3:251d831eeec5 +6 | |
210 | | |
|
210 | | | |
211 | o 2:888f9082bf99 +5 |
|
211 | o 2:888f9082bf99 +5 | |
212 | | |
|
212 | | | |
213 | o 1:617f94f13c0f +4 |
|
213 | o 1:617f94f13c0f +4 | |
214 | | |
|
214 | | | |
215 | o 0:0189ba417d34 1+2+3 |
|
215 | o 0:0189ba417d34 1+2+3 | |
216 |
|
216 | |||
217 | $ EDITED="$TESTTMP/editcommands" |
|
217 | $ EDITED="$TESTTMP/editcommands" | |
218 | $ cat > $EDITED <<EOF |
|
218 | $ cat > $EDITED <<EOF | |
219 | > pick 617f94f13c0f 1 +4 |
|
219 | > pick 617f94f13c0f 1 +4 | |
220 | > drop 888f9082bf99 2 +5 |
|
220 | > drop 888f9082bf99 2 +5 | |
221 | > fold 251d831eeec5 3 +6 |
|
221 | > fold 251d831eeec5 3 +6 | |
222 | > EOF |
|
222 | > EOF | |
223 | $ HGEDITOR="cat $EDITED >" hg histedit 1 |
|
223 | $ HGEDITOR="cat $EDITED >" hg histedit 1 | |
224 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
224 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
225 | merging file |
|
225 | merging file | |
226 | warning: conflicts during merge. |
|
226 | warning: conflicts during merge. | |
227 | merging file incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
227 | merging file incomplete! (edit conflicts, then use 'hg resolve --mark') | |
228 | abort: Fix up the change and run hg histedit --continue |
|
228 | abort: Fix up the change and run hg histedit --continue | |
229 | [255] |
|
229 | [255] | |
230 | $ cat > file << EOF |
|
230 | $ cat > file << EOF | |
231 | > 1 |
|
231 | > 1 | |
232 | > 2 |
|
232 | > 2 | |
233 | > 3 |
|
233 | > 3 | |
234 | > 4 |
|
234 | > 4 | |
235 | > 5 |
|
235 | > 5 | |
236 | > EOF |
|
236 | > EOF | |
237 | $ hg resolve --mark file |
|
237 | $ hg resolve --mark file | |
238 | $ hg commit -m '+5.2' |
|
238 | $ hg commit -m '+5.2' | |
239 | created new head |
|
239 | created new head | |
240 | $ echo 6 >> file |
|
240 | $ echo 6 >> file | |
241 | $ HGEDITOR=cat hg histedit --continue |
|
241 | $ HGEDITOR=cat hg histedit --continue | |
242 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
242 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
243 | +4 |
|
243 | +4 | |
244 | *** |
|
244 | *** | |
245 | +5.2 |
|
245 | +5.2 | |
246 | *** |
|
246 | *** | |
247 | +6 |
|
247 | +6 | |
248 |
|
248 | |||
249 |
|
249 | |||
250 |
|
250 | |||
251 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
251 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
252 | HG: Leave message empty to abort commit. |
|
252 | HG: Leave message empty to abort commit. | |
253 | HG: -- |
|
253 | HG: -- | |
254 | HG: user: test |
|
254 | HG: user: test | |
255 | HG: branch 'default' |
|
255 | HG: branch 'default' | |
256 | HG: changed file |
|
256 | HG: changed file | |
257 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
257 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
258 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
258 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
259 | saved backup bundle to $TESTTMP/fold-with-dropped/.hg/strip-backup/617f94f13c0f-backup.hg (glob) |
|
259 | saved backup bundle to $TESTTMP/fold-with-dropped/.hg/strip-backup/617f94f13c0f-backup.hg (glob) | |
|
260 | $ hg log -G | |||
|
261 | @ changeset: 1:e29e02896e6c | |||
|
262 | | tag: tip | |||
|
263 | | user: test | |||
|
264 | | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
265 | | summary: +4 | |||
|
266 | | | |||
|
267 | o changeset: 0:0189ba417d34 | |||
|
268 | user: test | |||
|
269 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
270 | summary: 1+2+3 | |||
|
271 | ||||
|
272 | $ hg export tip | |||
|
273 | # HG changeset patch | |||
|
274 | # User test | |||
|
275 | # Date 0 0 | |||
|
276 | # Node ID e29e02896e6c2b149d2228a0a64b4f3a9a4237f3 | |||
|
277 | # Parent 0189ba417d34df9dda55f88b637dcae9917b5964 | |||
|
278 | +4 | |||
|
279 | *** | |||
|
280 | +5.2 | |||
|
281 | *** | |||
|
282 | +6 | |||
|
283 | ||||
|
284 | diff -r 0189ba417d34 -r e29e02896e6c file | |||
|
285 | --- a/file Thu Jan 01 00:00:00 1970 +0000 | |||
|
286 | +++ b/file Thu Jan 01 00:00:00 1970 +0000 | |||
|
287 | @@ -1,3 +1,6 @@ | |||
|
288 | 1 | |||
|
289 | 2 | |||
|
290 | 3 | |||
|
291 | +4 | |||
|
292 | +5 | |||
|
293 | +6 | |||
260 | $ cd .. |
|
294 | $ cd .. | |
261 |
|
295 |
General Comments 0
You need to be logged in to leave comments.
Login now