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