|
1 ensure that all the scenarios in the user guide work as documented |
|
2 |
|
3 basic repo |
|
4 $ hg init t |
|
5 $ cd t |
|
6 $ touch file1.c file2.c |
|
7 $ hg -q commit -A -m init |
|
8 |
|
9 example 1: commit creates a changeset in draft phase |
|
10 (this is nothing to do with evolve, but it's mentioned in the user guide) |
|
11 $ echo 'feature Y' >> file1.c |
|
12 $ hg commit -u alice -d '0 0' -m 'implement feature X' |
|
13 $ hg phase -r . |
|
14 1: draft |
|
15 $ hg identify -in |
|
16 6e725fd2be6f 1 |
|
17 |
|
18 example 2: unsafe amend with plain vanilla Mercurial: the original |
|
19 commit is stripped |
|
20 $ hg commit --amend -u alice -d '1 0' -m 'implement feature Y' |
|
21 saved backup bundle to $TESTTMP/t/.hg/strip-backup/6e725fd2be6f-amend-backup.hg |
|
22 $ hg log -r 23fe4ac6d3f1 |
|
23 abort: unknown revision '23fe4ac6d3f1'! |
|
24 [255] |
|
25 $ hg identify -in |
|
26 fe0ecd3bd2a4 1 |
|
27 |
|
28 enable evolve for safe history modification |
|
29 $ cat >> $HGRCPATH <<EOF |
|
30 > [alias] |
|
31 > shortlog = log --template '{rev}:{node|short} {phase} {desc|firstline}\n' |
|
32 > [extensions] |
|
33 > rebase = |
|
34 > EOF |
|
35 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH |
|
36 |
|
37 example 3: safe amend with "hg commit --amend" (figure 2) |
|
38 $ echo 'tweak feature Y' >> file1.c |
|
39 $ hg commit --amend -u alice -d '2 0' -m 'implement feature Y' |
|
40 $ hg shortlog -q -r fe0ecd3bd2a4 |
|
41 abort: unknown revision 'fe0ecd3bd2a4'! |
|
42 [255] |
|
43 $ hg --hidden shortlog -G |
|
44 @ 3:934359450037 draft implement feature Y |
|
45 | |
|
46 | x 2:6c5f78d5d467 draft temporary amend commit for fe0ecd3bd2a4 |
|
47 | | |
|
48 | x 1:fe0ecd3bd2a4 draft implement feature Y |
|
49 |/ |
|
50 o 0:08c4b6f4efc8 draft init |
|
51 |
|
52 example 3 redux: repeat safe amend, this time with "hg amend" |
|
53 $ hg rollback -q |
|
54 $ hg amend -u alice -d '2 0' -m 'implement feature Y' |
|
55 $ hg --hidden shortlog -G |
|
56 @ 3:934359450037 draft implement feature Y |
|
57 | |
|
58 | x 2:6c5f78d5d467 draft temporary amend commit for fe0ecd3bd2a4 |
|
59 | | |
|
60 | x 1:fe0ecd3bd2a4 draft implement feature Y |
|
61 |/ |
|
62 o 0:08c4b6f4efc8 draft init |
|
63 |
|
64 example 4: prune at head (figure 3) |
|
65 $ echo 'debug hack' >> file1.c |
|
66 $ hg commit -m 'debug hack' |
|
67 $ hg prune . |
|
68 1 changesets pruned |
|
69 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
70 working directory now at 934359450037 |
|
71 $ hg parents --template '{rev}:{node|short} {desc|firstline}\n' |
|
72 3:934359450037 implement feature Y |
|
73 $ hg --hidden shortlog -G -r 3: |
|
74 x 4:a3e0ef24aaf0 draft debug hack |
|
75 | |
|
76 @ 3:934359450037 draft implement feature Y |
|
77 | |
|
78 |
|
79 example 5: uncommit files at head (figure 4) |
|
80 $ echo 'relevant' >> file1.c |
|
81 $ echo 'irrelevant' >> file2.c |
|
82 $ hg commit -u dan -d '10 0' -m 'fix bug 234' |
|
83 $ hg uncommit file2.c |
|
84 $ hg status |
|
85 M file2.c |
|
86 $ hg --hidden shortlog -G -r 'descendants(3) - 4' |
|
87 @ 6:c8defeecf7a4 draft fix bug 234 |
|
88 | |
|
89 | x 5:da4331967f5f draft fix bug 234 |
|
90 |/ |
|
91 o 3:934359450037 draft implement feature Y |
|
92 | |
|
93 $ hg parents --template '{rev}:{node|short} {desc|firstline}\n{files}\n' |
|
94 6:c8defeecf7a4 fix bug 234 |
|
95 file1.c |
|
96 $ hg revert --no-backup file2.c |
|
97 |
|
98 example 6: fold multiple changesets together into one (figure 5) |
|
99 $ echo step1 >> file1.c |
|
100 $ hg commit -m 'step 1' |
|
101 $ echo step2 >> file1.c |
|
102 $ hg commit -m 'step 2' |
|
103 $ echo step3 >> file2.c |
|
104 $ hg commit -m 'step 3' |
|
105 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' -r 7:: |
|
106 7:05e61aab8294 step 1 |
|
107 8:be6d5bc8e4cc step 2 |
|
108 9:35f432d9f7c1 step 3 |
|
109 $ hg fold -d '0 0' -m 'fix bug 64' -r 7:: |
|
110 3 changesets folded |
|
111 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
112 $ hg --hidden shortlog -G -r 6:: |
|
113 @ 10:171c6a79a27b draft fix bug 64 |
|
114 | |
|
115 | x 9:35f432d9f7c1 draft step 3 |
|
116 | | |
|
117 | x 8:be6d5bc8e4cc draft step 2 |
|
118 | | |
|
119 | x 7:05e61aab8294 draft step 1 |
|
120 |/ |
|
121 o 6:c8defeecf7a4 draft fix bug 234 |
|
122 | |
|
123 $ hg --hidden log -q -r 'successors(7) | successors(8) | successors(9)' |
|
124 10:171c6a79a27b |
|
125 $ hg --hidden log -q -r 'precursors(10)' |
|
126 7:05e61aab8294 |
|
127 8:be6d5bc8e4cc |
|
128 9:35f432d9f7c1 |
|
129 $ hg diff -c 10 -U 0 |
|
130 diff -r c8defeecf7a4 -r 171c6a79a27b file1.c |
|
131 --- a/file1.c Thu Jan 01 00:00:10 1970 +0000 |
|
132 +++ b/file1.c Thu Jan 01 00:00:00 1970 +0000 |
|
133 @@ -3,0 +4,2 @@ |
|
134 +step1 |
|
135 +step2 |
|
136 diff -r c8defeecf7a4 -r 171c6a79a27b file2.c |
|
137 --- a/file2.c Thu Jan 01 00:00:10 1970 +0000 |
|
138 +++ b/file2.c Thu Jan 01 00:00:00 1970 +0000 |
|
139 @@ -0,0 +1,1 @@ |
|
140 +step3 |
|
141 |
|
142 setup for example 7: amend an older changeset |
|
143 $ echo 'fix fix oops fix' > file2.c |
|
144 $ hg commit -u bob -d '3 0' -m 'fix bug 17' |
|
145 $ echo 'cleanup' >> file1.c |
|
146 $ hg commit -u bob -d '4 0' -m 'cleanup' |
|
147 $ echo 'new feature' >> file1.c |
|
148 $ hg commit -u bob -d '5 0' -m 'feature 23' |
|
149 $ hg --hidden shortlog -G -r 10:: |
|
150 @ 13:dadcbba2d606 draft feature 23 |
|
151 | |
|
152 o 12:debd46bb29dc draft cleanup |
|
153 | |
|
154 o 11:3e1cb8f70c02 draft fix bug 17 |
|
155 | |
|
156 o 10:171c6a79a27b draft fix bug 64 |
|
157 | |
|
158 |
|
159 example 7: amend an older changeset (figures 6, 7) |
|
160 $ hg update -q 11 |
|
161 $ echo 'fix fix fix fix' > file2.c |
|
162 $ hg amend -u bob -d '6 0' |
|
163 2 new unstable changesets |
|
164 $ hg shortlog -r 'obsolete()' |
|
165 11:3e1cb8f70c02 draft fix bug 17 |
|
166 $ hg shortlog -r 'unstable()' |
|
167 12:debd46bb29dc draft cleanup |
|
168 13:dadcbba2d606 draft feature 23 |
|
169 $ hg --hidden shortlog -G -r 10:: |
|
170 @ 15:395cbeda3a06 draft fix bug 17 |
|
171 | |
|
172 | x 14:f7fab707e247 draft temporary amend commit for 3e1cb8f70c02 |
|
173 | | |
|
174 | | o 13:dadcbba2d606 draft feature 23 |
|
175 | | | |
|
176 | | o 12:debd46bb29dc draft cleanup |
|
177 | |/ |
|
178 | x 11:3e1cb8f70c02 draft fix bug 17 |
|
179 |/ |
|
180 o 10:171c6a79a27b draft fix bug 64 |
|
181 | |
|
182 $ hg evolve -q --all |
|
183 $ hg shortlog -G -r 10:: |
|
184 @ 17:91b4b0f8b5c5 draft feature 23 |
|
185 | |
|
186 o 16:fe8858bd9bc2 draft cleanup |
|
187 | |
|
188 o 15:395cbeda3a06 draft fix bug 17 |
|
189 | |
|
190 o 10:171c6a79a27b draft fix bug 64 |
|
191 | |
|
192 |
|
193 setup for example 8: prune an older changeset (figure 8) |
|
194 $ echo 'useful' >> file1.c |
|
195 $ hg commit -u carl -d '7 0' -m 'useful work' |
|
196 $ echo 'debug' >> file2.c |
|
197 $ hg commit -u carl -d '8 0' -m 'debug hack' |
|
198 $ echo 'more useful' >> file1.c |
|
199 $ hg commit -u carl -d '9 0' -m 'more work' |
|
200 $ hg shortlog -G -r 17:: |
|
201 @ 20:ea8fafca914b draft more work |
|
202 | |
|
203 o 19:b23d06b457a8 draft debug hack |
|
204 | |
|
205 o 18:1f33e68b18b9 draft useful work |
|
206 | |
|
207 o 17:91b4b0f8b5c5 draft feature 23 |
|
208 | |
|
209 |
|
210 example 8: prune an older changeset (figures 8, 9) |
|
211 $ hg prune 19 |
|
212 1 changesets pruned |
|
213 1 new unstable changesets |
|
214 $ hg --hidden shortlog -G -r 18:: |
|
215 @ 20:ea8fafca914b draft more work |
|
216 | |
|
217 x 19:b23d06b457a8 draft debug hack |
|
218 | |
|
219 o 18:1f33e68b18b9 draft useful work |
|
220 | |
|
221 $ hg evolve -q --all |
|
222 $ hg --hidden shortlog -G -r 18:: |
|
223 @ 21:4393e5877437 draft more work |
|
224 | |
|
225 | x 20:ea8fafca914b draft more work |
|
226 | | |
|
227 | x 19:b23d06b457a8 draft debug hack |
|
228 |/ |
|
229 o 18:1f33e68b18b9 draft useful work |
|
230 | |
|
231 |
|
232 example 9: uncommit files from an older changeset (discard changes) |
|
233 (figure 10) |
|
234 $ echo 'this fixes bug 53' >> file1.c |
|
235 $ echo 'debug hack' >> file2.c |
|
236 $ hg commit -u dan -d '11 0' -m 'fix bug 53' |
|
237 $ echo 'and this handles bug 67' >> file1.c |
|
238 $ hg commit -u dan -d '12 0' -m 'fix bug 67' |
|
239 $ hg update 22 |
|
240 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
241 $ hg shortlog -G -r 21:: |
|
242 o 23:4db2428c8ae3 draft fix bug 67 |
|
243 | |
|
244 @ 22:f84357446753 draft fix bug 53 |
|
245 | |
|
246 o 21:4393e5877437 draft more work |
|
247 | |
|
248 $ hg uncommit file2.c |
|
249 1 new unstable changesets |
|
250 $ hg status |
|
251 M file2.c |
|
252 $ hg revert file2.c |
|
253 $ hg evolve --all |
|
254 move:[23] fix bug 67 |
|
255 atop:[24] fix bug 53 |
|
256 $ hg --hidden shortlog -G -r 21:: |
|
257 @ 25:0d972d6888e6 draft fix bug 67 |
|
258 | |
|
259 o 24:71bb83d674c5 draft fix bug 53 |
|
260 | |
|
261 | x 23:4db2428c8ae3 draft fix bug 67 |
|
262 | | |
|
263 | x 22:f84357446753 draft fix bug 53 |
|
264 |/ |
|
265 o 21:4393e5877437 draft more work |
|
266 | |
|
267 $ rm file2.c.orig |
|
268 |
|
269 example 10: uncommit files from an older changeset (keep changes) |
|
270 (figures 11, 12) |
|
271 $ echo 'fix a bug' >> file1.c |
|
272 $ echo 'useful but unrelated' >> file2.c |
|
273 $ hg commit -u dan -d '11 0' -m 'fix a bug' |
|
274 $ echo 'new feature' >> file1.c |
|
275 $ hg commit -u dan -d '12 0' -m 'new feature' |
|
276 $ hg update 26 |
|
277 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
278 $ hg --hidden shortlog -G -r 25:: |
|
279 o 27:fbb3c6d50427 draft new feature |
|
280 | |
|
281 @ 26:5b31a1239ab9 draft fix a bug |
|
282 | |
|
283 o 25:0d972d6888e6 draft fix bug 67 |
|
284 | |
|
285 $ hg uncommit file2.c |
|
286 1 new unstable changesets |
|
287 $ hg status |
|
288 M file2.c |
|
289 $ hg commit -m 'useful tweak' |
|
290 $ hg --hidden shortlog -G -r 25:: |
|
291 @ 29:51e0d8c0a922 draft useful tweak |
|
292 | |
|
293 o 28:2594e98553a9 draft fix a bug |
|
294 | |
|
295 | o 27:fbb3c6d50427 draft new feature |
|
296 | | |
|
297 | x 26:5b31a1239ab9 draft fix a bug |
|
298 |/ |
|
299 o 25:0d972d6888e6 draft fix bug 67 |
|
300 | |
|
301 $ hg evolve --all |
|
302 move:[27] new feature |
|
303 atop:[28] fix a bug |
|
304 $ hg --hidden shortlog -G -r 25:: |
|
305 @ 30:166c1c368ab6 draft new feature |
|
306 | |
|
307 | o 29:51e0d8c0a922 draft useful tweak |
|
308 |/ |
|
309 o 28:2594e98553a9 draft fix a bug |
|
310 | |
|
311 | x 27:fbb3c6d50427 draft new feature |
|
312 | | |
|
313 | x 26:5b31a1239ab9 draft fix a bug |
|
314 |/ |
|
315 o 25:0d972d6888e6 draft fix bug 67 |
|
316 | |