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