Show More
@@ -1,588 +1,588 b'' | |||||
1 | Test histedit extension: Fold commands |
|
1 | Test histedit extension: Fold commands | |
2 | ====================================== |
|
2 | ====================================== | |
3 |
|
3 | |||
4 | This test file is dedicated to testing the fold command in non conflicting |
|
4 | This test file is dedicated to testing the fold command in non conflicting | |
5 | case. |
|
5 | case. | |
6 |
|
6 | |||
7 | Initialization |
|
7 | Initialization | |
8 | --------------- |
|
8 | --------------- | |
9 |
|
9 | |||
10 |
|
10 | |||
11 | $ . "$TESTDIR/histedit-helpers.sh" |
|
11 | $ . "$TESTDIR/histedit-helpers.sh" | |
12 |
|
12 | |||
13 | $ cat >> $HGRCPATH <<EOF |
|
13 | $ cat >> $HGRCPATH <<EOF | |
14 | > [alias] |
|
14 | > [alias] | |
15 | > logt = log --template '{rev}:{node|short} {desc|firstline}\n' |
|
15 | > logt = log --template '{rev}:{node|short} {desc|firstline}\n' | |
16 | > [extensions] |
|
16 | > [extensions] | |
17 | > histedit= |
|
17 | > histedit= | |
18 | > EOF |
|
18 | > EOF | |
19 |
|
19 | |||
20 |
|
20 | |||
21 | Simple folding |
|
21 | Simple folding | |
22 | -------------------- |
|
22 | -------------------- | |
23 | $ addwithdate () |
|
23 | $ addwithdate () | |
24 | > { |
|
24 | > { | |
25 | > echo $1 > $1 |
|
25 | > echo $1 > $1 | |
26 | > hg add $1 |
|
26 | > hg add $1 | |
27 | > hg ci -m $1 -d "$2 0" |
|
27 | > hg ci -m $1 -d "$2 0" | |
28 | > } |
|
28 | > } | |
29 |
|
29 | |||
30 | $ initrepo () |
|
30 | $ initrepo () | |
31 | > { |
|
31 | > { | |
32 | > hg init r |
|
32 | > hg init r | |
33 | > cd r |
|
33 | > cd r | |
34 | > addwithdate a 1 |
|
34 | > addwithdate a 1 | |
35 | > addwithdate b 2 |
|
35 | > addwithdate b 2 | |
36 | > addwithdate c 3 |
|
36 | > addwithdate c 3 | |
37 | > addwithdate d 4 |
|
37 | > addwithdate d 4 | |
38 | > addwithdate e 5 |
|
38 | > addwithdate e 5 | |
39 | > addwithdate f 6 |
|
39 | > addwithdate f 6 | |
40 | > } |
|
40 | > } | |
41 |
|
41 | |||
42 | $ initrepo |
|
42 | $ initrepo | |
43 |
|
43 | |||
44 | log before edit |
|
44 | log before edit | |
45 | $ hg logt --graph |
|
45 | $ hg logt --graph | |
46 | @ 5:178e35e0ce73 f |
|
46 | @ 5:178e35e0ce73 f | |
47 | | |
|
47 | | | |
48 | o 4:1ddb6c90f2ee e |
|
48 | o 4:1ddb6c90f2ee e | |
49 | | |
|
49 | | | |
50 | o 3:532247a8969b d |
|
50 | o 3:532247a8969b d | |
51 | | |
|
51 | | | |
52 | o 2:ff2c9fa2018b c |
|
52 | o 2:ff2c9fa2018b c | |
53 | | |
|
53 | | | |
54 | o 1:97d72e5f12c7 b |
|
54 | o 1:97d72e5f12c7 b | |
55 | | |
|
55 | | | |
56 | o 0:8580ff50825a a |
|
56 | o 0:8580ff50825a a | |
57 |
|
57 | |||
58 |
|
58 | |||
59 | $ hg histedit ff2c9fa2018b --commands - 2>&1 <<EOF | fixbundle |
|
59 | $ hg histedit ff2c9fa2018b --commands - 2>&1 <<EOF | fixbundle | |
60 | > pick 1ddb6c90f2ee e |
|
60 | > pick 1ddb6c90f2ee e | |
61 | > pick 178e35e0ce73 f |
|
61 | > pick 178e35e0ce73 f | |
62 | > fold ff2c9fa2018b c |
|
62 | > fold ff2c9fa2018b c | |
63 | > pick 532247a8969b d |
|
63 | > pick 532247a8969b d | |
64 | > EOF |
|
64 | > EOF | |
65 |
|
65 | |||
66 | log after edit |
|
66 | log after edit | |
67 | $ hg logt --graph |
|
67 | $ hg logt --graph | |
68 | @ 4:c4d7f3def76d d |
|
68 | @ 4:c4d7f3def76d d | |
69 | | |
|
69 | | | |
70 | o 3:575228819b7e f |
|
70 | o 3:575228819b7e f | |
71 | | |
|
71 | | | |
72 | o 2:505a591af19e e |
|
72 | o 2:505a591af19e e | |
73 | | |
|
73 | | | |
74 | o 1:97d72e5f12c7 b |
|
74 | o 1:97d72e5f12c7 b | |
75 | | |
|
75 | | | |
76 | o 0:8580ff50825a a |
|
76 | o 0:8580ff50825a a | |
77 |
|
77 | |||
78 |
|
78 | |||
79 | post-fold manifest |
|
79 | post-fold manifest | |
80 | $ hg manifest |
|
80 | $ hg manifest | |
81 | a |
|
81 | a | |
82 | b |
|
82 | b | |
83 | c |
|
83 | c | |
84 | d |
|
84 | d | |
85 | e |
|
85 | e | |
86 | f |
|
86 | f | |
87 |
|
87 | |||
88 |
|
88 | |||
89 | check histedit_source, including that it uses the later date, from the first changeset |
|
89 | check histedit_source, including that it uses the later date, from the first changeset | |
90 |
|
90 | |||
91 | $ hg log --debug --rev 3 |
|
91 | $ hg log --debug --rev 3 | |
92 | changeset: 3:575228819b7e6ed69e8c0a6a383ee59a80db7358 |
|
92 | changeset: 3:575228819b7e6ed69e8c0a6a383ee59a80db7358 | |
93 | phase: draft |
|
93 | phase: draft | |
94 | parent: 2:505a591af19eed18f560af827b9e03d2076773dc |
|
94 | parent: 2:505a591af19eed18f560af827b9e03d2076773dc | |
95 | parent: -1:0000000000000000000000000000000000000000 |
|
95 | parent: -1:0000000000000000000000000000000000000000 | |
96 | manifest: 3:81eede616954057198ead0b2c73b41d1f392829a |
|
96 | manifest: 3:81eede616954057198ead0b2c73b41d1f392829a | |
97 | user: test |
|
97 | user: test | |
98 | date: Thu Jan 01 00:00:06 1970 +0000 |
|
98 | date: Thu Jan 01 00:00:06 1970 +0000 | |
99 | files+: c f |
|
99 | files+: c f | |
100 | extra: branch=default |
|
100 | extra: branch=default | |
101 | extra: histedit_source=7cad1d7030207872dfd1c3a7cb430f24f2884086,ff2c9fa2018b15fa74b33363bda9527323e2a99f |
|
101 | extra: histedit_source=7cad1d7030207872dfd1c3a7cb430f24f2884086,ff2c9fa2018b15fa74b33363bda9527323e2a99f | |
102 | description: |
|
102 | description: | |
103 | f |
|
103 | f | |
104 | *** |
|
104 | *** | |
105 | c |
|
105 | c | |
106 |
|
106 | |||
107 |
|
107 | |||
108 |
|
108 | |||
109 | rollup will fold without preserving the folded commit's message or date |
|
109 | rollup will fold without preserving the folded commit's message or date | |
110 |
|
110 | |||
111 | $ OLDHGEDITOR=$HGEDITOR |
|
111 | $ OLDHGEDITOR=$HGEDITOR | |
112 | $ HGEDITOR=false |
|
112 | $ HGEDITOR=false | |
113 | $ hg histedit 97d72e5f12c7 --commands - 2>&1 <<EOF | fixbundle |
|
113 | $ hg histedit 97d72e5f12c7 --commands - 2>&1 <<EOF | fixbundle | |
114 | > pick 97d72e5f12c7 b |
|
114 | > pick 97d72e5f12c7 b | |
115 | > roll 505a591af19e e |
|
115 | > roll 505a591af19e e | |
116 | > pick 575228819b7e f |
|
116 | > pick 575228819b7e f | |
117 | > pick c4d7f3def76d d |
|
117 | > pick c4d7f3def76d d | |
118 | > EOF |
|
118 | > EOF | |
119 |
|
119 | |||
120 | $ HGEDITOR=$OLDHGEDITOR |
|
120 | $ HGEDITOR=$OLDHGEDITOR | |
121 |
|
121 | |||
122 | log after edit |
|
122 | log after edit | |
123 | $ hg logt --graph |
|
123 | $ hg logt --graph | |
124 | @ 3:bab801520cec d |
|
124 | @ 3:bab801520cec d | |
125 | | |
|
125 | | | |
126 | o 2:58c8f2bfc151 f |
|
126 | o 2:58c8f2bfc151 f | |
127 | | |
|
127 | | | |
128 | o 1:5d939c56c72e b |
|
128 | o 1:5d939c56c72e b | |
129 | | |
|
129 | | | |
130 | o 0:8580ff50825a a |
|
130 | o 0:8580ff50825a a | |
131 |
|
131 | |||
132 |
|
132 | |||
133 | description is taken from rollup target commit |
|
133 | description is taken from rollup target commit | |
134 |
|
134 | |||
135 | $ hg log --debug --rev 1 |
|
135 | $ hg log --debug --rev 1 | |
136 | changeset: 1:5d939c56c72e77e29f5167696218e2131a40f5cf |
|
136 | changeset: 1:5d939c56c72e77e29f5167696218e2131a40f5cf | |
137 | phase: draft |
|
137 | phase: draft | |
138 | parent: 0:8580ff50825a50c8f716709acdf8de0deddcd6ab |
|
138 | parent: 0:8580ff50825a50c8f716709acdf8de0deddcd6ab | |
139 | parent: -1:0000000000000000000000000000000000000000 |
|
139 | parent: -1:0000000000000000000000000000000000000000 | |
140 | manifest: 1:b5e112a3a8354e269b1524729f0918662d847c38 |
|
140 | manifest: 1:b5e112a3a8354e269b1524729f0918662d847c38 | |
141 | user: test |
|
141 | user: test | |
142 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
142 | date: Thu Jan 01 00:00:02 1970 +0000 | |
143 | files+: b e |
|
143 | files+: b e | |
144 | extra: branch=default |
|
144 | extra: branch=default | |
145 | extra: histedit_source=97d72e5f12c7e84f85064aa72e5a297142c36ed9,505a591af19eed18f560af827b9e03d2076773dc |
|
145 | extra: histedit_source=97d72e5f12c7e84f85064aa72e5a297142c36ed9,505a591af19eed18f560af827b9e03d2076773dc | |
146 | description: |
|
146 | description: | |
147 | b |
|
147 | b | |
148 |
|
148 | |||
149 |
|
149 | |||
150 |
|
150 | |||
151 | check saving last-message.txt |
|
151 | check saving last-message.txt | |
152 |
|
152 | |||
153 | $ cat > $TESTTMP/abortfolding.py <<EOF |
|
153 | $ cat > $TESTTMP/abortfolding.py <<EOF | |
154 | > from mercurial import util |
|
154 | > from mercurial import util | |
155 | > def abortfolding(ui, repo, hooktype, **kwargs): |
|
155 | > def abortfolding(ui, repo, hooktype, **kwargs): | |
156 | > ctx = repo[kwargs.get('node')] |
|
156 | > ctx = repo[kwargs.get('node')] | |
157 |
> if set(ctx.files()) == {'c', 'd', 'f'}: |
|
157 | > if set(ctx.files()) == {b'c', b'd', b'f'}: | |
158 | > return True # abort folding commit only |
|
158 | > return True # abort folding commit only | |
159 |
> ui.warn('allow non-folding commit\\n') |
|
159 | > ui.warn(b'allow non-folding commit\\n') | |
160 | > EOF |
|
160 | > EOF | |
161 | $ cat > .hg/hgrc <<EOF |
|
161 | $ cat > .hg/hgrc <<EOF | |
162 | > [hooks] |
|
162 | > [hooks] | |
163 | > pretxncommit.abortfolding = python:$TESTTMP/abortfolding.py:abortfolding |
|
163 | > pretxncommit.abortfolding = python:$TESTTMP/abortfolding.py:abortfolding | |
164 | > EOF |
|
164 | > EOF | |
165 |
|
165 | |||
166 | $ cat > $TESTTMP/editor.sh << EOF |
|
166 | $ cat > $TESTTMP/editor.sh << EOF | |
167 | > echo "==== before editing" |
|
167 | > echo "==== before editing" | |
168 | > cat \$1 |
|
168 | > cat \$1 | |
169 | > echo "====" |
|
169 | > echo "====" | |
170 | > echo "check saving last-message.txt" >> \$1 |
|
170 | > echo "check saving last-message.txt" >> \$1 | |
171 | > EOF |
|
171 | > EOF | |
172 |
|
172 | |||
173 | $ rm -f .hg/last-message.txt |
|
173 | $ rm -f .hg/last-message.txt | |
174 | $ hg status --rev '58c8f2bfc151^1::bab801520cec' |
|
174 | $ hg status --rev '58c8f2bfc151^1::bab801520cec' | |
175 | A c |
|
175 | A c | |
176 | A d |
|
176 | A d | |
177 | A f |
|
177 | A f | |
178 | $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit 58c8f2bfc151 --commands - 2>&1 <<EOF |
|
178 | $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit 58c8f2bfc151 --commands - 2>&1 <<EOF | |
179 | > pick 58c8f2bfc151 f |
|
179 | > pick 58c8f2bfc151 f | |
180 | > fold bab801520cec d |
|
180 | > fold bab801520cec d | |
181 | > EOF |
|
181 | > EOF | |
182 | allow non-folding commit |
|
182 | allow non-folding commit | |
183 | ==== before editing |
|
183 | ==== before editing | |
184 | f |
|
184 | f | |
185 | *** |
|
185 | *** | |
186 | c |
|
186 | c | |
187 | *** |
|
187 | *** | |
188 | d |
|
188 | d | |
189 |
|
189 | |||
190 |
|
190 | |||
191 |
|
191 | |||
192 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
192 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
193 | HG: Leave message empty to abort commit. |
|
193 | HG: Leave message empty to abort commit. | |
194 | HG: -- |
|
194 | HG: -- | |
195 | HG: user: test |
|
195 | HG: user: test | |
196 | HG: branch 'default' |
|
196 | HG: branch 'default' | |
197 | HG: added c |
|
197 | HG: added c | |
198 | HG: added d |
|
198 | HG: added d | |
199 | HG: added f |
|
199 | HG: added f | |
200 | ==== |
|
200 | ==== | |
201 | transaction abort! |
|
201 | transaction abort! | |
202 | rollback completed |
|
202 | rollback completed | |
203 | abort: pretxncommit.abortfolding hook failed |
|
203 | abort: pretxncommit.abortfolding hook failed | |
204 | [255] |
|
204 | [255] | |
205 |
|
205 | |||
206 | $ cat .hg/last-message.txt |
|
206 | $ cat .hg/last-message.txt | |
207 | f |
|
207 | f | |
208 | *** |
|
208 | *** | |
209 | c |
|
209 | c | |
210 | *** |
|
210 | *** | |
211 | d |
|
211 | d | |
212 |
|
212 | |||
213 |
|
213 | |||
214 |
|
214 | |||
215 | check saving last-message.txt |
|
215 | check saving last-message.txt | |
216 |
|
216 | |||
217 | $ cd .. |
|
217 | $ cd .. | |
218 | $ rm -r r |
|
218 | $ rm -r r | |
219 |
|
219 | |||
220 | folding preserves initial author but uses later date |
|
220 | folding preserves initial author but uses later date | |
221 | ---------------------------------------------------- |
|
221 | ---------------------------------------------------- | |
222 |
|
222 | |||
223 | $ initrepo |
|
223 | $ initrepo | |
224 |
|
224 | |||
225 | $ hg ci -d '7 0' --user "someone else" --amend --quiet |
|
225 | $ hg ci -d '7 0' --user "someone else" --amend --quiet | |
226 |
|
226 | |||
227 | tip before edit |
|
227 | tip before edit | |
228 | $ hg log --rev . |
|
228 | $ hg log --rev . | |
229 | changeset: 5:10c36dd37515 |
|
229 | changeset: 5:10c36dd37515 | |
230 | tag: tip |
|
230 | tag: tip | |
231 | user: someone else |
|
231 | user: someone else | |
232 | date: Thu Jan 01 00:00:07 1970 +0000 |
|
232 | date: Thu Jan 01 00:00:07 1970 +0000 | |
233 | summary: f |
|
233 | summary: f | |
234 |
|
234 | |||
235 |
|
235 | |||
236 | $ hg --config progress.debug=1 --debug \ |
|
236 | $ hg --config progress.debug=1 --debug \ | |
237 | > histedit 1ddb6c90f2ee --commands - 2>&1 <<EOF | \ |
|
237 | > histedit 1ddb6c90f2ee --commands - 2>&1 <<EOF | \ | |
238 | > egrep 'editing|unresolved' |
|
238 | > egrep 'editing|unresolved' | |
239 | > pick 1ddb6c90f2ee e |
|
239 | > pick 1ddb6c90f2ee e | |
240 | > fold 10c36dd37515 f |
|
240 | > fold 10c36dd37515 f | |
241 | > EOF |
|
241 | > EOF | |
242 | editing: pick 1ddb6c90f2ee 4 e 1/2 changes (50.00%) |
|
242 | editing: pick 1ddb6c90f2ee 4 e 1/2 changes (50.00%) | |
243 | editing: fold 10c36dd37515 5 f 2/2 changes (100.00%) |
|
243 | editing: fold 10c36dd37515 5 f 2/2 changes (100.00%) | |
244 |
|
244 | |||
245 | tip after edit, which should use the later date, from the second changeset |
|
245 | tip after edit, which should use the later date, from the second changeset | |
246 | $ hg log --rev . |
|
246 | $ hg log --rev . | |
247 | changeset: 4:e4f3ec5d0b40 |
|
247 | changeset: 4:e4f3ec5d0b40 | |
248 | tag: tip |
|
248 | tag: tip | |
249 | user: test |
|
249 | user: test | |
250 | date: Thu Jan 01 00:00:07 1970 +0000 |
|
250 | date: Thu Jan 01 00:00:07 1970 +0000 | |
251 | summary: e |
|
251 | summary: e | |
252 |
|
252 | |||
253 |
|
253 | |||
254 | $ cd .. |
|
254 | $ cd .. | |
255 | $ rm -r r |
|
255 | $ rm -r r | |
256 |
|
256 | |||
257 | folding and creating no new change doesn't break: |
|
257 | folding and creating no new change doesn't break: | |
258 | ------------------------------------------------- |
|
258 | ------------------------------------------------- | |
259 |
|
259 | |||
260 | folded content is dropped during a merge. The folded commit should properly disappear. |
|
260 | folded content is dropped during a merge. The folded commit should properly disappear. | |
261 |
|
261 | |||
262 | $ mkdir fold-to-empty-test |
|
262 | $ mkdir fold-to-empty-test | |
263 | $ cd fold-to-empty-test |
|
263 | $ cd fold-to-empty-test | |
264 | $ hg init |
|
264 | $ hg init | |
265 | $ printf "1\n2\n3\n" > file |
|
265 | $ printf "1\n2\n3\n" > file | |
266 | $ hg add file |
|
266 | $ hg add file | |
267 | $ hg commit -m '1+2+3' |
|
267 | $ hg commit -m '1+2+3' | |
268 | $ echo 4 >> file |
|
268 | $ echo 4 >> file | |
269 | $ hg commit -m '+4' |
|
269 | $ hg commit -m '+4' | |
270 | $ echo 5 >> file |
|
270 | $ echo 5 >> file | |
271 | $ hg commit -m '+5' |
|
271 | $ hg commit -m '+5' | |
272 | $ echo 6 >> file |
|
272 | $ echo 6 >> file | |
273 | $ hg commit -m '+6' |
|
273 | $ hg commit -m '+6' | |
274 | $ hg logt --graph |
|
274 | $ hg logt --graph | |
275 | @ 3:251d831eeec5 +6 |
|
275 | @ 3:251d831eeec5 +6 | |
276 | | |
|
276 | | | |
277 | o 2:888f9082bf99 +5 |
|
277 | o 2:888f9082bf99 +5 | |
278 | | |
|
278 | | | |
279 | o 1:617f94f13c0f +4 |
|
279 | o 1:617f94f13c0f +4 | |
280 | | |
|
280 | | | |
281 | o 0:0189ba417d34 1+2+3 |
|
281 | o 0:0189ba417d34 1+2+3 | |
282 |
|
282 | |||
283 |
|
283 | |||
284 | $ hg histedit 1 --commands - << EOF |
|
284 | $ hg histedit 1 --commands - << EOF | |
285 | > pick 617f94f13c0f 1 +4 |
|
285 | > pick 617f94f13c0f 1 +4 | |
286 | > drop 888f9082bf99 2 +5 |
|
286 | > drop 888f9082bf99 2 +5 | |
287 | > fold 251d831eeec5 3 +6 |
|
287 | > fold 251d831eeec5 3 +6 | |
288 | > EOF |
|
288 | > EOF | |
289 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
289 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
290 | merging file |
|
290 | merging file | |
291 | warning: conflicts while merging file! (edit, then use 'hg resolve --mark') |
|
291 | warning: conflicts while merging file! (edit, then use 'hg resolve --mark') | |
292 | Fix up the change (fold 251d831eeec5) |
|
292 | Fix up the change (fold 251d831eeec5) | |
293 | (hg histedit --continue to resume) |
|
293 | (hg histedit --continue to resume) | |
294 | [1] |
|
294 | [1] | |
295 | There were conflicts, we keep P1 content. This |
|
295 | There were conflicts, we keep P1 content. This | |
296 | should effectively drop the changes from +6. |
|
296 | should effectively drop the changes from +6. | |
297 |
|
297 | |||
298 | $ hg status -v |
|
298 | $ hg status -v | |
299 | M file |
|
299 | M file | |
300 | ? file.orig |
|
300 | ? file.orig | |
301 | # The repository is in an unfinished *histedit* state. |
|
301 | # The repository is in an unfinished *histedit* state. | |
302 |
|
302 | |||
303 | # Unresolved merge conflicts: |
|
303 | # Unresolved merge conflicts: | |
304 | # |
|
304 | # | |
305 | # file |
|
305 | # file | |
306 | # |
|
306 | # | |
307 | # To mark files as resolved: hg resolve --mark FILE |
|
307 | # To mark files as resolved: hg resolve --mark FILE | |
308 |
|
308 | |||
309 | # To continue: hg histedit --continue |
|
309 | # To continue: hg histedit --continue | |
310 | # To abort: hg histedit --abort |
|
310 | # To abort: hg histedit --abort | |
311 |
|
311 | |||
312 | $ hg resolve -l |
|
312 | $ hg resolve -l | |
313 | U file |
|
313 | U file | |
314 | $ hg revert -r 'p1()' file |
|
314 | $ hg revert -r 'p1()' file | |
315 | $ hg resolve --mark file |
|
315 | $ hg resolve --mark file | |
316 | (no more unresolved files) |
|
316 | (no more unresolved files) | |
317 | continue: hg histedit --continue |
|
317 | continue: hg histedit --continue | |
318 | $ hg histedit --continue |
|
318 | $ hg histedit --continue | |
319 | 251d831eeec5: empty changeset |
|
319 | 251d831eeec5: empty changeset | |
320 | saved backup bundle to $TESTTMP/fold-to-empty-test/.hg/strip-backup/888f9082bf99-daa0b8b3-histedit.hg |
|
320 | saved backup bundle to $TESTTMP/fold-to-empty-test/.hg/strip-backup/888f9082bf99-daa0b8b3-histedit.hg | |
321 | $ hg logt --graph |
|
321 | $ hg logt --graph | |
322 | @ 1:617f94f13c0f +4 |
|
322 | @ 1:617f94f13c0f +4 | |
323 | | |
|
323 | | | |
324 | o 0:0189ba417d34 1+2+3 |
|
324 | o 0:0189ba417d34 1+2+3 | |
325 |
|
325 | |||
326 |
|
326 | |||
327 | $ cd .. |
|
327 | $ cd .. | |
328 |
|
328 | |||
329 |
|
329 | |||
330 | Test fold through dropped |
|
330 | Test fold through dropped | |
331 | ------------------------- |
|
331 | ------------------------- | |
332 |
|
332 | |||
333 |
|
333 | |||
334 | Test corner case where folded revision is separated from its parent by a |
|
334 | Test corner case where folded revision is separated from its parent by a | |
335 | dropped revision. |
|
335 | dropped revision. | |
336 |
|
336 | |||
337 |
|
337 | |||
338 | $ hg init fold-with-dropped |
|
338 | $ hg init fold-with-dropped | |
339 | $ cd fold-with-dropped |
|
339 | $ cd fold-with-dropped | |
340 | $ printf "1\n2\n3\n" > file |
|
340 | $ printf "1\n2\n3\n" > file | |
341 | $ hg commit -Am '1+2+3' |
|
341 | $ hg commit -Am '1+2+3' | |
342 | adding file |
|
342 | adding file | |
343 | $ echo 4 >> file |
|
343 | $ echo 4 >> file | |
344 | $ hg commit -m '+4' |
|
344 | $ hg commit -m '+4' | |
345 | $ echo 5 >> file |
|
345 | $ echo 5 >> file | |
346 | $ hg commit -m '+5' |
|
346 | $ hg commit -m '+5' | |
347 | $ echo 6 >> file |
|
347 | $ echo 6 >> file | |
348 | $ hg commit -m '+6' |
|
348 | $ hg commit -m '+6' | |
349 | $ hg logt -G |
|
349 | $ hg logt -G | |
350 | @ 3:251d831eeec5 +6 |
|
350 | @ 3:251d831eeec5 +6 | |
351 | | |
|
351 | | | |
352 | o 2:888f9082bf99 +5 |
|
352 | o 2:888f9082bf99 +5 | |
353 | | |
|
353 | | | |
354 | o 1:617f94f13c0f +4 |
|
354 | o 1:617f94f13c0f +4 | |
355 | | |
|
355 | | | |
356 | o 0:0189ba417d34 1+2+3 |
|
356 | o 0:0189ba417d34 1+2+3 | |
357 |
|
357 | |||
358 | $ hg histedit 1 --commands - << EOF |
|
358 | $ hg histedit 1 --commands - << EOF | |
359 | > pick 617f94f13c0f 1 +4 |
|
359 | > pick 617f94f13c0f 1 +4 | |
360 | > drop 888f9082bf99 2 +5 |
|
360 | > drop 888f9082bf99 2 +5 | |
361 | > fold 251d831eeec5 3 +6 |
|
361 | > fold 251d831eeec5 3 +6 | |
362 | > EOF |
|
362 | > EOF | |
363 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
363 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
364 | merging file |
|
364 | merging file | |
365 | warning: conflicts while merging file! (edit, then use 'hg resolve --mark') |
|
365 | warning: conflicts while merging file! (edit, then use 'hg resolve --mark') | |
366 | Fix up the change (fold 251d831eeec5) |
|
366 | Fix up the change (fold 251d831eeec5) | |
367 | (hg histedit --continue to resume) |
|
367 | (hg histedit --continue to resume) | |
368 | [1] |
|
368 | [1] | |
369 | $ cat > file << EOF |
|
369 | $ cat > file << EOF | |
370 | > 1 |
|
370 | > 1 | |
371 | > 2 |
|
371 | > 2 | |
372 | > 3 |
|
372 | > 3 | |
373 | > 4 |
|
373 | > 4 | |
374 | > 5 |
|
374 | > 5 | |
375 | > EOF |
|
375 | > EOF | |
376 | $ hg resolve --mark file |
|
376 | $ hg resolve --mark file | |
377 | (no more unresolved files) |
|
377 | (no more unresolved files) | |
378 | continue: hg histedit --continue |
|
378 | continue: hg histedit --continue | |
379 | $ hg commit -m '+5.2' |
|
379 | $ hg commit -m '+5.2' | |
380 | created new head |
|
380 | created new head | |
381 | $ echo 6 >> file |
|
381 | $ echo 6 >> file | |
382 | $ HGEDITOR=cat hg histedit --continue |
|
382 | $ HGEDITOR=cat hg histedit --continue | |
383 | +4 |
|
383 | +4 | |
384 | *** |
|
384 | *** | |
385 | +5.2 |
|
385 | +5.2 | |
386 | *** |
|
386 | *** | |
387 | +6 |
|
387 | +6 | |
388 |
|
388 | |||
389 |
|
389 | |||
390 |
|
390 | |||
391 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
391 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
392 | HG: Leave message empty to abort commit. |
|
392 | HG: Leave message empty to abort commit. | |
393 | HG: -- |
|
393 | HG: -- | |
394 | HG: user: test |
|
394 | HG: user: test | |
395 | HG: branch 'default' |
|
395 | HG: branch 'default' | |
396 | HG: changed file |
|
396 | HG: changed file | |
397 | saved backup bundle to $TESTTMP/fold-with-dropped/.hg/strip-backup/617f94f13c0f-3d69522c-histedit.hg |
|
397 | saved backup bundle to $TESTTMP/fold-with-dropped/.hg/strip-backup/617f94f13c0f-3d69522c-histedit.hg | |
398 | $ hg logt -G |
|
398 | $ hg logt -G | |
399 | @ 1:10c647b2cdd5 +4 |
|
399 | @ 1:10c647b2cdd5 +4 | |
400 | | |
|
400 | | | |
401 | o 0:0189ba417d34 1+2+3 |
|
401 | o 0:0189ba417d34 1+2+3 | |
402 |
|
402 | |||
403 | $ hg export tip |
|
403 | $ hg export tip | |
404 | # HG changeset patch |
|
404 | # HG changeset patch | |
405 | # User test |
|
405 | # User test | |
406 | # Date 0 0 |
|
406 | # Date 0 0 | |
407 | # Thu Jan 01 00:00:00 1970 +0000 |
|
407 | # Thu Jan 01 00:00:00 1970 +0000 | |
408 | # Node ID 10c647b2cdd54db0603ecb99b2ff5ce66d5a5323 |
|
408 | # Node ID 10c647b2cdd54db0603ecb99b2ff5ce66d5a5323 | |
409 | # Parent 0189ba417d34df9dda55f88b637dcae9917b5964 |
|
409 | # Parent 0189ba417d34df9dda55f88b637dcae9917b5964 | |
410 | +4 |
|
410 | +4 | |
411 | *** |
|
411 | *** | |
412 | +5.2 |
|
412 | +5.2 | |
413 | *** |
|
413 | *** | |
414 | +6 |
|
414 | +6 | |
415 |
|
415 | |||
416 | diff -r 0189ba417d34 -r 10c647b2cdd5 file |
|
416 | diff -r 0189ba417d34 -r 10c647b2cdd5 file | |
417 | --- a/file Thu Jan 01 00:00:00 1970 +0000 |
|
417 | --- a/file Thu Jan 01 00:00:00 1970 +0000 | |
418 | +++ b/file Thu Jan 01 00:00:00 1970 +0000 |
|
418 | +++ b/file Thu Jan 01 00:00:00 1970 +0000 | |
419 | @@ -1,3 +1,6 @@ |
|
419 | @@ -1,3 +1,6 @@ | |
420 | 1 |
|
420 | 1 | |
421 | 2 |
|
421 | 2 | |
422 | 3 |
|
422 | 3 | |
423 | +4 |
|
423 | +4 | |
424 | +5 |
|
424 | +5 | |
425 | +6 |
|
425 | +6 | |
426 | $ cd .. |
|
426 | $ cd .. | |
427 |
|
427 | |||
428 |
|
428 | |||
429 | Folding with initial rename (issue3729) |
|
429 | Folding with initial rename (issue3729) | |
430 | --------------------------------------- |
|
430 | --------------------------------------- | |
431 |
|
431 | |||
432 | $ hg init fold-rename |
|
432 | $ hg init fold-rename | |
433 | $ cd fold-rename |
|
433 | $ cd fold-rename | |
434 | $ echo a > a.txt |
|
434 | $ echo a > a.txt | |
435 | $ hg add a.txt |
|
435 | $ hg add a.txt | |
436 | $ hg commit -m a |
|
436 | $ hg commit -m a | |
437 | $ hg rename a.txt b.txt |
|
437 | $ hg rename a.txt b.txt | |
438 | $ hg commit -m rename |
|
438 | $ hg commit -m rename | |
439 | $ echo b >> b.txt |
|
439 | $ echo b >> b.txt | |
440 | $ hg commit -m b |
|
440 | $ hg commit -m b | |
441 |
|
441 | |||
442 | $ hg logt --follow b.txt |
|
442 | $ hg logt --follow b.txt | |
443 | 2:e0371e0426bc b |
|
443 | 2:e0371e0426bc b | |
444 | 1:1c4f440a8085 rename |
|
444 | 1:1c4f440a8085 rename | |
445 | 0:6c795aa153cb a |
|
445 | 0:6c795aa153cb a | |
446 |
|
446 | |||
447 | $ hg histedit 1c4f440a8085 --commands - 2>&1 << EOF | fixbundle |
|
447 | $ hg histedit 1c4f440a8085 --commands - 2>&1 << EOF | fixbundle | |
448 | > pick 1c4f440a8085 rename |
|
448 | > pick 1c4f440a8085 rename | |
449 | > fold e0371e0426bc b |
|
449 | > fold e0371e0426bc b | |
450 | > EOF |
|
450 | > EOF | |
451 |
|
451 | |||
452 | $ hg logt --follow b.txt |
|
452 | $ hg logt --follow b.txt | |
453 | 1:cf858d235c76 rename |
|
453 | 1:cf858d235c76 rename | |
454 | 0:6c795aa153cb a |
|
454 | 0:6c795aa153cb a | |
455 |
|
455 | |||
456 | $ cd .. |
|
456 | $ cd .. | |
457 |
|
457 | |||
458 | Folding with swapping |
|
458 | Folding with swapping | |
459 | --------------------- |
|
459 | --------------------- | |
460 |
|
460 | |||
461 | This is an excuse to test hook with histedit temporary commit (issue4422) |
|
461 | This is an excuse to test hook with histedit temporary commit (issue4422) | |
462 |
|
462 | |||
463 |
|
463 | |||
464 | $ hg init issue4422 |
|
464 | $ hg init issue4422 | |
465 | $ cd issue4422 |
|
465 | $ cd issue4422 | |
466 | $ echo a > a.txt |
|
466 | $ echo a > a.txt | |
467 | $ hg add a.txt |
|
467 | $ hg add a.txt | |
468 | $ hg commit -m a |
|
468 | $ hg commit -m a | |
469 | $ echo b > b.txt |
|
469 | $ echo b > b.txt | |
470 | $ hg add b.txt |
|
470 | $ hg add b.txt | |
471 | $ hg commit -m b |
|
471 | $ hg commit -m b | |
472 | $ echo c > c.txt |
|
472 | $ echo c > c.txt | |
473 | $ hg add c.txt |
|
473 | $ hg add c.txt | |
474 | $ hg commit -m c |
|
474 | $ hg commit -m c | |
475 |
|
475 | |||
476 | $ hg logt |
|
476 | $ hg logt | |
477 | 2:a1a953ffb4b0 c |
|
477 | 2:a1a953ffb4b0 c | |
478 | 1:199b6bb90248 b |
|
478 | 1:199b6bb90248 b | |
479 | 0:6c795aa153cb a |
|
479 | 0:6c795aa153cb a | |
480 |
|
480 | |||
481 | Setup the proper environment variable symbol for the platform, to be subbed |
|
481 | Setup the proper environment variable symbol for the platform, to be subbed | |
482 | into the hook command. |
|
482 | into the hook command. | |
483 | #if windows |
|
483 | #if windows | |
484 | $ NODE="%HG_NODE%" |
|
484 | $ NODE="%HG_NODE%" | |
485 | #else |
|
485 | #else | |
486 | $ NODE="\$HG_NODE" |
|
486 | $ NODE="\$HG_NODE" | |
487 | #endif |
|
487 | #endif | |
488 | $ hg histedit 6c795aa153cb --config hooks.commit="echo commit $NODE" --commands - 2>&1 << EOF | fixbundle |
|
488 | $ hg histedit 6c795aa153cb --config hooks.commit="echo commit $NODE" --commands - 2>&1 << EOF | fixbundle | |
489 | > pick 199b6bb90248 b |
|
489 | > pick 199b6bb90248 b | |
490 | > fold a1a953ffb4b0 c |
|
490 | > fold a1a953ffb4b0 c | |
491 | > pick 6c795aa153cb a |
|
491 | > pick 6c795aa153cb a | |
492 | > EOF |
|
492 | > EOF | |
493 | commit 9599899f62c05f4377548c32bf1c9f1a39634b0c |
|
493 | commit 9599899f62c05f4377548c32bf1c9f1a39634b0c | |
494 |
|
494 | |||
495 | $ hg logt |
|
495 | $ hg logt | |
496 | 1:9599899f62c0 a |
|
496 | 1:9599899f62c0 a | |
497 | 0:79b99e9c8e49 b |
|
497 | 0:79b99e9c8e49 b | |
498 |
|
498 | |||
499 | $ echo "foo" > amended.txt |
|
499 | $ echo "foo" > amended.txt | |
500 | $ hg add amended.txt |
|
500 | $ hg add amended.txt | |
501 | $ hg ci -q --config extensions.largefiles= --amend -I amended.txt |
|
501 | $ hg ci -q --config extensions.largefiles= --amend -I amended.txt | |
502 | The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !) |
|
502 | The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !) | |
503 |
|
503 | |||
504 | Test that folding multiple changes in a row doesn't show multiple |
|
504 | Test that folding multiple changes in a row doesn't show multiple | |
505 | editors. |
|
505 | editors. | |
506 |
|
506 | |||
507 | $ echo foo >> foo |
|
507 | $ echo foo >> foo | |
508 | $ hg add foo |
|
508 | $ hg add foo | |
509 | $ hg ci -m foo1 |
|
509 | $ hg ci -m foo1 | |
510 | $ echo foo >> foo |
|
510 | $ echo foo >> foo | |
511 | $ hg ci -m foo2 |
|
511 | $ hg ci -m foo2 | |
512 | $ echo foo >> foo |
|
512 | $ echo foo >> foo | |
513 | $ hg ci -m foo3 |
|
513 | $ hg ci -m foo3 | |
514 | $ hg logt |
|
514 | $ hg logt | |
515 | 4:21679ff7675c foo3 |
|
515 | 4:21679ff7675c foo3 | |
516 | 3:b7389cc4d66e foo2 |
|
516 | 3:b7389cc4d66e foo2 | |
517 | 2:0e01aeef5fa8 foo1 |
|
517 | 2:0e01aeef5fa8 foo1 | |
518 | 1:578c7455730c a |
|
518 | 1:578c7455730c a | |
519 | 0:79b99e9c8e49 b |
|
519 | 0:79b99e9c8e49 b | |
520 | $ cat > "$TESTTMP/editor.sh" <<EOF |
|
520 | $ cat > "$TESTTMP/editor.sh" <<EOF | |
521 | > echo ran editor >> "$TESTTMP/editorlog.txt" |
|
521 | > echo ran editor >> "$TESTTMP/editorlog.txt" | |
522 | > cat \$1 >> "$TESTTMP/editorlog.txt" |
|
522 | > cat \$1 >> "$TESTTMP/editorlog.txt" | |
523 | > echo END >> "$TESTTMP/editorlog.txt" |
|
523 | > echo END >> "$TESTTMP/editorlog.txt" | |
524 | > echo merged foos > \$1 |
|
524 | > echo merged foos > \$1 | |
525 | > EOF |
|
525 | > EOF | |
526 | $ HGEDITOR="sh \"$TESTTMP/editor.sh\"" hg histedit 1 --commands - 2>&1 <<EOF | fixbundle |
|
526 | $ HGEDITOR="sh \"$TESTTMP/editor.sh\"" hg histedit 1 --commands - 2>&1 <<EOF | fixbundle | |
527 | > pick 578c7455730c 1 a |
|
527 | > pick 578c7455730c 1 a | |
528 | > pick 0e01aeef5fa8 2 foo1 |
|
528 | > pick 0e01aeef5fa8 2 foo1 | |
529 | > fold b7389cc4d66e 3 foo2 |
|
529 | > fold b7389cc4d66e 3 foo2 | |
530 | > fold 21679ff7675c 4 foo3 |
|
530 | > fold 21679ff7675c 4 foo3 | |
531 | > EOF |
|
531 | > EOF | |
532 | $ hg logt |
|
532 | $ hg logt | |
533 | 2:e8bedbda72c1 merged foos |
|
533 | 2:e8bedbda72c1 merged foos | |
534 | 1:578c7455730c a |
|
534 | 1:578c7455730c a | |
535 | 0:79b99e9c8e49 b |
|
535 | 0:79b99e9c8e49 b | |
536 | Editor should have run only once |
|
536 | Editor should have run only once | |
537 | $ cat $TESTTMP/editorlog.txt |
|
537 | $ cat $TESTTMP/editorlog.txt | |
538 | ran editor |
|
538 | ran editor | |
539 | foo1 |
|
539 | foo1 | |
540 | *** |
|
540 | *** | |
541 | foo2 |
|
541 | foo2 | |
542 | *** |
|
542 | *** | |
543 | foo3 |
|
543 | foo3 | |
544 |
|
544 | |||
545 |
|
545 | |||
546 |
|
546 | |||
547 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
547 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
548 | HG: Leave message empty to abort commit. |
|
548 | HG: Leave message empty to abort commit. | |
549 | HG: -- |
|
549 | HG: -- | |
550 | HG: user: test |
|
550 | HG: user: test | |
551 | HG: branch 'default' |
|
551 | HG: branch 'default' | |
552 | HG: added foo |
|
552 | HG: added foo | |
553 | END |
|
553 | END | |
554 |
|
554 | |||
555 | $ cd .. |
|
555 | $ cd .. | |
556 |
|
556 | |||
557 | Test rolling into a commit with multiple children (issue5498) |
|
557 | Test rolling into a commit with multiple children (issue5498) | |
558 |
|
558 | |||
559 | $ hg init roll |
|
559 | $ hg init roll | |
560 | $ cd roll |
|
560 | $ cd roll | |
561 | $ echo a > a |
|
561 | $ echo a > a | |
562 | $ hg commit -qAm aa |
|
562 | $ hg commit -qAm aa | |
563 | $ echo b > b |
|
563 | $ echo b > b | |
564 | $ hg commit -qAm bb |
|
564 | $ hg commit -qAm bb | |
565 | $ hg up -q ".^" |
|
565 | $ hg up -q ".^" | |
566 | $ echo c > c |
|
566 | $ echo c > c | |
567 | $ hg commit -qAm cc |
|
567 | $ hg commit -qAm cc | |
568 | $ hg log -G -T '{node|short} {desc}' |
|
568 | $ hg log -G -T '{node|short} {desc}' | |
569 | @ 5db65b93a12b cc |
|
569 | @ 5db65b93a12b cc | |
570 | | |
|
570 | | | |
571 | | o 301d76bdc3ae bb |
|
571 | | o 301d76bdc3ae bb | |
572 | |/ |
|
572 | |/ | |
573 | o 8f0162e483d0 aa |
|
573 | o 8f0162e483d0 aa | |
574 |
|
574 | |||
575 |
|
575 | |||
576 | $ hg histedit . --commands - << EOF |
|
576 | $ hg histedit . --commands - << EOF | |
577 | > r 5db65b93a12b |
|
577 | > r 5db65b93a12b | |
578 | > EOF |
|
578 | > EOF | |
579 | hg: parse error: first changeset cannot use verb "roll" |
|
579 | hg: parse error: first changeset cannot use verb "roll" | |
580 | [255] |
|
580 | [255] | |
581 | $ hg log -G -T '{node|short} {desc}' |
|
581 | $ hg log -G -T '{node|short} {desc}' | |
582 | @ 5db65b93a12b cc |
|
582 | @ 5db65b93a12b cc | |
583 | | |
|
583 | | | |
584 | | o 301d76bdc3ae bb |
|
584 | | o 301d76bdc3ae bb | |
585 | |/ |
|
585 | |/ | |
586 | o 8f0162e483d0 aa |
|
586 | o 8f0162e483d0 aa | |
587 |
|
587 | |||
588 |
|
588 |
General Comments 0
You need to be logged in to leave comments.
Login now