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