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