Show More
@@ -1,19 +1,19 b'' | |||
|
1 | 1 | # mergeutil.py - help for merge processing in mercurial |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from __future__ import absolute_import |
|
9 | 9 | |
|
10 | 10 | from .i18n import _ |
|
11 | 11 | |
|
12 | 12 | from . import error |
|
13 | 13 | |
|
14 | 14 | |
|
15 | 15 | def checkunresolved(ms): |
|
16 | 16 | if list(ms.unresolved()): |
|
17 |
raise error. |
|
|
17 | raise error.StateError( | |
|
18 | 18 | _(b"unresolved merge conflicts (see 'hg help resolve')") |
|
19 | 19 | ) |
@@ -1,1319 +1,1319 b'' | |||
|
1 | 1 | $ hg init |
|
2 | 2 | |
|
3 | 3 | Setup: |
|
4 | 4 | |
|
5 | 5 | $ echo a >> a |
|
6 | 6 | $ hg ci -Am 'base' |
|
7 | 7 | adding a |
|
8 | 8 | |
|
9 | 9 | Refuse to amend public csets: |
|
10 | 10 | |
|
11 | 11 | $ hg phase -r . -p |
|
12 | 12 | $ hg ci --amend |
|
13 | 13 | abort: cannot amend public changesets |
|
14 | 14 | (see 'hg help phases' for details) |
|
15 | 15 | [10] |
|
16 | 16 | $ hg phase -r . -f -d |
|
17 | 17 | |
|
18 | 18 | $ echo a >> a |
|
19 | 19 | $ hg ci -Am 'base1' |
|
20 | 20 | |
|
21 | 21 | Nothing to amend: |
|
22 | 22 | |
|
23 | 23 | $ hg ci --amend -m 'base1' |
|
24 | 24 | nothing changed |
|
25 | 25 | [1] |
|
26 | 26 | |
|
27 | 27 | $ cat >> $HGRCPATH <<EOF |
|
28 | 28 | > [hooks] |
|
29 | 29 | > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE" |
|
30 | 30 | > EOF |
|
31 | 31 | |
|
32 | 32 | Amending changeset with changes in working dir: |
|
33 | 33 | (and check that --message does not trigger an editor) |
|
34 | 34 | |
|
35 | 35 | $ echo a >> a |
|
36 | 36 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1' |
|
37 | 37 | pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149 |
|
38 | 38 | 43f1ba15f28a tip |
|
39 | 39 | saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg |
|
40 | 40 | $ echo 'pretxncommit.foo = ' >> $HGRCPATH |
|
41 | 41 | $ hg diff -c . |
|
42 | 42 | diff -r ad120869acf0 -r 43f1ba15f28a a |
|
43 | 43 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
44 | 44 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
45 | 45 | @@ -1,1 +1,3 @@ |
|
46 | 46 | a |
|
47 | 47 | +a |
|
48 | 48 | +a |
|
49 | 49 | $ hg log |
|
50 | 50 | changeset: 1:43f1ba15f28a |
|
51 | 51 | tag: tip |
|
52 | 52 | user: test |
|
53 | 53 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
54 | 54 | summary: amend base1 |
|
55 | 55 | |
|
56 | 56 | changeset: 0:ad120869acf0 |
|
57 | 57 | user: test |
|
58 | 58 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
59 | 59 | summary: base |
|
60 | 60 | |
|
61 | 61 | |
|
62 | 62 | Check proper abort for empty message |
|
63 | 63 | |
|
64 | 64 | $ cat > editor.sh << '__EOF__' |
|
65 | 65 | > #!/bin/sh |
|
66 | 66 | > echo "" > "$1" |
|
67 | 67 | > __EOF__ |
|
68 | 68 | |
|
69 | 69 | Update the existing file to ensure that the dirstate is not in pending state |
|
70 | 70 | (where the status of some files in the working copy is not known yet). This in |
|
71 | 71 | turn ensures that when the transaction is aborted due to an empty message during |
|
72 | 72 | the amend, there should be no rollback. |
|
73 | 73 | $ echo a >> a |
|
74 | 74 | |
|
75 | 75 | $ echo b > b |
|
76 | 76 | $ hg add b |
|
77 | 77 | $ hg summary |
|
78 | 78 | parent: 1:43f1ba15f28a tip |
|
79 | 79 | amend base1 |
|
80 | 80 | branch: default |
|
81 | 81 | commit: 1 modified, 1 added, 1 unknown |
|
82 | 82 | update: (current) |
|
83 | 83 | phases: 2 draft |
|
84 | 84 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend |
|
85 | 85 | abort: empty commit message |
|
86 | 86 | [10] |
|
87 | 87 | $ hg summary |
|
88 | 88 | parent: 1:43f1ba15f28a tip |
|
89 | 89 | amend base1 |
|
90 | 90 | branch: default |
|
91 | 91 | commit: 1 modified, 1 added, 1 unknown |
|
92 | 92 | update: (current) |
|
93 | 93 | phases: 2 draft |
|
94 | 94 | |
|
95 | 95 | Add new file along with modified existing file: |
|
96 | 96 | $ hg ci --amend -m 'amend base1 new file' |
|
97 | 97 | saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg |
|
98 | 98 | |
|
99 | 99 | Remove file that was added in amended commit: |
|
100 | 100 | (and test logfile option) |
|
101 | 101 | (and test that logfile option do not trigger an editor) |
|
102 | 102 | |
|
103 | 103 | $ hg rm b |
|
104 | 104 | $ echo 'amend base1 remove new file' > ../logfile |
|
105 | 105 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile |
|
106 | 106 | saved backup bundle to $TESTTMP/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg |
|
107 | 107 | |
|
108 | 108 | $ hg cat b |
|
109 | 109 | b: no such file in rev 47343646fa3d |
|
110 | 110 | [1] |
|
111 | 111 | |
|
112 | 112 | No changes, just a different message: |
|
113 | 113 | |
|
114 | 114 | $ hg ci -v --amend -m 'no changes, new message' |
|
115 | 115 | amending changeset 47343646fa3d |
|
116 | 116 | copying changeset 47343646fa3d to ad120869acf0 |
|
117 | 117 | committing files: |
|
118 | 118 | a |
|
119 | 119 | committing manifest |
|
120 | 120 | committing changelog |
|
121 | 121 | 1 changesets found |
|
122 | 122 | uncompressed size of bundle content: |
|
123 | 123 | 254 (changelog) |
|
124 | 124 | 163 (manifests) |
|
125 | 125 | 131 a |
|
126 | 126 | saved backup bundle to $TESTTMP/.hg/strip-backup/47343646fa3d-c2758885-amend.hg |
|
127 | 127 | 1 changesets found |
|
128 | 128 | uncompressed size of bundle content: |
|
129 | 129 | 250 (changelog) |
|
130 | 130 | 163 (manifests) |
|
131 | 131 | 131 a |
|
132 | 132 | adding branch |
|
133 | 133 | adding changesets |
|
134 | 134 | adding manifests |
|
135 | 135 | adding file changes |
|
136 | 136 | added 1 changesets with 1 changes to 1 files |
|
137 | 137 | committed changeset 1:401431e913a1 |
|
138 | 138 | $ hg diff -c . |
|
139 | 139 | diff -r ad120869acf0 -r 401431e913a1 a |
|
140 | 140 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
141 | 141 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
142 | 142 | @@ -1,1 +1,4 @@ |
|
143 | 143 | a |
|
144 | 144 | +a |
|
145 | 145 | +a |
|
146 | 146 | +a |
|
147 | 147 | $ hg log |
|
148 | 148 | changeset: 1:401431e913a1 |
|
149 | 149 | tag: tip |
|
150 | 150 | user: test |
|
151 | 151 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
152 | 152 | summary: no changes, new message |
|
153 | 153 | |
|
154 | 154 | changeset: 0:ad120869acf0 |
|
155 | 155 | user: test |
|
156 | 156 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
157 | 157 | summary: base |
|
158 | 158 | |
|
159 | 159 | |
|
160 | 160 | Disable default date on commit so when -d isn't given, the old date is preserved: |
|
161 | 161 | |
|
162 | 162 | $ echo '[defaults]' >> $HGRCPATH |
|
163 | 163 | $ echo 'commit=' >> $HGRCPATH |
|
164 | 164 | |
|
165 | 165 | Test -u/-d: |
|
166 | 166 | |
|
167 | 167 | $ cat > .hg/checkeditform.sh <<EOF |
|
168 | 168 | > env | grep HGEDITFORM |
|
169 | 169 | > true |
|
170 | 170 | > EOF |
|
171 | 171 | $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0' |
|
172 | 172 | HGEDITFORM=commit.amend.normal |
|
173 | 173 | saved backup bundle to $TESTTMP/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg |
|
174 | 174 | $ echo a >> a |
|
175 | 175 | $ hg ci --amend -u foo -d '1 0' |
|
176 | 176 | saved backup bundle to $TESTTMP/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg |
|
177 | 177 | $ hg log -r . |
|
178 | 178 | changeset: 1:a9a13940fc03 |
|
179 | 179 | tag: tip |
|
180 | 180 | user: foo |
|
181 | 181 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
182 | 182 | summary: no changes, new message |
|
183 | 183 | |
|
184 | 184 | |
|
185 | 185 | Open editor with old commit message if a message isn't given otherwise: |
|
186 | 186 | |
|
187 | 187 | $ cat > editor.sh << '__EOF__' |
|
188 | 188 | > #!/bin/sh |
|
189 | 189 | > cat $1 |
|
190 | 190 | > echo "another precious commit message" > "$1" |
|
191 | 191 | > __EOF__ |
|
192 | 192 | |
|
193 | 193 | at first, test saving last-message.txt |
|
194 | 194 | |
|
195 | 195 | $ cat > .hg/hgrc << '__EOF__' |
|
196 | 196 | > [hooks] |
|
197 | 197 | > pretxncommit.test-saving-last-message = false |
|
198 | 198 | > __EOF__ |
|
199 | 199 | |
|
200 | 200 | $ rm -f .hg/last-message.txt |
|
201 | 201 | $ hg commit --amend -v -m "message given from command line" |
|
202 | 202 | amending changeset a9a13940fc03 |
|
203 | 203 | copying changeset a9a13940fc03 to ad120869acf0 |
|
204 | 204 | committing files: |
|
205 | 205 | a |
|
206 | 206 | committing manifest |
|
207 | 207 | committing changelog |
|
208 | 208 | running hook pretxncommit.test-saving-last-message: false |
|
209 | 209 | transaction abort! |
|
210 | 210 | rollback completed |
|
211 | 211 | abort: pretxncommit.test-saving-last-message hook exited with status 1 |
|
212 | 212 | [255] |
|
213 | 213 | $ cat .hg/last-message.txt |
|
214 | 214 | message given from command line (no-eol) |
|
215 | 215 | |
|
216 | 216 | $ rm -f .hg/last-message.txt |
|
217 | 217 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v |
|
218 | 218 | amending changeset a9a13940fc03 |
|
219 | 219 | copying changeset a9a13940fc03 to ad120869acf0 |
|
220 | 220 | no changes, new message |
|
221 | 221 | |
|
222 | 222 | |
|
223 | 223 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
224 | 224 | HG: Leave message empty to abort commit. |
|
225 | 225 | HG: -- |
|
226 | 226 | HG: user: foo |
|
227 | 227 | HG: branch 'default' |
|
228 | 228 | HG: changed a |
|
229 | 229 | committing files: |
|
230 | 230 | a |
|
231 | 231 | committing manifest |
|
232 | 232 | committing changelog |
|
233 | 233 | running hook pretxncommit.test-saving-last-message: false |
|
234 | 234 | transaction abort! |
|
235 | 235 | rollback completed |
|
236 | 236 | abort: pretxncommit.test-saving-last-message hook exited with status 1 |
|
237 | 237 | [255] |
|
238 | 238 | |
|
239 | 239 | $ cat .hg/last-message.txt |
|
240 | 240 | another precious commit message |
|
241 | 241 | |
|
242 | 242 | $ cat > .hg/hgrc << '__EOF__' |
|
243 | 243 | > [hooks] |
|
244 | 244 | > pretxncommit.test-saving-last-message = |
|
245 | 245 | > __EOF__ |
|
246 | 246 | |
|
247 | 247 | then, test editing custom commit message |
|
248 | 248 | |
|
249 | 249 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v |
|
250 | 250 | amending changeset a9a13940fc03 |
|
251 | 251 | copying changeset a9a13940fc03 to ad120869acf0 |
|
252 | 252 | no changes, new message |
|
253 | 253 | |
|
254 | 254 | |
|
255 | 255 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
256 | 256 | HG: Leave message empty to abort commit. |
|
257 | 257 | HG: -- |
|
258 | 258 | HG: user: foo |
|
259 | 259 | HG: branch 'default' |
|
260 | 260 | HG: changed a |
|
261 | 261 | committing files: |
|
262 | 262 | a |
|
263 | 263 | committing manifest |
|
264 | 264 | committing changelog |
|
265 | 265 | 1 changesets found |
|
266 | 266 | uncompressed size of bundle content: |
|
267 | 267 | 249 (changelog) |
|
268 | 268 | 163 (manifests) |
|
269 | 269 | 133 a |
|
270 | 270 | saved backup bundle to $TESTTMP/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg |
|
271 | 271 | 1 changesets found |
|
272 | 272 | uncompressed size of bundle content: |
|
273 | 273 | 257 (changelog) |
|
274 | 274 | 163 (manifests) |
|
275 | 275 | 133 a |
|
276 | 276 | adding branch |
|
277 | 277 | adding changesets |
|
278 | 278 | adding manifests |
|
279 | 279 | adding file changes |
|
280 | 280 | added 1 changesets with 1 changes to 1 files |
|
281 | 281 | committed changeset 1:64a124ba1b44 |
|
282 | 282 | |
|
283 | 283 | Same, but with changes in working dir (different code path): |
|
284 | 284 | |
|
285 | 285 | $ echo a >> a |
|
286 | 286 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v |
|
287 | 287 | amending changeset 64a124ba1b44 |
|
288 | 288 | another precious commit message |
|
289 | 289 | |
|
290 | 290 | |
|
291 | 291 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
292 | 292 | HG: Leave message empty to abort commit. |
|
293 | 293 | HG: -- |
|
294 | 294 | HG: user: foo |
|
295 | 295 | HG: branch 'default' |
|
296 | 296 | HG: changed a |
|
297 | 297 | committing files: |
|
298 | 298 | a |
|
299 | 299 | committing manifest |
|
300 | 300 | committing changelog |
|
301 | 301 | 1 changesets found |
|
302 | 302 | uncompressed size of bundle content: |
|
303 | 303 | 257 (changelog) |
|
304 | 304 | 163 (manifests) |
|
305 | 305 | 133 a |
|
306 | 306 | saved backup bundle to $TESTTMP/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg |
|
307 | 307 | 1 changesets found |
|
308 | 308 | uncompressed size of bundle content: |
|
309 | 309 | 257 (changelog) |
|
310 | 310 | 163 (manifests) |
|
311 | 311 | 135 a |
|
312 | 312 | adding branch |
|
313 | 313 | adding changesets |
|
314 | 314 | adding manifests |
|
315 | 315 | adding file changes |
|
316 | 316 | added 1 changesets with 1 changes to 1 files |
|
317 | 317 | committed changeset 1:7892795b8e38 |
|
318 | 318 | |
|
319 | 319 | $ rm editor.sh |
|
320 | 320 | $ hg log -r . |
|
321 | 321 | changeset: 1:7892795b8e38 |
|
322 | 322 | tag: tip |
|
323 | 323 | user: foo |
|
324 | 324 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
325 | 325 | summary: another precious commit message |
|
326 | 326 | |
|
327 | 327 | |
|
328 | 328 | Moving bookmarks, preserve active bookmark: |
|
329 | 329 | |
|
330 | 330 | $ hg book book1 |
|
331 | 331 | $ hg book book2 |
|
332 | 332 | $ hg ci --amend -m 'move bookmarks' |
|
333 | 333 | saved backup bundle to $TESTTMP/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg |
|
334 | 334 | $ hg book |
|
335 | 335 | book1 1:8311f17e2616 |
|
336 | 336 | * book2 1:8311f17e2616 |
|
337 | 337 | $ echo a >> a |
|
338 | 338 | $ hg ci --amend -m 'move bookmarks' |
|
339 | 339 | saved backup bundle to $TESTTMP/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg |
|
340 | 340 | $ hg book |
|
341 | 341 | book1 1:a3b65065808c |
|
342 | 342 | * book2 1:a3b65065808c |
|
343 | 343 | |
|
344 | 344 | abort does not loose bookmarks |
|
345 | 345 | |
|
346 | 346 | $ cat > editor.sh << '__EOF__' |
|
347 | 347 | > #!/bin/sh |
|
348 | 348 | > echo "" > "$1" |
|
349 | 349 | > __EOF__ |
|
350 | 350 | $ echo a >> a |
|
351 | 351 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend |
|
352 | 352 | abort: empty commit message |
|
353 | 353 | [10] |
|
354 | 354 | $ hg book |
|
355 | 355 | book1 1:a3b65065808c |
|
356 | 356 | * book2 1:a3b65065808c |
|
357 | 357 | $ hg revert -Caq |
|
358 | 358 | $ rm editor.sh |
|
359 | 359 | |
|
360 | 360 | $ echo '[defaults]' >> $HGRCPATH |
|
361 | 361 | $ echo "commit=-d '0 0'" >> $HGRCPATH |
|
362 | 362 | |
|
363 | 363 | Moving branches: |
|
364 | 364 | |
|
365 | 365 | $ hg branch foo |
|
366 | 366 | marked working directory as branch foo |
|
367 | 367 | (branches are permanent and global, did you want a bookmark?) |
|
368 | 368 | $ echo a >> a |
|
369 | 369 | $ hg ci -m 'branch foo' |
|
370 | 370 | $ hg branch default -f |
|
371 | 371 | marked working directory as branch default |
|
372 | 372 | $ hg ci --amend -m 'back to default' |
|
373 | 373 | saved backup bundle to $TESTTMP/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg |
|
374 | 374 | $ hg branches |
|
375 | 375 | default 2:9c07515f2650 |
|
376 | 376 | |
|
377 | 377 | Close branch: |
|
378 | 378 | |
|
379 | 379 | $ hg up -q 0 |
|
380 | 380 | $ echo b >> b |
|
381 | 381 | $ hg branch foo |
|
382 | 382 | marked working directory as branch foo |
|
383 | 383 | (branches are permanent and global, did you want a bookmark?) |
|
384 | 384 | $ hg ci -Am 'fork' |
|
385 | 385 | adding b |
|
386 | 386 | $ echo b >> b |
|
387 | 387 | $ hg ci -mb |
|
388 | 388 | $ hg ci --amend --close-branch -m 'closing branch foo' |
|
389 | 389 | saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-54245dc7-amend.hg |
|
390 | 390 | |
|
391 | 391 | Same thing, different code path: |
|
392 | 392 | |
|
393 | 393 | $ echo b >> b |
|
394 | 394 | $ hg ci -m 'reopen branch' |
|
395 | 395 | reopening closed branch head 4 |
|
396 | 396 | $ echo b >> b |
|
397 | 397 | $ hg ci --amend --close-branch |
|
398 | 398 | saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-b900d9fa-amend.hg |
|
399 | 399 | $ hg branches |
|
400 | 400 | default 2:9c07515f2650 |
|
401 | 401 | |
|
402 | 402 | Refuse to amend during a merge: |
|
403 | 403 | |
|
404 | 404 | $ hg up -q default |
|
405 | 405 | $ hg merge foo |
|
406 | 406 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
407 | 407 | (branch merge, don't forget to commit) |
|
408 | 408 | $ hg ci --amend |
|
409 | 409 | abort: cannot amend while merging |
|
410 | 410 | [20] |
|
411 | 411 | $ hg ci -m 'merge' |
|
412 | 412 | |
|
413 | 413 | Refuse to amend if there is a merge conflict (issue5805): |
|
414 | 414 | |
|
415 | 415 | $ hg up -q foo |
|
416 | 416 | $ echo c > a |
|
417 | 417 | $ hg up default -t :fail |
|
418 | 418 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
419 | 419 | use 'hg resolve' to retry unresolved file merges |
|
420 | 420 | [1] |
|
421 | 421 | $ hg resolve -l |
|
422 | 422 | U a |
|
423 | 423 | |
|
424 | 424 | $ hg ci --amend |
|
425 | 425 | abort: unresolved merge conflicts (see 'hg help resolve') |
|
426 |
[2 |
|
|
426 | [20] | |
|
427 | 427 | |
|
428 | 428 | $ hg up -qC . |
|
429 | 429 | |
|
430 | 430 | Follow copies/renames: |
|
431 | 431 | |
|
432 | 432 | $ hg mv b c |
|
433 | 433 | $ hg ci -m 'b -> c' |
|
434 | 434 | $ hg mv c d |
|
435 | 435 | $ hg ci --amend -m 'b -> d' |
|
436 | 436 | saved backup bundle to $TESTTMP/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg |
|
437 | 437 | $ hg st --rev '.^' --copies d |
|
438 | 438 | A d |
|
439 | 439 | b |
|
440 | 440 | $ hg cp d e |
|
441 | 441 | $ hg ci -m 'e = d' |
|
442 | 442 | $ hg cp e f |
|
443 | 443 | $ hg ci --amend -m 'f = d' |
|
444 | 444 | saved backup bundle to $TESTTMP/.hg/strip-backup/9198f73182d5-251d584a-amend.hg |
|
445 | 445 | $ hg st --rev '.^' --copies f |
|
446 | 446 | A f |
|
447 | 447 | d |
|
448 | 448 | |
|
449 | 449 | $ mv f f.orig |
|
450 | 450 | $ hg rm -A f |
|
451 | 451 | $ hg ci -m removef |
|
452 | 452 | $ hg cp a f |
|
453 | 453 | $ mv f.orig f |
|
454 | 454 | $ hg ci --amend -m replacef |
|
455 | 455 | saved backup bundle to $TESTTMP/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg |
|
456 | 456 | $ hg st --change . --copies |
|
457 | 457 | $ hg log -r . --template "{file_copies}\n" |
|
458 | 458 | |
|
459 | 459 | |
|
460 | 460 | Move added file (issue3410): |
|
461 | 461 | |
|
462 | 462 | $ echo g >> g |
|
463 | 463 | $ hg ci -Am g |
|
464 | 464 | adding g |
|
465 | 465 | $ hg mv g h |
|
466 | 466 | $ hg ci --amend |
|
467 | 467 | saved backup bundle to $TESTTMP/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg |
|
468 | 468 | $ hg st --change . --copies h |
|
469 | 469 | A h |
|
470 | 470 | $ hg log -r . --template "{file_copies}\n" |
|
471 | 471 | |
|
472 | 472 | |
|
473 | 473 | Can't rollback an amend: |
|
474 | 474 | |
|
475 | 475 | $ hg rollback |
|
476 | 476 | no rollback information available |
|
477 | 477 | [1] |
|
478 | 478 | |
|
479 | 479 | Preserve extra dict (issue3430): |
|
480 | 480 | |
|
481 | 481 | $ hg branch a |
|
482 | 482 | marked working directory as branch a |
|
483 | 483 | (branches are permanent and global, did you want a bookmark?) |
|
484 | 484 | $ echo a >> a |
|
485 | 485 | $ hg ci -ma |
|
486 | 486 | $ hg ci --amend -m "a'" |
|
487 | 487 | saved backup bundle to $TESTTMP/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg |
|
488 | 488 | $ hg log -r . --template "{branch}\n" |
|
489 | 489 | a |
|
490 | 490 | $ hg ci --amend -m "a''" |
|
491 | 491 | saved backup bundle to $TESTTMP/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg |
|
492 | 492 | $ hg log -r . --template "{branch}\n" |
|
493 | 493 | a |
|
494 | 494 | |
|
495 | 495 | Also preserve other entries in the dict that are in the old commit, |
|
496 | 496 | first graft something so there's an additional entry: |
|
497 | 497 | |
|
498 | 498 | $ hg up 0 -q |
|
499 | 499 | $ echo z > z |
|
500 | 500 | $ hg ci -Am 'fork' |
|
501 | 501 | adding z |
|
502 | 502 | created new head |
|
503 | 503 | $ hg up 11 |
|
504 | 504 | 5 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
505 | 505 | $ hg graft 12 |
|
506 | 506 | grafting 12:2647734878ef "fork" (tip) |
|
507 | 507 | $ hg ci --amend -m 'graft amend' |
|
508 | 508 | saved backup bundle to $TESTTMP/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg |
|
509 | 509 | $ hg log -r . --debug | grep extra |
|
510 | 510 | extra: amend_source=fe8c6f7957ca1665ed77496ed7a07657d469ac60 |
|
511 | 511 | extra: branch=a |
|
512 | 512 | extra: source=2647734878ef0236dda712fae9c1651cf694ea8a |
|
513 | 513 | |
|
514 | 514 | Preserve phase |
|
515 | 515 | |
|
516 | 516 | $ hg phase '.^::.' |
|
517 | 517 | 11: draft |
|
518 | 518 | 13: draft |
|
519 | 519 | $ hg phase --secret --force . |
|
520 | 520 | $ hg phase '.^::.' |
|
521 | 521 | 11: draft |
|
522 | 522 | 13: secret |
|
523 | 523 | $ hg commit --amend -m 'amend for phase' -q |
|
524 | 524 | $ hg phase '.^::.' |
|
525 | 525 | 11: draft |
|
526 | 526 | 13: secret |
|
527 | 527 | |
|
528 | 528 | Test amend with obsolete |
|
529 | 529 | --------------------------- |
|
530 | 530 | |
|
531 | 531 | Enable obsolete |
|
532 | 532 | |
|
533 | 533 | $ cat >> $HGRCPATH << EOF |
|
534 | 534 | > [experimental] |
|
535 | 535 | > evolution.createmarkers=True |
|
536 | 536 | > evolution.allowunstable=True |
|
537 | 537 | > EOF |
|
538 | 538 | |
|
539 | 539 | Amend with no files changes |
|
540 | 540 | |
|
541 | 541 | $ hg id -n |
|
542 | 542 | 13 |
|
543 | 543 | $ hg ci --amend -m 'babar' |
|
544 | 544 | $ hg id -n |
|
545 | 545 | 14 |
|
546 | 546 | $ hg log -Gl 3 --style=compact |
|
547 | 547 | @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test |
|
548 | 548 | | babar |
|
549 | 549 | | |
|
550 | 550 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test |
|
551 | 551 | | | fork |
|
552 | 552 | | ~ |
|
553 | 553 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test |
|
554 | 554 | | a'' |
|
555 | 555 | ~ |
|
556 | 556 | $ hg log -Gl 4 --hidden --style=compact |
|
557 | 557 | @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test |
|
558 | 558 | | babar |
|
559 | 559 | | |
|
560 | 560 | | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test |
|
561 | 561 | |/ amend for phase |
|
562 | 562 | | |
|
563 | 563 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test |
|
564 | 564 | | | fork |
|
565 | 565 | | ~ |
|
566 | 566 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test |
|
567 | 567 | | a'' |
|
568 | 568 | ~ |
|
569 | 569 | |
|
570 | 570 | Amend with files changes |
|
571 | 571 | |
|
572 | 572 | (note: the extra commit over 15 is a temporary junk I would be happy to get |
|
573 | 573 | ride of) |
|
574 | 574 | |
|
575 | 575 | $ echo 'babar' >> a |
|
576 | 576 | $ hg commit --amend |
|
577 | 577 | $ hg log -Gl 6 --hidden --style=compact |
|
578 | 578 | @ 15[tip]:11 a5b42b49b0d5 1970-01-01 00:00 +0000 test |
|
579 | 579 | | babar |
|
580 | 580 | | |
|
581 | 581 | | x 14:11 682950e85999 1970-01-01 00:00 +0000 test |
|
582 | 582 | |/ babar |
|
583 | 583 | | |
|
584 | 584 | | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test |
|
585 | 585 | |/ amend for phase |
|
586 | 586 | | |
|
587 | 587 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test |
|
588 | 588 | | | fork |
|
589 | 589 | | ~ |
|
590 | 590 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test |
|
591 | 591 | | a'' |
|
592 | 592 | | |
|
593 | 593 | o 10 5fa75032e226 1970-01-01 00:00 +0000 test |
|
594 | 594 | | g |
|
595 | 595 | ~ |
|
596 | 596 | |
|
597 | 597 | |
|
598 | 598 | Test that amend does not make it easy to create obsolescence cycle |
|
599 | 599 | --------------------------------------------------------------------- |
|
600 | 600 | |
|
601 | 601 | $ hg id -r 14 --hidden |
|
602 | 602 | 682950e85999 (a) |
|
603 | 603 | $ hg revert -ar 14 --hidden |
|
604 | 604 | reverting a |
|
605 | 605 | $ hg commit --amend |
|
606 | 606 | $ hg id |
|
607 | 607 | 37973c7e0b61 (a) tip |
|
608 | 608 | |
|
609 | 609 | Test that rewriting leaving instability behind is allowed |
|
610 | 610 | --------------------------------------------------------------------- |
|
611 | 611 | |
|
612 | 612 | $ hg up '.^' |
|
613 | 613 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
614 | 614 | $ echo 'b' >> a |
|
615 | 615 | $ hg log --style compact -r 'children(.)' |
|
616 | 616 | 16[tip]:11 37973c7e0b61 1970-01-01 00:00 +0000 test |
|
617 | 617 | babar |
|
618 | 618 | |
|
619 | 619 | $ hg commit --amend |
|
620 | 620 | 1 new orphan changesets |
|
621 | 621 | $ hg log -r 'orphan()' |
|
622 | 622 | changeset: 16:37973c7e0b61 |
|
623 | 623 | branch: a |
|
624 | 624 | parent: 11:0ddb275cfad1 |
|
625 | 625 | user: test |
|
626 | 626 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
627 | 627 | instability: orphan |
|
628 | 628 | summary: babar |
|
629 | 629 | |
|
630 | 630 | |
|
631 | 631 | Amend a merge changeset (with renames and conflicts from the second parent): |
|
632 | 632 | |
|
633 | 633 | $ hg up -q default |
|
634 | 634 | $ hg branch -q bar |
|
635 | 635 | $ hg cp a aa |
|
636 | 636 | $ hg mv z zz |
|
637 | 637 | $ echo cc > cc |
|
638 | 638 | $ hg add cc |
|
639 | 639 | $ hg ci -m aazzcc |
|
640 | 640 | $ hg up -q default |
|
641 | 641 | $ echo a >> a |
|
642 | 642 | $ echo dd > cc |
|
643 | 643 | $ hg add cc |
|
644 | 644 | $ hg ci -m aa |
|
645 | 645 | $ hg merge -q bar |
|
646 | 646 | warning: conflicts while merging cc! (edit, then use 'hg resolve --mark') |
|
647 | 647 | [1] |
|
648 | 648 | $ hg resolve -m cc |
|
649 | 649 | (no more unresolved files) |
|
650 | 650 | $ hg ci -m 'merge bar' |
|
651 | 651 | $ hg log --config diff.git=1 -pr . |
|
652 | 652 | changeset: 20:5aba7f3726e6 |
|
653 | 653 | tag: tip |
|
654 | 654 | parent: 19:30d96aeaf27b |
|
655 | 655 | parent: 18:1aa437659d19 |
|
656 | 656 | user: test |
|
657 | 657 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
658 | 658 | summary: merge bar |
|
659 | 659 | |
|
660 | 660 | diff --git a/a b/aa |
|
661 | 661 | copy from a |
|
662 | 662 | copy to aa |
|
663 | 663 | diff --git a/cc b/cc |
|
664 | 664 | --- a/cc |
|
665 | 665 | +++ b/cc |
|
666 | 666 | @@ -1,1 +1,5 @@ |
|
667 | 667 | +<<<<<<< working copy: 30d96aeaf27b - test: aa |
|
668 | 668 | dd |
|
669 | 669 | +======= |
|
670 | 670 | +cc |
|
671 | 671 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc |
|
672 | 672 | diff --git a/z b/zz |
|
673 | 673 | rename from z |
|
674 | 674 | rename to zz |
|
675 | 675 | |
|
676 | 676 | $ hg debugrename aa |
|
677 | 677 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e |
|
678 | 678 | $ hg debugrename zz |
|
679 | 679 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a |
|
680 | 680 | $ hg debugrename cc |
|
681 | 681 | cc not renamed |
|
682 | 682 | $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit |
|
683 | 683 | HGEDITFORM=commit.amend.merge |
|
684 | 684 | $ hg log --config diff.git=1 -pr . |
|
685 | 685 | changeset: 21:4b0631ef043e |
|
686 | 686 | tag: tip |
|
687 | 687 | parent: 19:30d96aeaf27b |
|
688 | 688 | parent: 18:1aa437659d19 |
|
689 | 689 | user: test |
|
690 | 690 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
691 | 691 | summary: merge bar (amend message) |
|
692 | 692 | |
|
693 | 693 | diff --git a/a b/aa |
|
694 | 694 | copy from a |
|
695 | 695 | copy to aa |
|
696 | 696 | diff --git a/cc b/cc |
|
697 | 697 | --- a/cc |
|
698 | 698 | +++ b/cc |
|
699 | 699 | @@ -1,1 +1,5 @@ |
|
700 | 700 | +<<<<<<< working copy: 30d96aeaf27b - test: aa |
|
701 | 701 | dd |
|
702 | 702 | +======= |
|
703 | 703 | +cc |
|
704 | 704 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc |
|
705 | 705 | diff --git a/z b/zz |
|
706 | 706 | rename from z |
|
707 | 707 | rename to zz |
|
708 | 708 | |
|
709 | 709 | $ hg debugrename aa |
|
710 | 710 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e |
|
711 | 711 | $ hg debugrename zz |
|
712 | 712 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a |
|
713 | 713 | $ hg debugrename cc |
|
714 | 714 | cc not renamed |
|
715 | 715 | $ hg mv zz z |
|
716 | 716 | $ hg ci --amend -m 'merge bar (undo rename)' |
|
717 | 717 | $ hg log --config diff.git=1 -pr . |
|
718 | 718 | changeset: 22:06423be42d60 |
|
719 | 719 | tag: tip |
|
720 | 720 | parent: 19:30d96aeaf27b |
|
721 | 721 | parent: 18:1aa437659d19 |
|
722 | 722 | user: test |
|
723 | 723 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
724 | 724 | summary: merge bar (undo rename) |
|
725 | 725 | |
|
726 | 726 | diff --git a/a b/aa |
|
727 | 727 | copy from a |
|
728 | 728 | copy to aa |
|
729 | 729 | diff --git a/cc b/cc |
|
730 | 730 | --- a/cc |
|
731 | 731 | +++ b/cc |
|
732 | 732 | @@ -1,1 +1,5 @@ |
|
733 | 733 | +<<<<<<< working copy: 30d96aeaf27b - test: aa |
|
734 | 734 | dd |
|
735 | 735 | +======= |
|
736 | 736 | +cc |
|
737 | 737 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc |
|
738 | 738 | |
|
739 | 739 | $ hg debugrename z |
|
740 | 740 | z not renamed |
|
741 | 741 | |
|
742 | 742 | Amend a merge changeset (with renames during the merge): |
|
743 | 743 | |
|
744 | 744 | $ hg up -q bar |
|
745 | 745 | $ echo x > x |
|
746 | 746 | $ hg add x |
|
747 | 747 | $ hg ci -m x |
|
748 | 748 | $ hg up -q default |
|
749 | 749 | $ hg merge -q bar |
|
750 | 750 | $ hg mv aa aaa |
|
751 | 751 | $ echo aa >> aaa |
|
752 | 752 | $ hg ci -m 'merge bar again' |
|
753 | 753 | $ hg log --config diff.git=1 -pr . |
|
754 | 754 | changeset: 24:a89974a20457 |
|
755 | 755 | tag: tip |
|
756 | 756 | parent: 22:06423be42d60 |
|
757 | 757 | parent: 23:4c94d5bc65f5 |
|
758 | 758 | user: test |
|
759 | 759 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
760 | 760 | summary: merge bar again |
|
761 | 761 | |
|
762 | 762 | diff --git a/aa b/aa |
|
763 | 763 | deleted file mode 100644 |
|
764 | 764 | --- a/aa |
|
765 | 765 | +++ /dev/null |
|
766 | 766 | @@ -1,2 +0,0 @@ |
|
767 | 767 | -a |
|
768 | 768 | -a |
|
769 | 769 | diff --git a/aaa b/aaa |
|
770 | 770 | new file mode 100644 |
|
771 | 771 | --- /dev/null |
|
772 | 772 | +++ b/aaa |
|
773 | 773 | @@ -0,0 +1,3 @@ |
|
774 | 774 | +a |
|
775 | 775 | +a |
|
776 | 776 | +aa |
|
777 | 777 | diff --git a/x b/x |
|
778 | 778 | new file mode 100644 |
|
779 | 779 | --- /dev/null |
|
780 | 780 | +++ b/x |
|
781 | 781 | @@ -0,0 +1,1 @@ |
|
782 | 782 | +x |
|
783 | 783 | |
|
784 | 784 | $ hg debugrename aaa |
|
785 | 785 | aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980 |
|
786 | 786 | |
|
787 | 787 | Update to p1 with 'aaa' modified. 'aaa' was renamed from 'aa' in p2. 'aa' exists |
|
788 | 788 | in p1 too, but it was recorded as copied from p2. |
|
789 | 789 | $ echo modified >> aaa |
|
790 | 790 | $ hg co -m '.^' -t :merge3 |
|
791 | 791 | file 'aaa' was deleted in other [destination] but was modified in local [working copy]. |
|
792 | 792 | You can use (c)hanged version, (d)elete, or leave (u)nresolved. |
|
793 | 793 | What do you want to do? u |
|
794 | 794 | 1 files updated, 0 files merged, 1 files removed, 1 files unresolved |
|
795 | 795 | use 'hg resolve' to retry unresolved file merges |
|
796 | 796 | [1] |
|
797 | 797 | $ hg co -C tip |
|
798 | 798 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
799 | 799 | |
|
800 | 800 | $ hg mv aaa aa |
|
801 | 801 | $ hg ci --amend -m 'merge bar again (undo rename)' |
|
802 | 802 | $ hg log --config diff.git=1 -pr . |
|
803 | 803 | changeset: 25:282080768800 |
|
804 | 804 | tag: tip |
|
805 | 805 | parent: 22:06423be42d60 |
|
806 | 806 | parent: 23:4c94d5bc65f5 |
|
807 | 807 | user: test |
|
808 | 808 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
809 | 809 | summary: merge bar again (undo rename) |
|
810 | 810 | |
|
811 | 811 | diff --git a/aa b/aa |
|
812 | 812 | --- a/aa |
|
813 | 813 | +++ b/aa |
|
814 | 814 | @@ -1,2 +1,3 @@ |
|
815 | 815 | a |
|
816 | 816 | a |
|
817 | 817 | +aa |
|
818 | 818 | diff --git a/x b/x |
|
819 | 819 | new file mode 100644 |
|
820 | 820 | --- /dev/null |
|
821 | 821 | +++ b/x |
|
822 | 822 | @@ -0,0 +1,1 @@ |
|
823 | 823 | +x |
|
824 | 824 | |
|
825 | 825 | $ hg debugrename aa |
|
826 | 826 | aa not renamed |
|
827 | 827 | $ hg debugrename -r '.^' aa |
|
828 | 828 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e |
|
829 | 829 | |
|
830 | 830 | Amend a merge changeset (with manifest-level conflicts): |
|
831 | 831 | |
|
832 | 832 | $ hg up -q bar |
|
833 | 833 | $ hg rm aa |
|
834 | 834 | $ hg ci -m 'rm aa' |
|
835 | 835 | $ hg up -q default |
|
836 | 836 | $ echo aa >> aa |
|
837 | 837 | $ hg ci -m aa |
|
838 | 838 | $ hg merge -q bar --config ui.interactive=True << EOF |
|
839 | 839 | > c |
|
840 | 840 | > EOF |
|
841 | 841 | file 'aa' was deleted in other [merge rev] but was modified in local [working copy]. |
|
842 | 842 | You can use (c)hanged version, (d)elete, or leave (u)nresolved. |
|
843 | 843 | What do you want to do? c |
|
844 | 844 | $ hg ci -m 'merge bar (with conflicts)' |
|
845 | 845 | $ hg log --config diff.git=1 -pr . |
|
846 | 846 | changeset: 28:ed15db12298d |
|
847 | 847 | tag: tip |
|
848 | 848 | parent: 27:eb5adec0b43b |
|
849 | 849 | parent: 26:67db8847a540 |
|
850 | 850 | user: test |
|
851 | 851 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
852 | 852 | summary: merge bar (with conflicts) |
|
853 | 853 | |
|
854 | 854 | |
|
855 | 855 | $ hg rm aa |
|
856 | 856 | $ hg ci --amend -m 'merge bar (with conflicts, amended)' |
|
857 | 857 | $ hg log --config diff.git=1 -pr . |
|
858 | 858 | changeset: 29:0eeafd043f63 |
|
859 | 859 | tag: tip |
|
860 | 860 | parent: 27:eb5adec0b43b |
|
861 | 861 | parent: 26:67db8847a540 |
|
862 | 862 | user: test |
|
863 | 863 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
864 | 864 | summary: merge bar (with conflicts, amended) |
|
865 | 865 | |
|
866 | 866 | diff --git a/aa b/aa |
|
867 | 867 | deleted file mode 100644 |
|
868 | 868 | --- a/aa |
|
869 | 869 | +++ /dev/null |
|
870 | 870 | @@ -1,4 +0,0 @@ |
|
871 | 871 | -a |
|
872 | 872 | -a |
|
873 | 873 | -aa |
|
874 | 874 | -aa |
|
875 | 875 | |
|
876 | 876 | Issue 3445: amending with --close-branch a commit that created a new head should fail |
|
877 | 877 | This shouldn't be possible: |
|
878 | 878 | |
|
879 | 879 | $ hg up -q default |
|
880 | 880 | $ hg branch closewithamend |
|
881 | 881 | marked working directory as branch closewithamend |
|
882 | 882 | $ echo foo > foo |
|
883 | 883 | $ hg add foo |
|
884 | 884 | $ hg ci -m.. |
|
885 | 885 | $ hg ci --amend --close-branch -m 'closing' |
|
886 | 886 | abort: can only close branch heads |
|
887 | 887 | [10] |
|
888 | 888 | |
|
889 | 889 | This silliness fails: |
|
890 | 890 | |
|
891 | 891 | $ hg branch silliness |
|
892 | 892 | marked working directory as branch silliness |
|
893 | 893 | $ echo b >> b |
|
894 | 894 | $ hg ci --close-branch -m'open and close' |
|
895 | 895 | abort: branch "silliness" has no heads to close |
|
896 | 896 | [10] |
|
897 | 897 | |
|
898 | 898 | Test that amend with --secret creates new secret changeset forcibly |
|
899 | 899 | --------------------------------------------------------------------- |
|
900 | 900 | |
|
901 | 901 | $ hg phase '.^::.' |
|
902 | 902 | 29: draft |
|
903 | 903 | 30: draft |
|
904 | 904 | $ hg commit --amend --secret -m 'amend as secret' -q |
|
905 | 905 | $ hg phase '.^::.' |
|
906 | 906 | 29: draft |
|
907 | 907 | 31: secret |
|
908 | 908 | |
|
909 | 909 | Test that amend with --edit invokes editor forcibly |
|
910 | 910 | --------------------------------------------------- |
|
911 | 911 | |
|
912 | 912 | $ hg parents --template "{desc}\n" |
|
913 | 913 | amend as secret |
|
914 | 914 | $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed" |
|
915 | 915 | $ hg parents --template "{desc}\n" |
|
916 | 916 | editor should be suppressed |
|
917 | 917 | |
|
918 | 918 | $ hg status --rev '.^1::.' |
|
919 | 919 | A foo |
|
920 | 920 | $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit |
|
921 | 921 | editor should be invoked |
|
922 | 922 | |
|
923 | 923 | |
|
924 | 924 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
925 | 925 | HG: Leave message empty to abort commit. |
|
926 | 926 | HG: -- |
|
927 | 927 | HG: user: test |
|
928 | 928 | HG: branch 'silliness' |
|
929 | 929 | HG: added foo |
|
930 | 930 | $ hg parents --template "{desc}\n" |
|
931 | 931 | editor should be invoked |
|
932 | 932 | |
|
933 | 933 | Test that amend with --no-edit avoids the editor |
|
934 | 934 | ------------------------------------------------ |
|
935 | 935 | |
|
936 | 936 | $ hg commit --amend -m "before anything happens" |
|
937 | 937 | $ hg parents --template "{desc}\n" |
|
938 | 938 | before anything happens |
|
939 | 939 | $ HGEDITOR=cat hg commit --amend --no-edit -m "editor should be suppressed" |
|
940 | 940 | $ hg parents --template "{desc}\n" |
|
941 | 941 | editor should be suppressed |
|
942 | 942 | |
|
943 | 943 | (We need a file change here since we won't have a message change) |
|
944 | 944 | $ cp foo foo.orig |
|
945 | 945 | $ echo hi >> foo |
|
946 | 946 | $ HGEDITOR=cat hg commit --amend --no-edit |
|
947 | 947 | $ hg parents --template "{desc}\n" |
|
948 | 948 | editor should be suppressed |
|
949 | 949 | $ hg status -mar |
|
950 | 950 | (Let's undo adding that "hi" so later tests don't need to be adjusted) |
|
951 | 951 | $ mv foo.orig foo |
|
952 | 952 | $ hg commit --amend --no-edit |
|
953 | 953 | |
|
954 | 954 | Test that "diff()" in committemplate works correctly for amending |
|
955 | 955 | ----------------------------------------------------------------- |
|
956 | 956 | |
|
957 | 957 | $ cat >> .hg/hgrc <<EOF |
|
958 | 958 | > [committemplate] |
|
959 | 959 | > changeset.commit.amend = {desc}\n |
|
960 | 960 | > HG: M: {file_mods} |
|
961 | 961 | > HG: A: {file_adds} |
|
962 | 962 | > HG: R: {file_dels} |
|
963 | 963 | > {splitlines(diff()) % 'HG: {line}\n'} |
|
964 | 964 | > EOF |
|
965 | 965 | |
|
966 | 966 | $ hg parents --template "M: {file_mods}\nA: {file_adds}\nR: {file_dels}\n" |
|
967 | 967 | M: |
|
968 | 968 | A: foo |
|
969 | 969 | R: |
|
970 | 970 | $ hg status -amr |
|
971 | 971 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo" |
|
972 | 972 | expecting diff of foo |
|
973 | 973 | |
|
974 | 974 | HG: M: |
|
975 | 975 | HG: A: foo |
|
976 | 976 | HG: R: |
|
977 | 977 | HG: diff -r 0eeafd043f63 foo |
|
978 | 978 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
979 | 979 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
980 | 980 | HG: @@ -0,0 +1,1 @@ |
|
981 | 981 | HG: +foo |
|
982 | 982 | |
|
983 | 983 | $ echo y > y |
|
984 | 984 | $ hg add y |
|
985 | 985 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y" |
|
986 | 986 | expecting diff of foo and y |
|
987 | 987 | |
|
988 | 988 | HG: M: |
|
989 | 989 | HG: A: foo y |
|
990 | 990 | HG: R: |
|
991 | 991 | HG: diff -r 0eeafd043f63 foo |
|
992 | 992 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
993 | 993 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
994 | 994 | HG: @@ -0,0 +1,1 @@ |
|
995 | 995 | HG: +foo |
|
996 | 996 | HG: diff -r 0eeafd043f63 y |
|
997 | 997 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
998 | 998 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
999 | 999 | HG: @@ -0,0 +1,1 @@ |
|
1000 | 1000 | HG: +y |
|
1001 | 1001 | |
|
1002 | 1002 | $ hg rm a |
|
1003 | 1003 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y" |
|
1004 | 1004 | expecting diff of a, foo and y |
|
1005 | 1005 | |
|
1006 | 1006 | HG: M: |
|
1007 | 1007 | HG: A: foo y |
|
1008 | 1008 | HG: R: a |
|
1009 | 1009 | HG: diff -r 0eeafd043f63 a |
|
1010 | 1010 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
1011 | 1011 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1012 | 1012 | HG: @@ -1,2 +0,0 @@ |
|
1013 | 1013 | HG: -a |
|
1014 | 1014 | HG: -a |
|
1015 | 1015 | HG: diff -r 0eeafd043f63 foo |
|
1016 | 1016 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1017 | 1017 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
1018 | 1018 | HG: @@ -0,0 +1,1 @@ |
|
1019 | 1019 | HG: +foo |
|
1020 | 1020 | HG: diff -r 0eeafd043f63 y |
|
1021 | 1021 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1022 | 1022 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
1023 | 1023 | HG: @@ -0,0 +1,1 @@ |
|
1024 | 1024 | HG: +y |
|
1025 | 1025 | |
|
1026 | 1026 | $ hg rm x |
|
1027 | 1027 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y" |
|
1028 | 1028 | expecting diff of a, foo, x and y |
|
1029 | 1029 | |
|
1030 | 1030 | HG: M: |
|
1031 | 1031 | HG: A: foo y |
|
1032 | 1032 | HG: R: a x |
|
1033 | 1033 | HG: diff -r 0eeafd043f63 a |
|
1034 | 1034 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
1035 | 1035 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1036 | 1036 | HG: @@ -1,2 +0,0 @@ |
|
1037 | 1037 | HG: -a |
|
1038 | 1038 | HG: -a |
|
1039 | 1039 | HG: diff -r 0eeafd043f63 foo |
|
1040 | 1040 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1041 | 1041 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
1042 | 1042 | HG: @@ -0,0 +1,1 @@ |
|
1043 | 1043 | HG: +foo |
|
1044 | 1044 | HG: diff -r 0eeafd043f63 x |
|
1045 | 1045 | HG: --- a/x Thu Jan 01 00:00:00 1970 +0000 |
|
1046 | 1046 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1047 | 1047 | HG: @@ -1,1 +0,0 @@ |
|
1048 | 1048 | HG: -x |
|
1049 | 1049 | HG: diff -r 0eeafd043f63 y |
|
1050 | 1050 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1051 | 1051 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
1052 | 1052 | HG: @@ -0,0 +1,1 @@ |
|
1053 | 1053 | HG: +y |
|
1054 | 1054 | |
|
1055 | 1055 | $ echo cccc >> cc |
|
1056 | 1056 | $ hg status -amr |
|
1057 | 1057 | M cc |
|
1058 | 1058 | $ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc |
|
1059 | 1059 | cc should be excluded |
|
1060 | 1060 | |
|
1061 | 1061 | HG: M: |
|
1062 | 1062 | HG: A: foo y |
|
1063 | 1063 | HG: R: a x |
|
1064 | 1064 | HG: diff -r 0eeafd043f63 a |
|
1065 | 1065 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
1066 | 1066 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1067 | 1067 | HG: @@ -1,2 +0,0 @@ |
|
1068 | 1068 | HG: -a |
|
1069 | 1069 | HG: -a |
|
1070 | 1070 | HG: diff -r 0eeafd043f63 foo |
|
1071 | 1071 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1072 | 1072 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
1073 | 1073 | HG: @@ -0,0 +1,1 @@ |
|
1074 | 1074 | HG: +foo |
|
1075 | 1075 | HG: diff -r 0eeafd043f63 x |
|
1076 | 1076 | HG: --- a/x Thu Jan 01 00:00:00 1970 +0000 |
|
1077 | 1077 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1078 | 1078 | HG: @@ -1,1 +0,0 @@ |
|
1079 | 1079 | HG: -x |
|
1080 | 1080 | HG: diff -r 0eeafd043f63 y |
|
1081 | 1081 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1082 | 1082 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
1083 | 1083 | HG: @@ -0,0 +1,1 @@ |
|
1084 | 1084 | HG: +y |
|
1085 | 1085 | |
|
1086 | 1086 | Check for issue4405 |
|
1087 | 1087 | ------------------- |
|
1088 | 1088 | |
|
1089 | 1089 | Setup the repo with a file that gets moved in a second commit. |
|
1090 | 1090 | $ hg init repo |
|
1091 | 1091 | $ cd repo |
|
1092 | 1092 | $ touch a0 |
|
1093 | 1093 | $ hg add a0 |
|
1094 | 1094 | $ hg commit -m a0 |
|
1095 | 1095 | $ hg mv a0 a1 |
|
1096 | 1096 | $ hg commit -m a1 |
|
1097 | 1097 | $ hg up -q 0 |
|
1098 | 1098 | $ hg log -G --template '{rev} {desc}' |
|
1099 | 1099 | o 1 a1 |
|
1100 | 1100 | | |
|
1101 | 1101 | @ 0 a0 |
|
1102 | 1102 | |
|
1103 | 1103 | |
|
1104 | 1104 | Now we branch the repro, but re-use the file contents, so we have a divergence |
|
1105 | 1105 | in the file revlog topology and the changelog topology. |
|
1106 | 1106 | $ hg revert --rev 1 --all |
|
1107 | 1107 | removing a0 |
|
1108 | 1108 | adding a1 |
|
1109 | 1109 | $ hg ci -qm 'a1-amend' |
|
1110 | 1110 | $ hg log -G --template '{rev} {desc}' |
|
1111 | 1111 | @ 2 a1-amend |
|
1112 | 1112 | | |
|
1113 | 1113 | | o 1 a1 |
|
1114 | 1114 | |/ |
|
1115 | 1115 | o 0 a0 |
|
1116 | 1116 | |
|
1117 | 1117 | |
|
1118 | 1118 | The way mercurial does amends is by folding the working copy and old commit |
|
1119 | 1119 | together into another commit (rev 3). During this process, _findlimit is called |
|
1120 | 1120 | to check how far back to look for the transitive closure of file copy |
|
1121 | 1121 | information, but due to the divergence of the filelog and changelog graph |
|
1122 | 1122 | topologies, before _findlimit was fixed, it returned a rev which was not far |
|
1123 | 1123 | enough back in this case. |
|
1124 | 1124 | $ hg mv a1 a2 |
|
1125 | 1125 | $ hg status --copies --rev 0 |
|
1126 | 1126 | A a2 |
|
1127 | 1127 | a0 |
|
1128 | 1128 | R a0 |
|
1129 | 1129 | $ hg ci --amend -q |
|
1130 | 1130 | $ hg log -G --template '{rev} {desc}' |
|
1131 | 1131 | @ 3 a1-amend |
|
1132 | 1132 | | |
|
1133 | 1133 | | o 1 a1 |
|
1134 | 1134 | |/ |
|
1135 | 1135 | o 0 a0 |
|
1136 | 1136 | |
|
1137 | 1137 | |
|
1138 | 1138 | Before the fix, the copy information was lost. |
|
1139 | 1139 | $ hg status --copies --rev 0 |
|
1140 | 1140 | A a2 |
|
1141 | 1141 | a0 |
|
1142 | 1142 | R a0 |
|
1143 | 1143 | $ cd .. |
|
1144 | 1144 | |
|
1145 | 1145 | Check that amend properly preserve rename from directory rename (issue-4516) |
|
1146 | 1146 | |
|
1147 | 1147 | If a parent of the merge renames a full directory, any files added to the old |
|
1148 | 1148 | directory in the other parent will be renamed to the new directory. For some |
|
1149 | 1149 | reason, the rename metadata was when amending such merge. This test ensure we |
|
1150 | 1150 | do not regress. We have a dedicated repo because it needs a setup with renamed |
|
1151 | 1151 | directory) |
|
1152 | 1152 | |
|
1153 | 1153 | $ hg init issue4516 |
|
1154 | 1154 | $ cd issue4516 |
|
1155 | 1155 | $ mkdir olddirname |
|
1156 | 1156 | $ echo line1 > olddirname/commonfile.py |
|
1157 | 1157 | $ hg add olddirname/commonfile.py |
|
1158 | 1158 | $ hg ci -m first |
|
1159 | 1159 | |
|
1160 | 1160 | $ hg branch newdirname |
|
1161 | 1161 | marked working directory as branch newdirname |
|
1162 | 1162 | (branches are permanent and global, did you want a bookmark?) |
|
1163 | 1163 | $ hg mv olddirname newdirname |
|
1164 | 1164 | moving olddirname/commonfile.py to newdirname/commonfile.py |
|
1165 | 1165 | $ hg ci -m rename |
|
1166 | 1166 | |
|
1167 | 1167 | $ hg update default |
|
1168 | 1168 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1169 | 1169 | $ echo line1 > olddirname/newfile.py |
|
1170 | 1170 | $ hg add olddirname/newfile.py |
|
1171 | 1171 | $ hg ci -m log |
|
1172 | 1172 | |
|
1173 | 1173 | $ hg up newdirname |
|
1174 | 1174 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
1175 | 1175 | $ # create newdirname/newfile.py |
|
1176 | 1176 | $ hg merge default |
|
1177 | 1177 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1178 | 1178 | (branch merge, don't forget to commit) |
|
1179 | 1179 | $ hg ci -m add |
|
1180 | 1180 | $ |
|
1181 | 1181 | $ hg debugrename newdirname/newfile.py |
|
1182 | 1182 | newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def |
|
1183 | 1183 | $ hg status -C --change . |
|
1184 | 1184 | A newdirname/newfile.py |
|
1185 | 1185 | $ hg status -C --rev 1 |
|
1186 | 1186 | A newdirname/newfile.py |
|
1187 | 1187 | $ hg status -C --rev 2 |
|
1188 | 1188 | A newdirname/commonfile.py |
|
1189 | 1189 | olddirname/commonfile.py |
|
1190 | 1190 | A newdirname/newfile.py |
|
1191 | 1191 | olddirname/newfile.py |
|
1192 | 1192 | R olddirname/commonfile.py |
|
1193 | 1193 | R olddirname/newfile.py |
|
1194 | 1194 | $ hg debugindex newdirname/newfile.py |
|
1195 | 1195 | rev linkrev nodeid p1 p2 |
|
1196 | 1196 | 0 3 34a4d536c0c0 000000000000 000000000000 |
|
1197 | 1197 | |
|
1198 | 1198 | $ echo a >> newdirname/commonfile.py |
|
1199 | 1199 | $ hg ci --amend -m bug |
|
1200 | 1200 | $ hg debugrename newdirname/newfile.py |
|
1201 | 1201 | newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def |
|
1202 | 1202 | $ hg debugindex newdirname/newfile.py |
|
1203 | 1203 | rev linkrev nodeid p1 p2 |
|
1204 | 1204 | 0 3 34a4d536c0c0 000000000000 000000000000 |
|
1205 | 1205 | |
|
1206 | 1206 | #if execbit |
|
1207 | 1207 | |
|
1208 | 1208 | Test if amend preserves executable bit changes |
|
1209 | 1209 | $ chmod +x newdirname/commonfile.py |
|
1210 | 1210 | $ hg ci -m chmod |
|
1211 | 1211 | $ hg ci --amend -m "chmod amended" |
|
1212 | 1212 | $ hg ci --amend -m "chmod amended second time" |
|
1213 | 1213 | $ hg log -p --git -r . |
|
1214 | 1214 | changeset: 7:b1326f52dddf |
|
1215 | 1215 | branch: newdirname |
|
1216 | 1216 | tag: tip |
|
1217 | 1217 | parent: 4:7fd235f7cb2f |
|
1218 | 1218 | user: test |
|
1219 | 1219 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1220 | 1220 | summary: chmod amended second time |
|
1221 | 1221 | |
|
1222 | 1222 | diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py |
|
1223 | 1223 | old mode 100644 |
|
1224 | 1224 | new mode 100755 |
|
1225 | 1225 | |
|
1226 | 1226 | #endif |
|
1227 | 1227 | |
|
1228 | 1228 | Test amend with file inclusion options |
|
1229 | 1229 | -------------------------------------- |
|
1230 | 1230 | |
|
1231 | 1231 | These tests ensure that we are always amending some files that were part of the |
|
1232 | 1232 | pre-amend commit. We want to test that the remaining files in the pre-amend |
|
1233 | 1233 | commit were not changed in the amended commit. We do so by performing a diff of |
|
1234 | 1234 | the amended commit against its parent commit. |
|
1235 | 1235 | $ cd .. |
|
1236 | 1236 | $ hg init testfileinclusions |
|
1237 | 1237 | $ cd testfileinclusions |
|
1238 | 1238 | $ echo a > a |
|
1239 | 1239 | $ echo b > b |
|
1240 | 1240 | $ hg commit -Aqm "Adding a and b" |
|
1241 | 1241 | |
|
1242 | 1242 | Only add changes to a particular file |
|
1243 | 1243 | $ echo a >> a |
|
1244 | 1244 | $ echo b >> b |
|
1245 | 1245 | $ hg commit --amend -I a |
|
1246 | 1246 | $ hg diff --git -r null -r . |
|
1247 | 1247 | diff --git a/a b/a |
|
1248 | 1248 | new file mode 100644 |
|
1249 | 1249 | --- /dev/null |
|
1250 | 1250 | +++ b/a |
|
1251 | 1251 | @@ -0,0 +1,2 @@ |
|
1252 | 1252 | +a |
|
1253 | 1253 | +a |
|
1254 | 1254 | diff --git a/b b/b |
|
1255 | 1255 | new file mode 100644 |
|
1256 | 1256 | --- /dev/null |
|
1257 | 1257 | +++ b/b |
|
1258 | 1258 | @@ -0,0 +1,1 @@ |
|
1259 | 1259 | +b |
|
1260 | 1260 | |
|
1261 | 1261 | $ echo a >> a |
|
1262 | 1262 | $ hg commit --amend b |
|
1263 | 1263 | $ hg diff --git -r null -r . |
|
1264 | 1264 | diff --git a/a b/a |
|
1265 | 1265 | new file mode 100644 |
|
1266 | 1266 | --- /dev/null |
|
1267 | 1267 | +++ b/a |
|
1268 | 1268 | @@ -0,0 +1,2 @@ |
|
1269 | 1269 | +a |
|
1270 | 1270 | +a |
|
1271 | 1271 | diff --git a/b b/b |
|
1272 | 1272 | new file mode 100644 |
|
1273 | 1273 | --- /dev/null |
|
1274 | 1274 | +++ b/b |
|
1275 | 1275 | @@ -0,0 +1,2 @@ |
|
1276 | 1276 | +b |
|
1277 | 1277 | +b |
|
1278 | 1278 | |
|
1279 | 1279 | Exclude changes to a particular file |
|
1280 | 1280 | $ echo b >> b |
|
1281 | 1281 | $ hg commit --amend -X a |
|
1282 | 1282 | $ hg diff --git -r null -r . |
|
1283 | 1283 | diff --git a/a b/a |
|
1284 | 1284 | new file mode 100644 |
|
1285 | 1285 | --- /dev/null |
|
1286 | 1286 | +++ b/a |
|
1287 | 1287 | @@ -0,0 +1,2 @@ |
|
1288 | 1288 | +a |
|
1289 | 1289 | +a |
|
1290 | 1290 | diff --git a/b b/b |
|
1291 | 1291 | new file mode 100644 |
|
1292 | 1292 | --- /dev/null |
|
1293 | 1293 | +++ b/b |
|
1294 | 1294 | @@ -0,0 +1,3 @@ |
|
1295 | 1295 | +b |
|
1296 | 1296 | +b |
|
1297 | 1297 | +b |
|
1298 | 1298 | |
|
1299 | 1299 | Check the addremove flag |
|
1300 | 1300 | $ echo c > c |
|
1301 | 1301 | $ rm a |
|
1302 | 1302 | $ hg commit --amend -A |
|
1303 | 1303 | removing a |
|
1304 | 1304 | adding c |
|
1305 | 1305 | $ hg diff --git -r null -r . |
|
1306 | 1306 | diff --git a/b b/b |
|
1307 | 1307 | new file mode 100644 |
|
1308 | 1308 | --- /dev/null |
|
1309 | 1309 | +++ b/b |
|
1310 | 1310 | @@ -0,0 +1,3 @@ |
|
1311 | 1311 | +b |
|
1312 | 1312 | +b |
|
1313 | 1313 | +b |
|
1314 | 1314 | diff --git a/c b/c |
|
1315 | 1315 | new file mode 100644 |
|
1316 | 1316 | --- /dev/null |
|
1317 | 1317 | +++ b/c |
|
1318 | 1318 | @@ -0,0 +1,1 @@ |
|
1319 | 1319 | +c |
@@ -1,157 +1,157 b'' | |||
|
1 | 1 | #testcases abortcommand abortflag |
|
2 | 2 | #if abortflag |
|
3 | 3 | $ cat >> $HGRCPATH <<EOF |
|
4 | 4 | > [alias] |
|
5 | 5 | > abort = merge --abort |
|
6 | 6 | > EOF |
|
7 | 7 | #endif |
|
8 | 8 | |
|
9 | 9 | $ addcommit () { |
|
10 | 10 | > echo $1 > $1 |
|
11 | 11 | > hg add $1 |
|
12 | 12 | > hg commit -d "${2} 0" -m $1 |
|
13 | 13 | > } |
|
14 | 14 | |
|
15 | 15 | $ commit () { |
|
16 | 16 | > hg commit -d "${2} 0" -m $1 |
|
17 | 17 | > } |
|
18 | 18 | |
|
19 | 19 | $ hg init a |
|
20 | 20 | $ cd a |
|
21 | 21 | $ addcommit "A" 0 |
|
22 | 22 | $ addcommit "B" 1 |
|
23 | 23 | $ echo "C" >> A |
|
24 | 24 | $ commit "C" 2 |
|
25 | 25 | |
|
26 | 26 | $ hg update -C 0 |
|
27 | 27 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
28 | 28 | $ echo "D" >> A |
|
29 | 29 | $ commit "D" 3 |
|
30 | 30 | created new head |
|
31 | 31 | |
|
32 | 32 | State before the merge |
|
33 | 33 | |
|
34 | 34 | $ hg status |
|
35 | 35 | $ hg id |
|
36 | 36 | e45016d2b3d3 tip |
|
37 | 37 | $ hg summary |
|
38 | 38 | parent: 3:e45016d2b3d3 tip |
|
39 | 39 | D |
|
40 | 40 | branch: default |
|
41 | 41 | commit: (clean) |
|
42 | 42 | update: 2 new changesets, 2 branch heads (merge) |
|
43 | 43 | phases: 4 draft |
|
44 | 44 | |
|
45 | 45 | Testing the abort functionality first in case of conflicts |
|
46 | 46 | |
|
47 | 47 | $ hg abort |
|
48 | 48 | abort: no merge in progress (abortflag !) |
|
49 | 49 | abort: no operation in progress (abortcommand !) |
|
50 | 50 | [20] |
|
51 | 51 | |
|
52 | 52 | $ hg merge |
|
53 | 53 | merging A |
|
54 | 54 | warning: conflicts while merging A! (edit, then use 'hg resolve --mark') |
|
55 | 55 | 1 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
56 | 56 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
57 | 57 | [1] |
|
58 | 58 | |
|
59 | 59 | $ hg merge --abort e4501 |
|
60 | 60 | abort: cannot specify a node with --abort |
|
61 | 61 | [10] |
|
62 | 62 | $ hg merge --abort --rev e4501 |
|
63 | 63 | abort: cannot specify both --abort and --rev |
|
64 | 64 | [10] |
|
65 | 65 | |
|
66 | 66 | #if abortcommand |
|
67 | 67 | when in dry-run mode |
|
68 | 68 | $ hg abort --dry-run |
|
69 | 69 | merge in progress, will be aborted |
|
70 | 70 | #endif |
|
71 | 71 | |
|
72 | 72 | $ hg abort |
|
73 | 73 | aborting the merge, updating back to e45016d2b3d3 |
|
74 | 74 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
75 | 75 | |
|
76 | 76 | Checking that we got back in the same state |
|
77 | 77 | |
|
78 | 78 | $ hg status |
|
79 | 79 | ? A.orig |
|
80 | 80 | $ hg id |
|
81 | 81 | e45016d2b3d3 tip |
|
82 | 82 | $ hg summary |
|
83 | 83 | parent: 3:e45016d2b3d3 tip |
|
84 | 84 | D |
|
85 | 85 | branch: default |
|
86 | 86 | commit: 1 unknown (clean) |
|
87 | 87 | update: 2 new changesets, 2 branch heads (merge) |
|
88 | 88 | phases: 4 draft |
|
89 | 89 | |
|
90 | 90 | Merging a conflict araises |
|
91 | 91 | |
|
92 | 92 | $ hg merge |
|
93 | 93 | merging A |
|
94 | 94 | warning: conflicts while merging A! (edit, then use 'hg resolve --mark') |
|
95 | 95 | 1 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
96 | 96 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
97 | 97 | [1] |
|
98 | 98 | |
|
99 | 99 | Correct the conflict without marking the file as resolved |
|
100 | 100 | |
|
101 | 101 | $ echo "ABCD" > A |
|
102 | 102 | $ hg commit -m "Merged" |
|
103 | 103 | abort: unresolved merge conflicts (see 'hg help resolve') |
|
104 |
[2 |
|
|
104 | [20] | |
|
105 | 105 | |
|
106 | 106 | Mark the conflict as resolved and commit |
|
107 | 107 | |
|
108 | 108 | $ hg resolve -m A |
|
109 | 109 | (no more unresolved files) |
|
110 | 110 | $ hg commit -m "Merged" |
|
111 | 111 | |
|
112 | 112 | Test that if a file is removed but not marked resolved, the commit still fails |
|
113 | 113 | (issue4972) |
|
114 | 114 | |
|
115 | 115 | $ hg up ".^" |
|
116 | 116 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
117 | 117 | $ hg merge 2 |
|
118 | 118 | merging A |
|
119 | 119 | warning: conflicts while merging A! (edit, then use 'hg resolve --mark') |
|
120 | 120 | 1 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
121 | 121 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
122 | 122 | [1] |
|
123 | 123 | $ hg rm --force A |
|
124 | 124 | $ hg commit -m merged |
|
125 | 125 | abort: unresolved merge conflicts (see 'hg help resolve') |
|
126 |
[2 |
|
|
126 | [20] | |
|
127 | 127 | |
|
128 | 128 | $ hg resolve -ma |
|
129 | 129 | (no more unresolved files) |
|
130 | 130 | $ hg commit -m merged |
|
131 | 131 | created new head |
|
132 | 132 | |
|
133 | 133 | Testing the abort functionality in case of no conflicts |
|
134 | 134 | |
|
135 | 135 | $ hg update -C 0 |
|
136 | 136 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
137 | 137 | $ addcommit "E" 4 |
|
138 | 138 | created new head |
|
139 | 139 | $ hg id |
|
140 | 140 | 68352a18a7c4 tip |
|
141 | 141 | |
|
142 | 142 | $ hg merge -r 4 |
|
143 | 143 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
144 | 144 | (branch merge, don't forget to commit) |
|
145 | 145 | |
|
146 | 146 | $ hg merge --preview --abort |
|
147 | 147 | abort: cannot specify both --abort and --preview |
|
148 | 148 | [10] |
|
149 | 149 | |
|
150 | 150 | $ hg abort |
|
151 | 151 | aborting the merge, updating back to 68352a18a7c4 |
|
152 | 152 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
153 | 153 | |
|
154 | 154 | $ hg id |
|
155 | 155 | 68352a18a7c4 tip |
|
156 | 156 | |
|
157 | 157 | $ cd .. |
@@ -1,934 +1,934 b'' | |||
|
1 | 1 | $ cat >> $HGRCPATH <<EOF |
|
2 | 2 | > [extdiff] |
|
3 | 3 | > # for portability: |
|
4 | 4 | > pdiff = sh "$RUNTESTDIR/pdiff" |
|
5 | 5 | > EOF |
|
6 | 6 | |
|
7 | 7 | Create a repo with some stuff in it: |
|
8 | 8 | |
|
9 | 9 | $ hg init a |
|
10 | 10 | $ cd a |
|
11 | 11 | $ echo a > a |
|
12 | 12 | $ echo a > d |
|
13 | 13 | $ echo a > e |
|
14 | 14 | $ hg ci -qAm0 |
|
15 | 15 | $ echo b > a |
|
16 | 16 | $ hg ci -m1 -u bar |
|
17 | 17 | $ hg mv a b |
|
18 | 18 | $ hg ci -m2 |
|
19 | 19 | $ hg cp b c |
|
20 | 20 | $ hg ci -m3 -u baz |
|
21 | 21 | $ echo b > d |
|
22 | 22 | $ echo f > e |
|
23 | 23 | $ hg ci -m4 |
|
24 | 24 | $ hg up -q 3 |
|
25 | 25 | $ echo b > e |
|
26 | 26 | $ hg branch -q stable |
|
27 | 27 | $ hg ci -m5 |
|
28 | 28 | $ hg merge -q default --tool internal:local # for conflicts in e, choose 5 and ignore 4 |
|
29 | 29 | $ hg branch -q default |
|
30 | 30 | $ hg ci -m6 |
|
31 | 31 | $ hg phase --public 3 |
|
32 | 32 | $ hg phase --force --secret 6 |
|
33 | 33 | |
|
34 | 34 | $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n' |
|
35 | 35 | @ test@6.secret: 6 |
|
36 | 36 | |\ |
|
37 | 37 | | o test@5.draft: 5 |
|
38 | 38 | | | |
|
39 | 39 | o | test@4.draft: 4 |
|
40 | 40 | |/ |
|
41 | 41 | o baz@3.public: 3 |
|
42 | 42 | | |
|
43 | 43 | o test@2.public: 2 |
|
44 | 44 | | |
|
45 | 45 | o bar@1.public: 1 |
|
46 | 46 | | |
|
47 | 47 | o test@0.public: 0 |
|
48 | 48 | |
|
49 | 49 | Test --base for grafting the merge of 4 from the perspective of 5, thus only getting the change to d |
|
50 | 50 | |
|
51 | 51 | $ hg up -cqr 3 |
|
52 | 52 | $ hg graft -r 6 --base 5 |
|
53 | 53 | grafting 6:25a2b029d3ae "6" (tip) |
|
54 | 54 | merging e |
|
55 | 55 | $ hg st --change . |
|
56 | 56 | M d |
|
57 | 57 | |
|
58 | 58 | $ hg -q strip . --config extensions.strip= |
|
59 | 59 | |
|
60 | 60 | Test --base for collapsing changesets 2 and 3, thus getting both b and c |
|
61 | 61 | |
|
62 | 62 | $ hg up -cqr 0 |
|
63 | 63 | $ hg graft -r 3 --base 1 |
|
64 | 64 | grafting 3:4c60f11aa304 "3" |
|
65 | 65 | merging a and b to b |
|
66 | 66 | merging a and c to c |
|
67 | 67 | $ hg st --change . |
|
68 | 68 | A b |
|
69 | 69 | A c |
|
70 | 70 | R a |
|
71 | 71 | |
|
72 | 72 | $ hg -q strip . --config extensions.strip= |
|
73 | 73 | |
|
74 | 74 | Specifying child as --base revision fails safely (perhaps slightly confusing, but consistent) |
|
75 | 75 | |
|
76 | 76 | $ hg graft -r 2 --base 3 |
|
77 | 77 | grafting 2:5c095ad7e90f "2" |
|
78 | 78 | note: possible conflict - c was deleted and renamed to: |
|
79 | 79 | a |
|
80 | 80 | note: graft of 2:5c095ad7e90f created no changes to commit |
|
81 | 81 | |
|
82 | 82 | Can't continue without starting: |
|
83 | 83 | |
|
84 | 84 | $ hg -q up -cr tip |
|
85 | 85 | $ hg rm -q e |
|
86 | 86 | $ hg graft --continue |
|
87 | 87 | abort: no graft in progress |
|
88 | 88 | [20] |
|
89 | 89 | $ hg revert -r . -q e |
|
90 | 90 | |
|
91 | 91 | Need to specify a rev: |
|
92 | 92 | |
|
93 | 93 | $ hg graft |
|
94 | 94 | abort: no revisions specified |
|
95 | 95 | [10] |
|
96 | 96 | |
|
97 | 97 | Can't graft ancestor: |
|
98 | 98 | |
|
99 | 99 | $ hg graft 1 2 |
|
100 | 100 | skipping ancestor revision 1:5d205f8b35b6 |
|
101 | 101 | skipping ancestor revision 2:5c095ad7e90f |
|
102 | 102 | [255] |
|
103 | 103 | |
|
104 | 104 | Specify revisions with -r: |
|
105 | 105 | |
|
106 | 106 | $ hg graft -r 1 -r 2 |
|
107 | 107 | skipping ancestor revision 1:5d205f8b35b6 |
|
108 | 108 | skipping ancestor revision 2:5c095ad7e90f |
|
109 | 109 | [255] |
|
110 | 110 | |
|
111 | 111 | $ hg graft -r 1 2 |
|
112 | 112 | warning: inconsistent use of --rev might give unexpected revision ordering! |
|
113 | 113 | skipping ancestor revision 2:5c095ad7e90f |
|
114 | 114 | skipping ancestor revision 1:5d205f8b35b6 |
|
115 | 115 | [255] |
|
116 | 116 | |
|
117 | 117 | Conflicting date/user options: |
|
118 | 118 | |
|
119 | 119 | $ hg up -q 0 |
|
120 | 120 | $ hg graft -U --user foo 2 |
|
121 | 121 | abort: cannot specify both --user and --currentuser |
|
122 | 122 | [10] |
|
123 | 123 | $ hg graft -D --date '0 0' 2 |
|
124 | 124 | abort: cannot specify both --date and --currentdate |
|
125 | 125 | [10] |
|
126 | 126 | |
|
127 | 127 | Can't graft with dirty wd: |
|
128 | 128 | |
|
129 | 129 | $ hg up -q 0 |
|
130 | 130 | $ echo foo > a |
|
131 | 131 | $ hg graft 1 |
|
132 | 132 | abort: uncommitted changes |
|
133 | 133 | [20] |
|
134 | 134 | $ hg revert a |
|
135 | 135 | |
|
136 | 136 | Graft a rename: |
|
137 | 137 | (this also tests that editor is invoked if '--edit' is specified) |
|
138 | 138 | |
|
139 | 139 | $ hg status --rev "2^1" --rev 2 |
|
140 | 140 | A b |
|
141 | 141 | R a |
|
142 | 142 | $ HGEDITOR=cat hg graft 2 -u foo --edit |
|
143 | 143 | grafting 2:5c095ad7e90f "2" |
|
144 | 144 | merging a and b to b |
|
145 | 145 | 2 |
|
146 | 146 | |
|
147 | 147 | |
|
148 | 148 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
149 | 149 | HG: Leave message empty to abort commit. |
|
150 | 150 | HG: -- |
|
151 | 151 | HG: user: foo |
|
152 | 152 | HG: branch 'default' |
|
153 | 153 | HG: added b |
|
154 | 154 | HG: removed a |
|
155 | 155 | $ hg export tip --git |
|
156 | 156 | # HG changeset patch |
|
157 | 157 | # User foo |
|
158 | 158 | # Date 0 0 |
|
159 | 159 | # Thu Jan 01 00:00:00 1970 +0000 |
|
160 | 160 | # Node ID ef0ef43d49e79e81ddafdc7997401ba0041efc82 |
|
161 | 161 | # Parent 68795b066622ca79a25816a662041d8f78f3cd9e |
|
162 | 162 | 2 |
|
163 | 163 | |
|
164 | 164 | diff --git a/a b/b |
|
165 | 165 | rename from a |
|
166 | 166 | rename to b |
|
167 | 167 | |
|
168 | 168 | Look for extra:source |
|
169 | 169 | |
|
170 | 170 | $ hg log --debug -r tip |
|
171 | 171 | changeset: 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82 |
|
172 | 172 | tag: tip |
|
173 | 173 | phase: draft |
|
174 | 174 | parent: 0:68795b066622ca79a25816a662041d8f78f3cd9e |
|
175 | 175 | parent: -1:0000000000000000000000000000000000000000 |
|
176 | 176 | manifest: 7:e59b6b228f9cbf9903d5e9abf996e083a1f533eb |
|
177 | 177 | user: foo |
|
178 | 178 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
179 | 179 | files+: b |
|
180 | 180 | files-: a |
|
181 | 181 | extra: branch=default |
|
182 | 182 | extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4 |
|
183 | 183 | description: |
|
184 | 184 | 2 |
|
185 | 185 | |
|
186 | 186 | |
|
187 | 187 | |
|
188 | 188 | Graft out of order, skipping a merge and a duplicate |
|
189 | 189 | (this also tests that editor is not invoked if '--edit' is not specified) |
|
190 | 190 | |
|
191 | 191 | $ hg graft 1 5 4 3 'merge()' 2 -n |
|
192 | 192 | skipping ungraftable merge revision 6 |
|
193 | 193 | skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7) |
|
194 | 194 | grafting 1:5d205f8b35b6 "1" |
|
195 | 195 | grafting 5:97f8bfe72746 "5" |
|
196 | 196 | grafting 4:9c233e8e184d "4" |
|
197 | 197 | grafting 3:4c60f11aa304 "3" |
|
198 | 198 | |
|
199 | 199 | $ HGEDITOR=cat hg graft 1 5 'merge()' 2 --debug |
|
200 | 200 | skipping ungraftable merge revision 6 |
|
201 | 201 | scanning for duplicate grafts |
|
202 | 202 | skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7) |
|
203 | 203 | grafting 1:5d205f8b35b6 "1" |
|
204 | 204 | unmatched files in local: |
|
205 | 205 | b |
|
206 | 206 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
207 | 207 | on local side: |
|
208 | 208 | src: 'a' -> dst: 'b' * |
|
209 | 209 | checking for directory renames |
|
210 | 210 | resolving manifests |
|
211 | 211 | branchmerge: True, force: True, partial: False |
|
212 | 212 | ancestor: 68795b066622, local: ef0ef43d49e7+, remote: 5d205f8b35b6 |
|
213 | 213 | preserving b for resolve of b |
|
214 | 214 | starting 4 threads for background file closing (?) |
|
215 | 215 | b: local copied/moved from a -> m (premerge) |
|
216 | 216 | picked tool ':merge' for b (binary False symlink False changedelete False) |
|
217 | 217 | merging b and a to b |
|
218 | 218 | my b@ef0ef43d49e7+ other a@5d205f8b35b6 ancestor a@68795b066622 |
|
219 | 219 | premerge successful |
|
220 | 220 | committing files: |
|
221 | 221 | b |
|
222 | 222 | committing manifest |
|
223 | 223 | committing changelog |
|
224 | 224 | updating the branch cache |
|
225 | 225 | grafting 5:97f8bfe72746 "5" |
|
226 | 226 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
227 | 227 | on local side: |
|
228 | 228 | src: 'c' -> dst: 'b' |
|
229 | 229 | checking for directory renames |
|
230 | 230 | resolving manifests |
|
231 | 231 | branchmerge: True, force: True, partial: False |
|
232 | 232 | ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746 |
|
233 | 233 | e: remote is newer -> g |
|
234 | 234 | getting e |
|
235 | 235 | committing files: |
|
236 | 236 | e |
|
237 | 237 | committing manifest |
|
238 | 238 | committing changelog |
|
239 | 239 | updating the branch cache |
|
240 | 240 | $ HGEDITOR=cat hg graft 4 3 --log --debug |
|
241 | 241 | scanning for duplicate grafts |
|
242 | 242 | grafting 4:9c233e8e184d "4" |
|
243 | 243 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
244 | 244 | on local side: |
|
245 | 245 | src: 'c' -> dst: 'b' |
|
246 | 246 | checking for directory renames |
|
247 | 247 | resolving manifests |
|
248 | 248 | branchmerge: True, force: True, partial: False |
|
249 | 249 | ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d |
|
250 | 250 | d: remote is newer -> g |
|
251 | 251 | getting d |
|
252 | 252 | preserving e for resolve of e |
|
253 | 253 | e: versions differ -> m (premerge) |
|
254 | 254 | picked tool ':merge' for e (binary False symlink False changedelete False) |
|
255 | 255 | merging e |
|
256 | 256 | my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304 |
|
257 | 257 | e: versions differ -> m (merge) |
|
258 | 258 | picked tool ':merge' for e (binary False symlink False changedelete False) |
|
259 | 259 | my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304 |
|
260 | 260 | warning: conflicts while merging e! (edit, then use 'hg resolve --mark') |
|
261 | 261 | abort: unresolved conflicts, can't continue |
|
262 | 262 | (use 'hg resolve' and 'hg graft --continue') |
|
263 | 263 | [1] |
|
264 | 264 | |
|
265 | 265 | Summary should mention graft: |
|
266 | 266 | |
|
267 | 267 | $ hg summary |grep graft |
|
268 | 268 | commit: 2 modified, 2 unknown, 1 unresolved (graft in progress) |
|
269 | 269 | |
|
270 | 270 | Using status to get more context |
|
271 | 271 | |
|
272 | 272 | $ hg status --verbose |
|
273 | 273 | M d |
|
274 | 274 | M e |
|
275 | 275 | ? a.orig |
|
276 | 276 | ? e.orig |
|
277 | 277 | # The repository is in an unfinished *graft* state. |
|
278 | 278 | |
|
279 | 279 | # Unresolved merge conflicts: |
|
280 | 280 | # |
|
281 | 281 | # e |
|
282 | 282 | # |
|
283 | 283 | # To mark files as resolved: hg resolve --mark FILE |
|
284 | 284 | |
|
285 | 285 | # To continue: hg graft --continue |
|
286 | 286 | # To abort: hg graft --abort |
|
287 | 287 | # To stop: hg graft --stop |
|
288 | 288 | |
|
289 | 289 | |
|
290 | 290 | Commit while interrupted should fail: |
|
291 | 291 | |
|
292 | 292 | $ hg ci -m 'commit interrupted graft' |
|
293 | 293 | abort: graft in progress |
|
294 | 294 | (use 'hg graft --continue' or 'hg graft --stop' to stop) |
|
295 | 295 | [20] |
|
296 | 296 | |
|
297 | 297 | Abort the graft and try committing: |
|
298 | 298 | |
|
299 | 299 | $ hg up -C . |
|
300 | 300 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
301 | 301 | $ echo c >> e |
|
302 | 302 | $ hg ci -mtest |
|
303 | 303 | |
|
304 | 304 | $ hg strip . --config extensions.strip= |
|
305 | 305 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
306 | 306 | saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob) |
|
307 | 307 | |
|
308 | 308 | Graft again: |
|
309 | 309 | |
|
310 | 310 | $ hg graft 1 5 4 3 'merge()' 2 |
|
311 | 311 | skipping ungraftable merge revision 6 |
|
312 | 312 | skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7) |
|
313 | 313 | skipping revision 1:5d205f8b35b6 (already grafted to 8:6b9e5368ca4e) |
|
314 | 314 | skipping revision 5:97f8bfe72746 (already grafted to 9:1905859650ec) |
|
315 | 315 | grafting 4:9c233e8e184d "4" |
|
316 | 316 | merging e |
|
317 | 317 | warning: conflicts while merging e! (edit, then use 'hg resolve --mark') |
|
318 | 318 | abort: unresolved conflicts, can't continue |
|
319 | 319 | (use 'hg resolve' and 'hg graft --continue') |
|
320 | 320 | [1] |
|
321 | 321 | |
|
322 | 322 | Continue without resolve should fail: |
|
323 | 323 | |
|
324 | 324 | $ hg graft -c |
|
325 | 325 | grafting 4:9c233e8e184d "4" |
|
326 | 326 | abort: unresolved merge conflicts (see 'hg help resolve') |
|
327 |
[2 |
|
|
327 | [20] | |
|
328 | 328 | |
|
329 | 329 | Fix up: |
|
330 | 330 | |
|
331 | 331 | $ echo b > e |
|
332 | 332 | $ hg resolve -m e |
|
333 | 333 | (no more unresolved files) |
|
334 | 334 | continue: hg graft --continue |
|
335 | 335 | |
|
336 | 336 | Continue with a revision should fail: |
|
337 | 337 | |
|
338 | 338 | $ hg graft -c 6 |
|
339 | 339 | abort: can't specify --continue and revisions |
|
340 | 340 | [10] |
|
341 | 341 | |
|
342 | 342 | $ hg graft -c -r 6 |
|
343 | 343 | abort: can't specify --continue and revisions |
|
344 | 344 | [10] |
|
345 | 345 | |
|
346 | 346 | Continue for real, clobber usernames |
|
347 | 347 | |
|
348 | 348 | $ hg graft -c -U |
|
349 | 349 | grafting 4:9c233e8e184d "4" |
|
350 | 350 | grafting 3:4c60f11aa304 "3" |
|
351 | 351 | |
|
352 | 352 | Compare with original: |
|
353 | 353 | |
|
354 | 354 | $ hg diff -r 6 |
|
355 | 355 | $ hg status --rev 0:. -C |
|
356 | 356 | M d |
|
357 | 357 | M e |
|
358 | 358 | A b |
|
359 | 359 | a |
|
360 | 360 | A c |
|
361 | 361 | a |
|
362 | 362 | R a |
|
363 | 363 | |
|
364 | 364 | View graph: |
|
365 | 365 | |
|
366 | 366 | $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n' |
|
367 | 367 | @ test@11.draft: 3 |
|
368 | 368 | | |
|
369 | 369 | o test@10.draft: 4 |
|
370 | 370 | | |
|
371 | 371 | o test@9.draft: 5 |
|
372 | 372 | | |
|
373 | 373 | o bar@8.draft: 1 |
|
374 | 374 | | |
|
375 | 375 | o foo@7.draft: 2 |
|
376 | 376 | | |
|
377 | 377 | | o test@6.secret: 6 |
|
378 | 378 | | |\ |
|
379 | 379 | | | o test@5.draft: 5 |
|
380 | 380 | | | | |
|
381 | 381 | | o | test@4.draft: 4 |
|
382 | 382 | | |/ |
|
383 | 383 | | o baz@3.public: 3 |
|
384 | 384 | | | |
|
385 | 385 | | o test@2.public: 2 |
|
386 | 386 | | | |
|
387 | 387 | | o bar@1.public: 1 |
|
388 | 388 | |/ |
|
389 | 389 | o test@0.public: 0 |
|
390 | 390 | |
|
391 | 391 | Graft again onto another branch should preserve the original source |
|
392 | 392 | $ hg up -q 0 |
|
393 | 393 | $ echo 'g'>g |
|
394 | 394 | $ hg add g |
|
395 | 395 | $ hg ci -m 7 |
|
396 | 396 | created new head |
|
397 | 397 | $ hg graft 7 |
|
398 | 398 | grafting 7:ef0ef43d49e7 "2" |
|
399 | 399 | |
|
400 | 400 | $ hg log -r 7 --template '{rev}:{node}\n' |
|
401 | 401 | 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82 |
|
402 | 402 | $ hg log -r 2 --template '{rev}:{node}\n' |
|
403 | 403 | 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4 |
|
404 | 404 | |
|
405 | 405 | $ hg log --debug -r tip |
|
406 | 406 | changeset: 13:7a4785234d87ec1aa420ed6b11afe40fa73e12a9 |
|
407 | 407 | tag: tip |
|
408 | 408 | phase: draft |
|
409 | 409 | parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f |
|
410 | 410 | parent: -1:0000000000000000000000000000000000000000 |
|
411 | 411 | manifest: 13:dc313617b8c32457c0d589e0dbbedfe71f3cd637 |
|
412 | 412 | user: foo |
|
413 | 413 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
414 | 414 | files+: b |
|
415 | 415 | files-: a |
|
416 | 416 | extra: branch=default |
|
417 | 417 | extra: intermediate-source=ef0ef43d49e79e81ddafdc7997401ba0041efc82 |
|
418 | 418 | extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4 |
|
419 | 419 | description: |
|
420 | 420 | 2 |
|
421 | 421 | |
|
422 | 422 | |
|
423 | 423 | Disallow grafting an already grafted cset onto its original branch |
|
424 | 424 | $ hg up -q 6 |
|
425 | 425 | $ hg graft 7 |
|
426 | 426 | skipping already grafted revision 7:ef0ef43d49e7 (was grafted from 2:5c095ad7e90f) |
|
427 | 427 | [255] |
|
428 | 428 | |
|
429 | 429 | $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13 |
|
430 | 430 | --- */hg-5c095ad7e90f.patch * (glob) |
|
431 | 431 | +++ */hg-7a4785234d87.patch * (glob) |
|
432 | 432 | @@ -1,18 +1,18 @@ |
|
433 | 433 | # HG changeset patch |
|
434 | 434 | -# User test |
|
435 | 435 | +# User foo |
|
436 | 436 | # Date 0 0 |
|
437 | 437 | # Thu Jan 01 00:00:00 1970 +0000 |
|
438 | 438 | -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4 |
|
439 | 439 | -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04 |
|
440 | 440 | +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9 |
|
441 | 441 | +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f |
|
442 | 442 | 2 |
|
443 | 443 | |
|
444 | 444 | -diff -r 5d205f8b35b6 -r 5c095ad7e90f a |
|
445 | 445 | +diff -r b592ea63bb0c -r 7a4785234d87 a |
|
446 | 446 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
447 | 447 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
448 | 448 | @@ -1,1 +0,0 @@ |
|
449 | 449 | --b |
|
450 | 450 | -diff -r 5d205f8b35b6 -r 5c095ad7e90f b |
|
451 | 451 | +-a |
|
452 | 452 | +diff -r b592ea63bb0c -r 7a4785234d87 b |
|
453 | 453 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
454 | 454 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 |
|
455 | 455 | @@ -0,0 +1,1 @@ |
|
456 | 456 | -+b |
|
457 | 457 | ++a |
|
458 | 458 | [1] |
|
459 | 459 | |
|
460 | 460 | $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13 -X . |
|
461 | 461 | --- */hg-5c095ad7e90f.patch * (glob) |
|
462 | 462 | +++ */hg-7a4785234d87.patch * (glob) |
|
463 | 463 | @@ -1,8 +1,8 @@ |
|
464 | 464 | # HG changeset patch |
|
465 | 465 | -# User test |
|
466 | 466 | +# User foo |
|
467 | 467 | # Date 0 0 |
|
468 | 468 | # Thu Jan 01 00:00:00 1970 +0000 |
|
469 | 469 | -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4 |
|
470 | 470 | -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04 |
|
471 | 471 | +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9 |
|
472 | 472 | +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f |
|
473 | 473 | 2 |
|
474 | 474 | |
|
475 | 475 | [1] |
|
476 | 476 | |
|
477 | 477 | Disallow grafting already grafted csets with the same origin onto each other |
|
478 | 478 | $ hg up -q 13 |
|
479 | 479 | $ hg graft 2 |
|
480 | 480 | skipping revision 2:5c095ad7e90f (already grafted to 13:7a4785234d87) |
|
481 | 481 | [255] |
|
482 | 482 | $ hg graft 7 |
|
483 | 483 | skipping already grafted revision 7:ef0ef43d49e7 (13:7a4785234d87 also has origin 2:5c095ad7e90f) |
|
484 | 484 | [255] |
|
485 | 485 | |
|
486 | 486 | $ hg up -q 7 |
|
487 | 487 | $ hg graft 2 |
|
488 | 488 | skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7) |
|
489 | 489 | [255] |
|
490 | 490 | $ hg graft tip |
|
491 | 491 | skipping already grafted revision 13:7a4785234d87 (7:ef0ef43d49e7 also has origin 2:5c095ad7e90f) |
|
492 | 492 | [255] |
|
493 | 493 | |
|
494 | 494 | Graft with --log |
|
495 | 495 | |
|
496 | 496 | $ hg up -Cq 1 |
|
497 | 497 | $ hg graft 3 --log -u foo |
|
498 | 498 | grafting 3:4c60f11aa304 "3" |
|
499 | 499 | $ hg log --template '{rev}:{node|short} {parents} {desc}\n' -r tip |
|
500 | 500 | 14:0c921c65ef1e 1:5d205f8b35b6 3 |
|
501 | 501 | (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8) |
|
502 | 502 | |
|
503 | 503 | Resolve conflicted graft |
|
504 | 504 | $ hg up -q 0 |
|
505 | 505 | $ echo b > a |
|
506 | 506 | $ hg ci -m 8 |
|
507 | 507 | created new head |
|
508 | 508 | $ echo c > a |
|
509 | 509 | $ hg ci -m 9 |
|
510 | 510 | $ hg graft 1 --tool internal:fail |
|
511 | 511 | grafting 1:5d205f8b35b6 "1" |
|
512 | 512 | abort: unresolved conflicts, can't continue |
|
513 | 513 | (use 'hg resolve' and 'hg graft --continue') |
|
514 | 514 | [1] |
|
515 | 515 | $ hg resolve --all |
|
516 | 516 | merging a |
|
517 | 517 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
518 | 518 | [1] |
|
519 | 519 | $ cat a |
|
520 | 520 | <<<<<<< local: aaa4406d4f0a - test: 9 |
|
521 | 521 | c |
|
522 | 522 | ======= |
|
523 | 523 | b |
|
524 | 524 | >>>>>>> graft: 5d205f8b35b6 - bar: 1 |
|
525 | 525 | $ echo b > a |
|
526 | 526 | $ hg resolve -m a |
|
527 | 527 | (no more unresolved files) |
|
528 | 528 | continue: hg graft --continue |
|
529 | 529 | $ hg graft -c |
|
530 | 530 | grafting 1:5d205f8b35b6 "1" |
|
531 | 531 | $ hg export tip --git |
|
532 | 532 | # HG changeset patch |
|
533 | 533 | # User bar |
|
534 | 534 | # Date 0 0 |
|
535 | 535 | # Thu Jan 01 00:00:00 1970 +0000 |
|
536 | 536 | # Node ID f67661df0c4804d301f064f332b57e7d5ddaf2be |
|
537 | 537 | # Parent aaa4406d4f0ae9befd6e58c82ec63706460cbca6 |
|
538 | 538 | 1 |
|
539 | 539 | |
|
540 | 540 | diff --git a/a b/a |
|
541 | 541 | --- a/a |
|
542 | 542 | +++ b/a |
|
543 | 543 | @@ -1,1 +1,1 @@ |
|
544 | 544 | -c |
|
545 | 545 | +b |
|
546 | 546 | |
|
547 | 547 | Resolve conflicted graft with rename |
|
548 | 548 | $ echo c > a |
|
549 | 549 | $ hg ci -m 10 |
|
550 | 550 | $ hg graft 2 --tool internal:fail |
|
551 | 551 | grafting 2:5c095ad7e90f "2" |
|
552 | 552 | abort: unresolved conflicts, can't continue |
|
553 | 553 | (use 'hg resolve' and 'hg graft --continue') |
|
554 | 554 | [1] |
|
555 | 555 | $ hg resolve --all |
|
556 | 556 | merging a and b to b |
|
557 | 557 | (no more unresolved files) |
|
558 | 558 | continue: hg graft --continue |
|
559 | 559 | $ hg graft -c |
|
560 | 560 | grafting 2:5c095ad7e90f "2" |
|
561 | 561 | $ hg export tip --git |
|
562 | 562 | # HG changeset patch |
|
563 | 563 | # User test |
|
564 | 564 | # Date 0 0 |
|
565 | 565 | # Thu Jan 01 00:00:00 1970 +0000 |
|
566 | 566 | # Node ID 9627f653b421c61fc1ea4c4e366745070fa3d2bc |
|
567 | 567 | # Parent ee295f490a40b97f3d18dd4c4f1c8936c233b612 |
|
568 | 568 | 2 |
|
569 | 569 | |
|
570 | 570 | diff --git a/a b/b |
|
571 | 571 | rename from a |
|
572 | 572 | rename to b |
|
573 | 573 | |
|
574 | 574 | Test simple origin(), with and without args |
|
575 | 575 | $ hg log -r 'origin()' |
|
576 | 576 | changeset: 1:5d205f8b35b6 |
|
577 | 577 | user: bar |
|
578 | 578 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
579 | 579 | summary: 1 |
|
580 | 580 | |
|
581 | 581 | changeset: 2:5c095ad7e90f |
|
582 | 582 | user: test |
|
583 | 583 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
584 | 584 | summary: 2 |
|
585 | 585 | |
|
586 | 586 | changeset: 3:4c60f11aa304 |
|
587 | 587 | user: baz |
|
588 | 588 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
589 | 589 | summary: 3 |
|
590 | 590 | |
|
591 | 591 | changeset: 4:9c233e8e184d |
|
592 | 592 | user: test |
|
593 | 593 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
594 | 594 | summary: 4 |
|
595 | 595 | |
|
596 | 596 | changeset: 5:97f8bfe72746 |
|
597 | 597 | branch: stable |
|
598 | 598 | parent: 3:4c60f11aa304 |
|
599 | 599 | user: test |
|
600 | 600 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
601 | 601 | summary: 5 |
|
602 | 602 | |
|
603 | 603 | $ hg log -r 'origin(7)' |
|
604 | 604 | changeset: 2:5c095ad7e90f |
|
605 | 605 | user: test |
|
606 | 606 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
607 | 607 | summary: 2 |
|
608 | 608 | |
|
609 | 609 | Now transplant a graft to test following through copies |
|
610 | 610 | $ hg up -q 0 |
|
611 | 611 | $ hg branch -q dev |
|
612 | 612 | $ hg ci -qm "dev branch" |
|
613 | 613 | $ hg --config extensions.transplant= transplant -q 7 |
|
614 | 614 | $ hg log -r 'origin(.)' |
|
615 | 615 | changeset: 2:5c095ad7e90f |
|
616 | 616 | user: test |
|
617 | 617 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
618 | 618 | summary: 2 |
|
619 | 619 | |
|
620 | 620 | Test that the graft and transplant markers in extra are converted, allowing |
|
621 | 621 | origin() to still work. Note that these recheck the immediately preceeding two |
|
622 | 622 | tests. |
|
623 | 623 | $ hg --quiet --config extensions.convert= --config convert.hg.saverev=True convert . ../converted |
|
624 | 624 | |
|
625 | 625 | The graft case |
|
626 | 626 | $ hg -R ../converted log -r 7 --template "{rev}: {node}\n{join(extras, '\n')}\n" |
|
627 | 627 | 7: 7ae846e9111fc8f57745634250c7b9ac0a60689b |
|
628 | 628 | branch=default |
|
629 | 629 | convert_revision=ef0ef43d49e79e81ddafdc7997401ba0041efc82 |
|
630 | 630 | source=e0213322b2c1a5d5d236c74e79666441bee67a7d |
|
631 | 631 | $ hg -R ../converted log -r 'origin(7)' |
|
632 | 632 | changeset: 2:e0213322b2c1 |
|
633 | 633 | user: test |
|
634 | 634 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
635 | 635 | summary: 2 |
|
636 | 636 | |
|
637 | 637 | Test that template correctly expands more than one 'extra' (issue4362), and that |
|
638 | 638 | 'intermediate-source' is converted. |
|
639 | 639 | $ hg -R ../converted log -r 13 --template "{extras % ' Extra: {extra}\n'}" |
|
640 | 640 | Extra: branch=default |
|
641 | 641 | Extra: convert_revision=7a4785234d87ec1aa420ed6b11afe40fa73e12a9 |
|
642 | 642 | Extra: intermediate-source=7ae846e9111fc8f57745634250c7b9ac0a60689b |
|
643 | 643 | Extra: source=e0213322b2c1a5d5d236c74e79666441bee67a7d |
|
644 | 644 | |
|
645 | 645 | The transplant case |
|
646 | 646 | $ hg -R ../converted log -r tip --template "{rev}: {node}\n{join(extras, '\n')}\n" |
|
647 | 647 | 21: fbb6c5cc81002f2b4b49c9d731404688bcae5ade |
|
648 | 648 | branch=dev |
|
649 | 649 | convert_revision=7e61b508e709a11d28194a5359bc3532d910af21 |
|
650 | 650 | transplant_source=z\xe8F\xe9\x11\x1f\xc8\xf5wEcBP\xc7\xb9\xac\n`h\x9b |
|
651 | 651 | $ hg -R ../converted log -r 'origin(tip)' |
|
652 | 652 | changeset: 2:e0213322b2c1 |
|
653 | 653 | user: test |
|
654 | 654 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
655 | 655 | summary: 2 |
|
656 | 656 | |
|
657 | 657 | |
|
658 | 658 | Test simple destination |
|
659 | 659 | $ hg log -r 'destination()' |
|
660 | 660 | changeset: 7:ef0ef43d49e7 |
|
661 | 661 | parent: 0:68795b066622 |
|
662 | 662 | user: foo |
|
663 | 663 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
664 | 664 | summary: 2 |
|
665 | 665 | |
|
666 | 666 | changeset: 8:6b9e5368ca4e |
|
667 | 667 | user: bar |
|
668 | 668 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
669 | 669 | summary: 1 |
|
670 | 670 | |
|
671 | 671 | changeset: 9:1905859650ec |
|
672 | 672 | user: test |
|
673 | 673 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
674 | 674 | summary: 5 |
|
675 | 675 | |
|
676 | 676 | changeset: 10:52dc0b4c6907 |
|
677 | 677 | user: test |
|
678 | 678 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
679 | 679 | summary: 4 |
|
680 | 680 | |
|
681 | 681 | changeset: 11:882b35362a6b |
|
682 | 682 | user: test |
|
683 | 683 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
684 | 684 | summary: 3 |
|
685 | 685 | |
|
686 | 686 | changeset: 13:7a4785234d87 |
|
687 | 687 | user: foo |
|
688 | 688 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
689 | 689 | summary: 2 |
|
690 | 690 | |
|
691 | 691 | changeset: 14:0c921c65ef1e |
|
692 | 692 | parent: 1:5d205f8b35b6 |
|
693 | 693 | user: foo |
|
694 | 694 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
695 | 695 | summary: 3 |
|
696 | 696 | |
|
697 | 697 | changeset: 17:f67661df0c48 |
|
698 | 698 | user: bar |
|
699 | 699 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
700 | 700 | summary: 1 |
|
701 | 701 | |
|
702 | 702 | changeset: 19:9627f653b421 |
|
703 | 703 | user: test |
|
704 | 704 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
705 | 705 | summary: 2 |
|
706 | 706 | |
|
707 | 707 | changeset: 21:7e61b508e709 |
|
708 | 708 | branch: dev |
|
709 | 709 | tag: tip |
|
710 | 710 | user: foo |
|
711 | 711 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
712 | 712 | summary: 2 |
|
713 | 713 | |
|
714 | 714 | $ hg log -r 'destination(2)' |
|
715 | 715 | changeset: 7:ef0ef43d49e7 |
|
716 | 716 | parent: 0:68795b066622 |
|
717 | 717 | user: foo |
|
718 | 718 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
719 | 719 | summary: 2 |
|
720 | 720 | |
|
721 | 721 | changeset: 13:7a4785234d87 |
|
722 | 722 | user: foo |
|
723 | 723 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
724 | 724 | summary: 2 |
|
725 | 725 | |
|
726 | 726 | changeset: 19:9627f653b421 |
|
727 | 727 | user: test |
|
728 | 728 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
729 | 729 | summary: 2 |
|
730 | 730 | |
|
731 | 731 | changeset: 21:7e61b508e709 |
|
732 | 732 | branch: dev |
|
733 | 733 | tag: tip |
|
734 | 734 | user: foo |
|
735 | 735 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
736 | 736 | summary: 2 |
|
737 | 737 | |
|
738 | 738 | Transplants of grafts can find a destination... |
|
739 | 739 | $ hg log -r 'destination(7)' |
|
740 | 740 | changeset: 21:7e61b508e709 |
|
741 | 741 | branch: dev |
|
742 | 742 | tag: tip |
|
743 | 743 | user: foo |
|
744 | 744 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
745 | 745 | summary: 2 |
|
746 | 746 | |
|
747 | 747 | ... grafts of grafts unfortunately can't |
|
748 | 748 | $ hg graft -q 13 --debug |
|
749 | 749 | scanning for duplicate grafts |
|
750 | 750 | grafting 13:7a4785234d87 "2" |
|
751 | 751 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
752 | 752 | on local side: |
|
753 | 753 | src: 'a' -> dst: 'b' * |
|
754 | 754 | on remote side: |
|
755 | 755 | src: 'a' -> dst: 'b' * |
|
756 | 756 | checking for directory renames |
|
757 | 757 | resolving manifests |
|
758 | 758 | branchmerge: True, force: True, partial: False |
|
759 | 759 | ancestor: b592ea63bb0c, local: 7e61b508e709+, remote: 7a4785234d87 |
|
760 | 760 | starting 4 threads for background file closing (?) |
|
761 | 761 | nothing to commit, clearing merge state |
|
762 | 762 | note: graft of 13:7a4785234d87 created no changes to commit |
|
763 | 763 | $ hg log -r 'destination(13)' |
|
764 | 764 | All copies of a cset |
|
765 | 765 | $ hg log -r 'origin(13) or destination(origin(13))' |
|
766 | 766 | changeset: 2:5c095ad7e90f |
|
767 | 767 | user: test |
|
768 | 768 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
769 | 769 | summary: 2 |
|
770 | 770 | |
|
771 | 771 | changeset: 7:ef0ef43d49e7 |
|
772 | 772 | parent: 0:68795b066622 |
|
773 | 773 | user: foo |
|
774 | 774 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
775 | 775 | summary: 2 |
|
776 | 776 | |
|
777 | 777 | changeset: 13:7a4785234d87 |
|
778 | 778 | user: foo |
|
779 | 779 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
780 | 780 | summary: 2 |
|
781 | 781 | |
|
782 | 782 | changeset: 19:9627f653b421 |
|
783 | 783 | user: test |
|
784 | 784 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
785 | 785 | summary: 2 |
|
786 | 786 | |
|
787 | 787 | changeset: 21:7e61b508e709 |
|
788 | 788 | branch: dev |
|
789 | 789 | tag: tip |
|
790 | 790 | user: foo |
|
791 | 791 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
792 | 792 | summary: 2 |
|
793 | 793 | |
|
794 | 794 | |
|
795 | 795 | graft skips ancestors |
|
796 | 796 | |
|
797 | 797 | $ hg graft 21 3 |
|
798 | 798 | skipping ancestor revision 21:7e61b508e709 |
|
799 | 799 | grafting 3:4c60f11aa304 "3" |
|
800 | 800 | merging b and c to c |
|
801 | 801 | |
|
802 | 802 | graft with --force (still doesn't graft merges) |
|
803 | 803 | |
|
804 | 804 | $ hg graft 19 0 6 |
|
805 | 805 | skipping ungraftable merge revision 6 |
|
806 | 806 | skipping ancestor revision 0:68795b066622 |
|
807 | 807 | grafting 19:9627f653b421 "2" |
|
808 | 808 | merging b |
|
809 | 809 | note: graft of 19:9627f653b421 created no changes to commit |
|
810 | 810 | $ hg graft 19 0 6 --force |
|
811 | 811 | skipping ungraftable merge revision 6 |
|
812 | 812 | grafting 19:9627f653b421 "2" |
|
813 | 813 | merging b |
|
814 | 814 | note: graft of 19:9627f653b421 created no changes to commit |
|
815 | 815 | grafting 0:68795b066622 "0" |
|
816 | 816 | |
|
817 | 817 | graft --force after backout. Do the backout with graft too, to make |
|
818 | 818 | sure we support issue6248. |
|
819 | 819 | |
|
820 | 820 | $ echo abc > a |
|
821 | 821 | $ hg ci -m 24 |
|
822 | 822 | $ hg graft --base . -r ".^" --no-commit |
|
823 | 823 | grafting 23:b1cac6de36a9 "0" |
|
824 | 824 | $ hg commit -m 'Backed out changeset 2e7ea477be26' |
|
825 | 825 | $ hg graft 24 |
|
826 | 826 | skipping ancestor revision 24:2e7ea477be26 |
|
827 | 827 | [255] |
|
828 | 828 | $ hg graft 24 --force |
|
829 | 829 | grafting 24:2e7ea477be26 "24" |
|
830 | 830 | merging a |
|
831 | 831 | $ cat a |
|
832 | 832 | abc |
|
833 | 833 | |
|
834 | 834 | graft --continue after --force |
|
835 | 835 | |
|
836 | 836 | $ echo def > a |
|
837 | 837 | $ hg ci -m 27 |
|
838 | 838 | $ hg graft 24 --force --tool internal:fail |
|
839 | 839 | grafting 24:2e7ea477be26 "24" |
|
840 | 840 | abort: unresolved conflicts, can't continue |
|
841 | 841 | (use 'hg resolve' and 'hg graft --continue') |
|
842 | 842 | [1] |
|
843 | 843 | $ hg resolve --all |
|
844 | 844 | merging a |
|
845 | 845 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
846 | 846 | [1] |
|
847 | 847 | $ echo abc > a |
|
848 | 848 | $ hg resolve -m a |
|
849 | 849 | (no more unresolved files) |
|
850 | 850 | continue: hg graft --continue |
|
851 | 851 | $ hg graft -c |
|
852 | 852 | grafting 24:2e7ea477be26 "24" |
|
853 | 853 | $ cat a |
|
854 | 854 | abc |
|
855 | 855 | |
|
856 | 856 | graft --continue after --base with conflits |
|
857 | 857 | |
|
858 | 858 | $ echo base > d |
|
859 | 859 | $ hg ci -m _ |
|
860 | 860 | $ hg graft -r 6 |
|
861 | 861 | skipping ungraftable merge revision 6 |
|
862 | 862 | [255] |
|
863 | 863 | $ hg graft -r 6 --base 5 |
|
864 | 864 | grafting 6:25a2b029d3ae "6" |
|
865 | 865 | merging d |
|
866 | 866 | merging e |
|
867 | 867 | warning: conflicts while merging d! (edit, then use 'hg resolve --mark') |
|
868 | 868 | abort: unresolved conflicts, can't continue |
|
869 | 869 | (use 'hg resolve' and 'hg graft --continue') |
|
870 | 870 | [1] |
|
871 | 871 | $ echo a > d && hg resolve -qm |
|
872 | 872 | continue: hg graft --continue |
|
873 | 873 | $ hg graft --continue |
|
874 | 874 | grafting 6:25a2b029d3ae "6" |
|
875 | 875 | |
|
876 | 876 | Continue testing same origin policy, using revision numbers from test above |
|
877 | 877 | but do some destructive editing of the repo: |
|
878 | 878 | |
|
879 | 879 | $ hg up -qC 7 |
|
880 | 880 | $ hg tag -l -r 13 tmp |
|
881 | 881 | $ hg --config extensions.strip= strip 2 |
|
882 | 882 | saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-d323a1e4-backup.hg |
|
883 | 883 | $ hg graft tmp |
|
884 | 884 | skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f) |
|
885 | 885 | [255] |
|
886 | 886 | |
|
887 | 887 | Empty graft |
|
888 | 888 | |
|
889 | 889 | $ hg up -qr 22 |
|
890 | 890 | $ hg tag -f something |
|
891 | 891 | $ hg graft -qr 23 |
|
892 | 892 | $ hg graft -f 23 |
|
893 | 893 | grafting 23:72d9c7c75bcc "24" |
|
894 | 894 | note: graft of 23:72d9c7c75bcc created no changes to commit |
|
895 | 895 | |
|
896 | 896 | $ cd .. |
|
897 | 897 | |
|
898 | 898 | Graft to duplicate a commit |
|
899 | 899 | |
|
900 | 900 | $ hg init graftsibling |
|
901 | 901 | $ cd graftsibling |
|
902 | 902 | $ touch a |
|
903 | 903 | $ hg commit -qAm a |
|
904 | 904 | $ touch b |
|
905 | 905 | $ hg commit -qAm b |
|
906 | 906 | $ hg log -G -T '{rev}\n' |
|
907 | 907 | @ 1 |
|
908 | 908 | | |
|
909 | 909 | o 0 |
|
910 | 910 | |
|
911 | 911 | $ hg up -q 0 |
|
912 | 912 | $ hg graft -r 1 |
|
913 | 913 | grafting 1:0e067c57feba "b" (tip) |
|
914 | 914 | $ hg log -G -T '{rev}\n' |
|
915 | 915 | @ 2 |
|
916 | 916 | | |
|
917 | 917 | | o 1 |
|
918 | 918 | |/ |
|
919 | 919 | o 0 |
|
920 | 920 | |
|
921 | 921 | Graft to duplicate a commit twice |
|
922 | 922 | |
|
923 | 923 | $ hg up -q 0 |
|
924 | 924 | $ hg graft -r 2 |
|
925 | 925 | grafting 2:044ec77f6389 "b" (tip) |
|
926 | 926 | $ hg log -G -T '{rev}\n' |
|
927 | 927 | @ 3 |
|
928 | 928 | | |
|
929 | 929 | | o 2 |
|
930 | 930 | |/ |
|
931 | 931 | | o 1 |
|
932 | 932 | |/ |
|
933 | 933 | o 0 |
|
934 | 934 |
@@ -1,500 +1,500 b'' | |||
|
1 | 1 | $ cat >> $HGRCPATH <<EOF |
|
2 | 2 | > [extensions] |
|
3 | 3 | > rebase= |
|
4 | 4 | > drawdag=$TESTDIR/drawdag.py |
|
5 | 5 | > |
|
6 | 6 | > [phases] |
|
7 | 7 | > publish=False |
|
8 | 8 | > |
|
9 | 9 | > [alias] |
|
10 | 10 | > tglog = log -G --template "{rev}:{phase} '{desc}' {branches} {bookmarks}\n" |
|
11 | 11 | > EOF |
|
12 | 12 | |
|
13 | 13 | $ hg init a |
|
14 | 14 | $ cd a |
|
15 | 15 | $ echo c1 >common |
|
16 | 16 | $ hg add common |
|
17 | 17 | $ hg ci -m C1 |
|
18 | 18 | |
|
19 | 19 | $ echo c2 >>common |
|
20 | 20 | $ hg ci -m C2 |
|
21 | 21 | |
|
22 | 22 | $ echo c3 >>common |
|
23 | 23 | $ hg ci -m C3 |
|
24 | 24 | |
|
25 | 25 | $ hg up -q -C 1 |
|
26 | 26 | |
|
27 | 27 | $ echo l1 >>extra |
|
28 | 28 | $ hg add extra |
|
29 | 29 | $ hg ci -m L1 |
|
30 | 30 | created new head |
|
31 | 31 | |
|
32 | 32 | $ sed -e 's/c2/l2/' common > common.new |
|
33 | 33 | $ mv common.new common |
|
34 | 34 | $ hg ci -m L2 |
|
35 | 35 | |
|
36 | 36 | $ echo l3 >> extra2 |
|
37 | 37 | $ hg add extra2 |
|
38 | 38 | $ hg ci -m L3 |
|
39 | 39 | $ hg bookmark mybook |
|
40 | 40 | |
|
41 | 41 | $ hg phase --force --secret 4 |
|
42 | 42 | |
|
43 | 43 | $ hg tglog |
|
44 | 44 | @ 5:secret 'L3' mybook |
|
45 | 45 | | |
|
46 | 46 | o 4:secret 'L2' |
|
47 | 47 | | |
|
48 | 48 | o 3:draft 'L1' |
|
49 | 49 | | |
|
50 | 50 | | o 2:draft 'C3' |
|
51 | 51 | |/ |
|
52 | 52 | o 1:draft 'C2' |
|
53 | 53 | | |
|
54 | 54 | o 0:draft 'C1' |
|
55 | 55 | |
|
56 | 56 | Try to call --continue: |
|
57 | 57 | |
|
58 | 58 | $ hg rebase --continue |
|
59 | 59 | abort: no rebase in progress |
|
60 | 60 | [20] |
|
61 | 61 | |
|
62 | 62 | Conflicting rebase: |
|
63 | 63 | |
|
64 | 64 | $ hg rebase -s 3 -d 2 |
|
65 | 65 | rebasing 3:3163e20567cc "L1" |
|
66 | 66 | rebasing 4:46f0b057b5c0 "L2" |
|
67 | 67 | merging common |
|
68 | 68 | warning: conflicts while merging common! (edit, then use 'hg resolve --mark') |
|
69 | 69 | unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') |
|
70 | 70 | [240] |
|
71 | 71 | |
|
72 | 72 | $ hg status --config commands.status.verbose=1 |
|
73 | 73 | M common |
|
74 | 74 | ? common.orig |
|
75 | 75 | # The repository is in an unfinished *rebase* state. |
|
76 | 76 | |
|
77 | 77 | # Unresolved merge conflicts: |
|
78 | 78 | # |
|
79 | 79 | # common |
|
80 | 80 | # |
|
81 | 81 | # To mark files as resolved: hg resolve --mark FILE |
|
82 | 82 | |
|
83 | 83 | # To continue: hg rebase --continue |
|
84 | 84 | # To abort: hg rebase --abort |
|
85 | 85 | # To stop: hg rebase --stop |
|
86 | 86 | |
|
87 | 87 | |
|
88 | 88 | Try to continue without solving the conflict: |
|
89 | 89 | |
|
90 | 90 | $ hg rebase --continue |
|
91 | 91 | abort: unresolved merge conflicts (see 'hg help resolve') |
|
92 |
[2 |
|
|
92 | [20] | |
|
93 | 93 | |
|
94 | 94 | Conclude rebase: |
|
95 | 95 | |
|
96 | 96 | $ echo 'resolved merge' >common |
|
97 | 97 | $ hg resolve -m common |
|
98 | 98 | (no more unresolved files) |
|
99 | 99 | continue: hg rebase --continue |
|
100 | 100 | $ hg rebase --continue |
|
101 | 101 | already rebased 3:3163e20567cc "L1" as 3e046f2ecedb |
|
102 | 102 | rebasing 4:46f0b057b5c0 "L2" |
|
103 | 103 | rebasing 5:8029388f38dc mybook "L3" |
|
104 | 104 | saved backup bundle to $TESTTMP/a/.hg/strip-backup/3163e20567cc-5ca4656e-rebase.hg |
|
105 | 105 | |
|
106 | 106 | $ hg tglog |
|
107 | 107 | @ 5:secret 'L3' mybook |
|
108 | 108 | | |
|
109 | 109 | o 4:secret 'L2' |
|
110 | 110 | | |
|
111 | 111 | o 3:draft 'L1' |
|
112 | 112 | | |
|
113 | 113 | o 2:draft 'C3' |
|
114 | 114 | | |
|
115 | 115 | o 1:draft 'C2' |
|
116 | 116 | | |
|
117 | 117 | o 0:draft 'C1' |
|
118 | 118 | |
|
119 | 119 | Check correctness: |
|
120 | 120 | |
|
121 | 121 | $ hg cat -r 0 common |
|
122 | 122 | c1 |
|
123 | 123 | |
|
124 | 124 | $ hg cat -r 1 common |
|
125 | 125 | c1 |
|
126 | 126 | c2 |
|
127 | 127 | |
|
128 | 128 | $ hg cat -r 2 common |
|
129 | 129 | c1 |
|
130 | 130 | c2 |
|
131 | 131 | c3 |
|
132 | 132 | |
|
133 | 133 | $ hg cat -r 3 common |
|
134 | 134 | c1 |
|
135 | 135 | c2 |
|
136 | 136 | c3 |
|
137 | 137 | |
|
138 | 138 | $ hg cat -r 4 common |
|
139 | 139 | resolved merge |
|
140 | 140 | |
|
141 | 141 | $ hg cat -r 5 common |
|
142 | 142 | resolved merge |
|
143 | 143 | |
|
144 | 144 | Bookmark stays active after --continue |
|
145 | 145 | $ hg bookmarks |
|
146 | 146 | * mybook 5:d67b21408fc0 |
|
147 | 147 | |
|
148 | 148 | $ cd .. |
|
149 | 149 | |
|
150 | 150 | Check that the right ancestors is used while rebasing a merge (issue4041) |
|
151 | 151 | |
|
152 | 152 | $ hg init issue4041 |
|
153 | 153 | $ cd issue4041 |
|
154 | 154 | $ hg unbundle "$TESTDIR/bundles/issue4041.hg" |
|
155 | 155 | adding changesets |
|
156 | 156 | adding manifests |
|
157 | 157 | adding file changes |
|
158 | 158 | added 11 changesets with 8 changes to 3 files (+1 heads) |
|
159 | 159 | new changesets 24797d4f68de:2f2496ddf49d (11 drafts) |
|
160 | 160 | (run 'hg heads' to see heads) |
|
161 | 161 | $ hg up default |
|
162 | 162 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
163 | 163 | $ hg log -G |
|
164 | 164 | o changeset: 10:2f2496ddf49d |
|
165 | 165 | |\ branch: f1 |
|
166 | 166 | | | tag: tip |
|
167 | 167 | | | parent: 7:4c9fbe56a16f |
|
168 | 168 | | | parent: 9:e31216eec445 |
|
169 | 169 | | | user: szhang |
|
170 | 170 | | | date: Thu Sep 05 12:59:39 2013 -0400 |
|
171 | 171 | | | summary: merge |
|
172 | 172 | | | |
|
173 | 173 | | o changeset: 9:e31216eec445 |
|
174 | 174 | | | branch: f1 |
|
175 | 175 | | | user: szhang |
|
176 | 176 | | | date: Thu Sep 05 12:59:10 2013 -0400 |
|
177 | 177 | | | summary: more changes to f1 |
|
178 | 178 | | | |
|
179 | 179 | | o changeset: 8:8e4e2c1a07ae |
|
180 | 180 | | |\ branch: f1 |
|
181 | 181 | | | | parent: 2:4bc80088dc6b |
|
182 | 182 | | | | parent: 6:400110238667 |
|
183 | 183 | | | | user: szhang |
|
184 | 184 | | | | date: Thu Sep 05 12:57:59 2013 -0400 |
|
185 | 185 | | | | summary: bad merge |
|
186 | 186 | | | | |
|
187 | 187 | o | | changeset: 7:4c9fbe56a16f |
|
188 | 188 | |/ / branch: f1 |
|
189 | 189 | | | parent: 2:4bc80088dc6b |
|
190 | 190 | | | user: szhang |
|
191 | 191 | | | date: Thu Sep 05 12:54:00 2013 -0400 |
|
192 | 192 | | | summary: changed f1 |
|
193 | 193 | | | |
|
194 | 194 | | o changeset: 6:400110238667 |
|
195 | 195 | | | branch: f2 |
|
196 | 196 | | | parent: 4:12e8ec6bb010 |
|
197 | 197 | | | user: szhang |
|
198 | 198 | | | date: Tue Sep 03 13:58:02 2013 -0400 |
|
199 | 199 | | | summary: changed f2 on f2 |
|
200 | 200 | | | |
|
201 | 201 | | | @ changeset: 5:d79e2059b5c0 |
|
202 | 202 | | | | parent: 3:8a951942e016 |
|
203 | 203 | | | | user: szhang |
|
204 | 204 | | | | date: Tue Sep 03 13:57:39 2013 -0400 |
|
205 | 205 | | | | summary: changed f2 on default |
|
206 | 206 | | | | |
|
207 | 207 | | o | changeset: 4:12e8ec6bb010 |
|
208 | 208 | | |/ branch: f2 |
|
209 | 209 | | | user: szhang |
|
210 | 210 | | | date: Tue Sep 03 13:57:18 2013 -0400 |
|
211 | 211 | | | summary: created f2 branch |
|
212 | 212 | | | |
|
213 | 213 | | o changeset: 3:8a951942e016 |
|
214 | 214 | | | parent: 0:24797d4f68de |
|
215 | 215 | | | user: szhang |
|
216 | 216 | | | date: Tue Sep 03 13:57:11 2013 -0400 |
|
217 | 217 | | | summary: added f2.txt |
|
218 | 218 | | | |
|
219 | 219 | o | changeset: 2:4bc80088dc6b |
|
220 | 220 | | | branch: f1 |
|
221 | 221 | | | user: szhang |
|
222 | 222 | | | date: Tue Sep 03 13:56:20 2013 -0400 |
|
223 | 223 | | | summary: added f1.txt |
|
224 | 224 | | | |
|
225 | 225 | o | changeset: 1:ef53c9e6b608 |
|
226 | 226 | |/ branch: f1 |
|
227 | 227 | | user: szhang |
|
228 | 228 | | date: Tue Sep 03 13:55:26 2013 -0400 |
|
229 | 229 | | summary: created f1 branch |
|
230 | 230 | | |
|
231 | 231 | o changeset: 0:24797d4f68de |
|
232 | 232 | user: szhang |
|
233 | 233 | date: Tue Sep 03 13:55:08 2013 -0400 |
|
234 | 234 | summary: added default.txt |
|
235 | 235 | |
|
236 | 236 | $ hg rebase -s9 -d2 --debug # use debug to really check merge base used |
|
237 | 237 | rebase onto 4bc80088dc6b starting from e31216eec445 |
|
238 | 238 | rebasing on disk |
|
239 | 239 | rebase status stored |
|
240 | 240 | rebasing 9:e31216eec445 "more changes to f1" |
|
241 | 241 | future parents are 2 and -1 |
|
242 | 242 | update to 2:4bc80088dc6b |
|
243 | 243 | resolving manifests |
|
244 | 244 | branchmerge: False, force: True, partial: False |
|
245 | 245 | ancestor: d79e2059b5c0+, local: d79e2059b5c0+, remote: 4bc80088dc6b |
|
246 | 246 | f2.txt: other deleted -> r |
|
247 | 247 | removing f2.txt |
|
248 | 248 | f1.txt: remote created -> g |
|
249 | 249 | getting f1.txt |
|
250 | 250 | merge against 9:e31216eec445 |
|
251 | 251 | detach base 8:8e4e2c1a07ae |
|
252 | 252 | resolving manifests |
|
253 | 253 | branchmerge: True, force: True, partial: False |
|
254 | 254 | ancestor: 8e4e2c1a07ae, local: 4bc80088dc6b+, remote: e31216eec445 |
|
255 | 255 | f1.txt: remote is newer -> g |
|
256 | 256 | getting f1.txt |
|
257 | 257 | committing files: |
|
258 | 258 | f1.txt |
|
259 | 259 | committing manifest |
|
260 | 260 | committing changelog |
|
261 | 261 | updating the branch cache |
|
262 | 262 | rebased as 19c888675e13 |
|
263 | 263 | rebase status stored |
|
264 | 264 | rebasing 10:2f2496ddf49d tip "merge" |
|
265 | 265 | future parents are 11 and 7 |
|
266 | 266 | already in destination |
|
267 | 267 | merge against 10:2f2496ddf49d |
|
268 | 268 | detach base 9:e31216eec445 |
|
269 | 269 | resolving manifests |
|
270 | 270 | branchmerge: True, force: True, partial: False |
|
271 | 271 | ancestor: e31216eec445, local: 19c888675e13+, remote: 2f2496ddf49d |
|
272 | 272 | f1.txt: remote is newer -> g |
|
273 | 273 | getting f1.txt |
|
274 | 274 | committing files: |
|
275 | 275 | f1.txt |
|
276 | 276 | committing manifest |
|
277 | 277 | committing changelog |
|
278 | 278 | updating the branch cache |
|
279 | 279 | rebased as 2a7f09cac94c |
|
280 | 280 | rebase status stored |
|
281 | 281 | rebase merging completed |
|
282 | 282 | update back to initial working directory parent |
|
283 | 283 | resolving manifests |
|
284 | 284 | branchmerge: False, force: False, partial: False |
|
285 | 285 | ancestor: 2a7f09cac94c, local: 2a7f09cac94c+, remote: d79e2059b5c0 |
|
286 | 286 | f1.txt: other deleted -> r |
|
287 | 287 | removing f1.txt |
|
288 | 288 | f2.txt: remote created -> g |
|
289 | 289 | getting f2.txt |
|
290 | 290 | 2 changesets found |
|
291 | 291 | list of changesets: |
|
292 | 292 | e31216eec445e44352c5f01588856059466a24c9 |
|
293 | 293 | 2f2496ddf49d69b5ef23ad8cf9fb2e0e4faf0ac2 |
|
294 | 294 | bundle2-output-bundle: "HG20", (1 params) 3 parts total |
|
295 | 295 | bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload |
|
296 | 296 | bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload |
|
297 | 297 | bundle2-output-part: "phase-heads" 24 bytes payload |
|
298 | 298 | saved backup bundle to $TESTTMP/issue4041/.hg/strip-backup/e31216eec445-15f7a814-rebase.hg |
|
299 | 299 | 3 changesets found |
|
300 | 300 | list of changesets: |
|
301 | 301 | 4c9fbe56a16f30c0d5dcc40ec1a97bbe3325209c |
|
302 | 302 | 19c888675e133ab5dff84516926a65672eaf04d9 |
|
303 | 303 | 2a7f09cac94c7f4b73ebd5cd1a62d3b2e8e336bf |
|
304 | 304 | bundle2-output-bundle: "HG20", 3 parts total |
|
305 | 305 | bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload |
|
306 | 306 | bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload |
|
307 | 307 | bundle2-output-part: "phase-heads" 24 bytes payload |
|
308 | 308 | adding branch |
|
309 | 309 | bundle2-input-bundle: with-transaction |
|
310 | 310 | bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported |
|
311 | 311 | adding changesets |
|
312 | 312 | add changeset 4c9fbe56a16f |
|
313 | 313 | add changeset 19c888675e13 |
|
314 | 314 | add changeset 2a7f09cac94c |
|
315 | 315 | adding manifests |
|
316 | 316 | adding file changes |
|
317 | 317 | adding f1.txt revisions |
|
318 | 318 | bundle2-input-part: total payload size 1686 |
|
319 | 319 | bundle2-input-part: "cache:rev-branch-cache" (advisory) supported |
|
320 | 320 | bundle2-input-part: total payload size 74 |
|
321 | 321 | truncating cache/rbc-revs-v1 to 56 |
|
322 | 322 | bundle2-input-part: "phase-heads" supported |
|
323 | 323 | bundle2-input-part: total payload size 24 |
|
324 | 324 | bundle2-input-bundle: 3 parts total |
|
325 | 325 | added 2 changesets with 2 changes to 1 files |
|
326 | 326 | updating the branch cache |
|
327 | 327 | invalid branch cache (served): tip differs |
|
328 | 328 | invalid branch cache (served.hidden): tip differs |
|
329 | 329 | rebase completed |
|
330 | 330 | |
|
331 | 331 | Test minimization of merge conflicts |
|
332 | 332 | $ hg up -q null |
|
333 | 333 | $ echo a > a |
|
334 | 334 | $ hg add a |
|
335 | 335 | $ hg commit -q -m 'a' |
|
336 | 336 | $ echo b >> a |
|
337 | 337 | $ hg commit -q -m 'ab' |
|
338 | 338 | $ hg bookmark ab |
|
339 | 339 | $ hg up -q '.^' |
|
340 | 340 | $ echo b >> a |
|
341 | 341 | $ echo c >> a |
|
342 | 342 | $ hg commit -q -m 'abc' |
|
343 | 343 | $ hg rebase -s 7bc217434fc1 -d ab --keep |
|
344 | 344 | rebasing 13:7bc217434fc1 tip "abc" |
|
345 | 345 | merging a |
|
346 | 346 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
347 | 347 | unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') |
|
348 | 348 | [240] |
|
349 | 349 | $ hg diff |
|
350 | 350 | diff -r 328e4ab1f7cc a |
|
351 | 351 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
352 | 352 | +++ b/a * (glob) |
|
353 | 353 | @@ -1,2 +1,6 @@ |
|
354 | 354 | a |
|
355 | 355 | b |
|
356 | 356 | +<<<<<<< dest: 328e4ab1f7cc ab - test: ab |
|
357 | 357 | +======= |
|
358 | 358 | +c |
|
359 | 359 | +>>>>>>> source: 7bc217434fc1 - test: abc |
|
360 | 360 | $ hg rebase --abort |
|
361 | 361 | rebase aborted |
|
362 | 362 | $ hg up -q -C 7bc217434fc1 |
|
363 | 363 | $ hg rebase -s . -d ab --keep -t internal:merge3 |
|
364 | 364 | rebasing 13:7bc217434fc1 tip "abc" |
|
365 | 365 | merging a |
|
366 | 366 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
367 | 367 | unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') |
|
368 | 368 | [240] |
|
369 | 369 | $ hg diff |
|
370 | 370 | diff -r 328e4ab1f7cc a |
|
371 | 371 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
372 | 372 | +++ b/a * (glob) |
|
373 | 373 | @@ -1,2 +1,8 @@ |
|
374 | 374 | a |
|
375 | 375 | +<<<<<<< dest: 328e4ab1f7cc ab - test: ab |
|
376 | 376 | b |
|
377 | 377 | +||||||| base |
|
378 | 378 | +======= |
|
379 | 379 | +b |
|
380 | 380 | +c |
|
381 | 381 | +>>>>>>> source: 7bc217434fc1 - test: abc |
|
382 | 382 | |
|
383 | 383 | Test rebase with obsstore turned on and off (issue5606) |
|
384 | 384 | |
|
385 | 385 | $ cd $TESTTMP |
|
386 | 386 | $ hg init b |
|
387 | 387 | $ cd b |
|
388 | 388 | $ hg debugdrawdag <<'EOS' |
|
389 | 389 | > D |
|
390 | 390 | > | |
|
391 | 391 | > C |
|
392 | 392 | > | |
|
393 | 393 | > B E |
|
394 | 394 | > |/ |
|
395 | 395 | > A |
|
396 | 396 | > EOS |
|
397 | 397 | |
|
398 | 398 | $ hg update E -q |
|
399 | 399 | $ echo 3 > B |
|
400 | 400 | $ hg commit --amend -m E -A B -q |
|
401 | 401 | $ hg rebase -r B+D -d . --config experimental.evolution=true |
|
402 | 402 | rebasing 1:112478962961 B "B" |
|
403 | 403 | merging B |
|
404 | 404 | warning: conflicts while merging B! (edit, then use 'hg resolve --mark') |
|
405 | 405 | unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') |
|
406 | 406 | [240] |
|
407 | 407 | |
|
408 | 408 | $ echo 4 > B |
|
409 | 409 | $ hg resolve -m |
|
410 | 410 | (no more unresolved files) |
|
411 | 411 | continue: hg rebase --continue |
|
412 | 412 | $ hg rebase --continue --config experimental.evolution=none |
|
413 | 413 | rebasing 1:112478962961 B "B" |
|
414 | 414 | rebasing 3:f585351a92f8 D "D" |
|
415 | 415 | warning: orphaned descendants detected, not stripping 112478962961 |
|
416 | 416 | saved backup bundle to $TESTTMP/b/.hg/strip-backup/f585351a92f8-e536a9e4-rebase.hg |
|
417 | 417 | |
|
418 | 418 | $ rm .hg/localtags |
|
419 | 419 | $ hg tglog |
|
420 | 420 | o 5:draft 'D' |
|
421 | 421 | | |
|
422 | 422 | o 4:draft 'B' |
|
423 | 423 | | |
|
424 | 424 | @ 3:draft 'E' |
|
425 | 425 | | |
|
426 | 426 | | o 2:draft 'C' |
|
427 | 427 | | | |
|
428 | 428 | | o 1:draft 'B' |
|
429 | 429 | |/ |
|
430 | 430 | o 0:draft 'A' |
|
431 | 431 | |
|
432 | 432 | |
|
433 | 433 | Test where the conflict happens when rebasing a merge commit |
|
434 | 434 | |
|
435 | 435 | $ cd $TESTTMP |
|
436 | 436 | $ hg init conflict-in-merge |
|
437 | 437 | $ cd conflict-in-merge |
|
438 | 438 | $ hg debugdrawdag <<'EOS' |
|
439 | 439 | > F # F/conflict = foo\n |
|
440 | 440 | > |\ |
|
441 | 441 | > D E |
|
442 | 442 | > |/ |
|
443 | 443 | > C B # B/conflict = bar\n |
|
444 | 444 | > |/ |
|
445 | 445 | > A |
|
446 | 446 | > EOS |
|
447 | 447 | |
|
448 | 448 | $ hg co F |
|
449 | 449 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
450 | 450 | $ hg rebase -d B |
|
451 | 451 | rebasing 2:dc0947a82db8 C "C" |
|
452 | 452 | rebasing 3:e7b3f00ed42e D "D" |
|
453 | 453 | rebasing 4:03ca77807e91 E "E" |
|
454 | 454 | rebasing 5:9a6b91dc2044 F tip "F" |
|
455 | 455 | merging conflict |
|
456 | 456 | warning: conflicts while merging conflict! (edit, then use 'hg resolve --mark') |
|
457 | 457 | unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') |
|
458 | 458 | [240] |
|
459 | 459 | $ hg tglog |
|
460 | 460 | @ 8:draft 'E' |
|
461 | 461 | | |
|
462 | 462 | | @ 7:draft 'D' |
|
463 | 463 | |/ |
|
464 | 464 | o 6:draft 'C' |
|
465 | 465 | | |
|
466 | 466 | | % 5:draft 'F' |
|
467 | 467 | | |\ |
|
468 | 468 | | | o 4:draft 'E' |
|
469 | 469 | | | | |
|
470 | 470 | | o | 3:draft 'D' |
|
471 | 471 | | |/ |
|
472 | 472 | | o 2:draft 'C' |
|
473 | 473 | | | |
|
474 | 474 | o | 1:draft 'B' |
|
475 | 475 | |/ |
|
476 | 476 | o 0:draft 'A' |
|
477 | 477 | |
|
478 | 478 | $ echo baz > conflict |
|
479 | 479 | $ hg resolve -m |
|
480 | 480 | (no more unresolved files) |
|
481 | 481 | continue: hg rebase --continue |
|
482 | 482 | $ hg rebase -c |
|
483 | 483 | already rebased 2:dc0947a82db8 C "C" as 0199610c343e |
|
484 | 484 | already rebased 3:e7b3f00ed42e D "D" as f0dd538aaa63 |
|
485 | 485 | already rebased 4:03ca77807e91 E "E" as cbf25af8347d |
|
486 | 486 | rebasing 5:9a6b91dc2044 F "F" |
|
487 | 487 | saved backup bundle to $TESTTMP/conflict-in-merge/.hg/strip-backup/dc0947a82db8-ca7e7d5b-rebase.hg |
|
488 | 488 | $ hg tglog |
|
489 | 489 | @ 5:draft 'F' |
|
490 | 490 | |\ |
|
491 | 491 | | o 4:draft 'E' |
|
492 | 492 | | | |
|
493 | 493 | o | 3:draft 'D' |
|
494 | 494 | |/ |
|
495 | 495 | o 2:draft 'C' |
|
496 | 496 | | |
|
497 | 497 | o 1:draft 'B' |
|
498 | 498 | | |
|
499 | 499 | o 0:draft 'A' |
|
500 | 500 |
@@ -1,706 +1,706 b'' | |||
|
1 | 1 | $ cat >> $HGRCPATH <<EOF |
|
2 | 2 | > [commands] |
|
3 | 3 | > status.verbose=1 |
|
4 | 4 | > EOF |
|
5 | 5 | |
|
6 | 6 | # Construct the following history tree: |
|
7 | 7 | # |
|
8 | 8 | # @ 5:e1bb631146ca b1 |
|
9 | 9 | # | |
|
10 | 10 | # o 4:a4fdb3b883c4 0:b608b9236435 b1 |
|
11 | 11 | # | |
|
12 | 12 | # | o 3:4b57d2520816 1:44592833ba9f |
|
13 | 13 | # | | |
|
14 | 14 | # | | o 2:063f31070f65 |
|
15 | 15 | # | |/ |
|
16 | 16 | # | o 1:44592833ba9f |
|
17 | 17 | # |/ |
|
18 | 18 | # o 0:b608b9236435 |
|
19 | 19 | |
|
20 | 20 | $ mkdir b1 |
|
21 | 21 | $ cd b1 |
|
22 | 22 | $ hg init |
|
23 | 23 | $ echo foo > foo |
|
24 | 24 | $ echo zero > a |
|
25 | 25 | $ hg init sub |
|
26 | 26 | $ echo suba > sub/suba |
|
27 | 27 | $ hg --cwd sub ci -Am addsuba |
|
28 | 28 | adding suba |
|
29 | 29 | $ echo 'sub = sub' > .hgsub |
|
30 | 30 | $ hg ci -qAm0 |
|
31 | 31 | $ echo one > a ; hg ci -m1 |
|
32 | 32 | $ echo two > a ; hg ci -m2 |
|
33 | 33 | $ hg up -q 1 |
|
34 | 34 | $ echo three > a ; hg ci -qm3 |
|
35 | 35 | $ hg up -q 0 |
|
36 | 36 | $ hg branch -q b1 |
|
37 | 37 | $ echo four > a ; hg ci -qm4 |
|
38 | 38 | $ echo five > a ; hg ci -qm5 |
|
39 | 39 | |
|
40 | 40 | Initial repo state: |
|
41 | 41 | |
|
42 | 42 | $ hg log -G --template '{rev}:{node|short} {parents} {branches}\n' |
|
43 | 43 | @ 5:ff252e8273df b1 |
|
44 | 44 | | |
|
45 | 45 | o 4:d047485b3896 0:60829823a42a b1 |
|
46 | 46 | | |
|
47 | 47 | | o 3:6efa171f091b 1:0786582aa4b1 |
|
48 | 48 | | | |
|
49 | 49 | | | o 2:bd10386d478c |
|
50 | 50 | | |/ |
|
51 | 51 | | o 1:0786582aa4b1 |
|
52 | 52 | |/ |
|
53 | 53 | o 0:60829823a42a |
|
54 | 54 | |
|
55 | 55 | |
|
56 | 56 | Make sure update doesn't assume b1 is a repository if invoked from outside: |
|
57 | 57 | |
|
58 | 58 | $ cd .. |
|
59 | 59 | $ hg update b1 |
|
60 | 60 | abort: no repository found in '$TESTTMP' (.hg not found) |
|
61 | 61 | [10] |
|
62 | 62 | $ cd b1 |
|
63 | 63 | |
|
64 | 64 | Test helper functions: |
|
65 | 65 | |
|
66 | 66 | $ revtest () { |
|
67 | 67 | > msg=$1 |
|
68 | 68 | > dirtyflag=$2 # 'clean', 'dirty' or 'dirtysub' |
|
69 | 69 | > startrev=$3 |
|
70 | 70 | > targetrev=$4 |
|
71 | 71 | > opt=$5 |
|
72 | 72 | > hg up -qC $startrev |
|
73 | 73 | > test $dirtyflag = dirty && echo dirty > foo |
|
74 | 74 | > test $dirtyflag = dirtysub && echo dirty > sub/suba |
|
75 | 75 | > hg up $opt $targetrev |
|
76 | 76 | > hg parent --template 'parent={rev}\n' |
|
77 | 77 | > hg stat -S |
|
78 | 78 | > } |
|
79 | 79 | |
|
80 | 80 | $ norevtest () { |
|
81 | 81 | > msg=$1 |
|
82 | 82 | > dirtyflag=$2 # 'clean', 'dirty' or 'dirtysub' |
|
83 | 83 | > startrev=$3 |
|
84 | 84 | > opt=$4 |
|
85 | 85 | > hg up -qC $startrev |
|
86 | 86 | > test $dirtyflag = dirty && echo dirty > foo |
|
87 | 87 | > test $dirtyflag = dirtysub && echo dirty > sub/suba |
|
88 | 88 | > hg up $opt |
|
89 | 89 | > hg parent --template 'parent={rev}\n' |
|
90 | 90 | > hg stat -S |
|
91 | 91 | > } |
|
92 | 92 | |
|
93 | 93 | Test cases are documented in a table in the update function of merge.py. |
|
94 | 94 | Cases are run as shown in that table, row by row. |
|
95 | 95 | |
|
96 | 96 | $ norevtest 'none clean linear' clean 4 |
|
97 | 97 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
98 | 98 | parent=5 |
|
99 | 99 | |
|
100 | 100 | $ norevtest 'none clean same' clean 2 |
|
101 | 101 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
102 | 102 | updated to "bd10386d478c: 2" |
|
103 | 103 | 1 other heads for branch "default" |
|
104 | 104 | parent=2 |
|
105 | 105 | |
|
106 | 106 | |
|
107 | 107 | $ revtest 'none clean linear' clean 1 2 |
|
108 | 108 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
109 | 109 | parent=2 |
|
110 | 110 | |
|
111 | 111 | $ revtest 'none clean same' clean 2 3 |
|
112 | 112 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
113 | 113 | parent=3 |
|
114 | 114 | |
|
115 | 115 | $ revtest 'none clean cross' clean 3 4 |
|
116 | 116 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
117 | 117 | parent=4 |
|
118 | 118 | |
|
119 | 119 | |
|
120 | 120 | $ revtest 'none dirty linear' dirty 1 2 |
|
121 | 121 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
122 | 122 | parent=2 |
|
123 | 123 | M foo |
|
124 | 124 | |
|
125 | 125 | $ revtest 'none dirtysub linear' dirtysub 1 2 |
|
126 | 126 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
127 | 127 | parent=2 |
|
128 | 128 | M sub/suba |
|
129 | 129 | |
|
130 | 130 | $ revtest 'none dirty same' dirty 2 3 |
|
131 | 131 | abort: uncommitted changes |
|
132 | 132 | (commit or update --clean to discard changes) |
|
133 | 133 | parent=2 |
|
134 | 134 | M foo |
|
135 | 135 | |
|
136 | 136 | $ revtest 'none dirtysub same' dirtysub 2 3 |
|
137 | 137 | abort: uncommitted changes |
|
138 | 138 | (commit or update --clean to discard changes) |
|
139 | 139 | parent=2 |
|
140 | 140 | M sub/suba |
|
141 | 141 | |
|
142 | 142 | $ revtest 'none dirty cross' dirty 3 4 |
|
143 | 143 | abort: uncommitted changes |
|
144 | 144 | (commit or update --clean to discard changes) |
|
145 | 145 | parent=3 |
|
146 | 146 | M foo |
|
147 | 147 | |
|
148 | 148 | $ norevtest 'none dirty cross' dirty 2 |
|
149 | 149 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
150 | 150 | updated to "bd10386d478c: 2" |
|
151 | 151 | 1 other heads for branch "default" |
|
152 | 152 | parent=2 |
|
153 | 153 | M foo |
|
154 | 154 | |
|
155 | 155 | $ revtest 'none dirtysub cross' dirtysub 3 4 |
|
156 | 156 | abort: uncommitted changes |
|
157 | 157 | (commit or update --clean to discard changes) |
|
158 | 158 | parent=3 |
|
159 | 159 | M sub/suba |
|
160 | 160 | |
|
161 | 161 | $ revtest '-C dirty linear' dirty 1 2 -C |
|
162 | 162 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
163 | 163 | parent=2 |
|
164 | 164 | |
|
165 | 165 | $ revtest '-c dirty linear' dirty 1 2 -c |
|
166 | 166 | abort: uncommitted changes |
|
167 | 167 | parent=1 |
|
168 | 168 | M foo |
|
169 | 169 | |
|
170 | 170 | $ revtest '-m dirty linear' dirty 1 2 -m |
|
171 | 171 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
172 | 172 | parent=2 |
|
173 | 173 | M foo |
|
174 | 174 | |
|
175 | 175 | $ revtest '-m dirty cross' dirty 3 4 -m |
|
176 | 176 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
177 | 177 | parent=4 |
|
178 | 178 | M foo |
|
179 | 179 | |
|
180 | 180 | $ revtest '-c dirtysub linear' dirtysub 1 2 -c |
|
181 | 181 | abort: uncommitted changes in subrepository "sub" |
|
182 | 182 | parent=1 |
|
183 | 183 | M sub/suba |
|
184 | 184 | |
|
185 | 185 | $ norevtest '-c clean same' clean 2 -c |
|
186 | 186 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
187 | 187 | updated to "bd10386d478c: 2" |
|
188 | 188 | 1 other heads for branch "default" |
|
189 | 189 | parent=2 |
|
190 | 190 | |
|
191 | 191 | $ revtest '-cC dirty linear' dirty 1 2 -cC |
|
192 | 192 | abort: cannot specify both --clean and --check |
|
193 | 193 | parent=1 |
|
194 | 194 | M foo |
|
195 | 195 | |
|
196 | 196 | $ revtest '-mc dirty linear' dirty 1 2 -mc |
|
197 | 197 | abort: cannot specify both --check and --merge |
|
198 | 198 | parent=1 |
|
199 | 199 | M foo |
|
200 | 200 | |
|
201 | 201 | $ revtest '-mC dirty linear' dirty 1 2 -mC |
|
202 | 202 | abort: cannot specify both --clean and --merge |
|
203 | 203 | parent=1 |
|
204 | 204 | M foo |
|
205 | 205 | |
|
206 | 206 | $ echo '[commands]' >> .hg/hgrc |
|
207 | 207 | $ echo 'update.check = abort' >> .hg/hgrc |
|
208 | 208 | |
|
209 | 209 | $ revtest 'none dirty linear' dirty 1 2 |
|
210 | 210 | abort: uncommitted changes |
|
211 | 211 | parent=1 |
|
212 | 212 | M foo |
|
213 | 213 | |
|
214 | 214 | $ revtest 'none dirty linear' dirty 1 2 -c |
|
215 | 215 | abort: uncommitted changes |
|
216 | 216 | parent=1 |
|
217 | 217 | M foo |
|
218 | 218 | |
|
219 | 219 | $ revtest 'none dirty linear' dirty 1 2 -C |
|
220 | 220 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
221 | 221 | parent=2 |
|
222 | 222 | |
|
223 | 223 | $ echo 'update.check = none' >> .hg/hgrc |
|
224 | 224 | |
|
225 | 225 | $ revtest 'none dirty cross' dirty 3 4 |
|
226 | 226 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
227 | 227 | parent=4 |
|
228 | 228 | M foo |
|
229 | 229 | |
|
230 | 230 | $ revtest 'none dirty linear' dirty 1 2 |
|
231 | 231 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
232 | 232 | parent=2 |
|
233 | 233 | M foo |
|
234 | 234 | |
|
235 | 235 | $ revtest 'none dirty linear' dirty 1 2 -c |
|
236 | 236 | abort: uncommitted changes |
|
237 | 237 | parent=1 |
|
238 | 238 | M foo |
|
239 | 239 | |
|
240 | 240 | $ revtest 'none dirty linear' dirty 1 2 -C |
|
241 | 241 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
242 | 242 | parent=2 |
|
243 | 243 | |
|
244 | 244 | $ hg co -qC 3 |
|
245 | 245 | $ echo dirty >> a |
|
246 | 246 | $ hg co --tool :merge3 4 |
|
247 | 247 | merging a |
|
248 | 248 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
249 | 249 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
250 | 250 | use 'hg resolve' to retry unresolved file merges |
|
251 | 251 | [1] |
|
252 | 252 | $ hg log -G --template '{rev}:{node|short} {parents} {branches}\n' |
|
253 | 253 | o 5:ff252e8273df b1 |
|
254 | 254 | | |
|
255 | 255 | @ 4:d047485b3896 0:60829823a42a b1 |
|
256 | 256 | | |
|
257 | 257 | | % 3:6efa171f091b 1:0786582aa4b1 |
|
258 | 258 | | | |
|
259 | 259 | | | o 2:bd10386d478c |
|
260 | 260 | | |/ |
|
261 | 261 | | o 1:0786582aa4b1 |
|
262 | 262 | |/ |
|
263 | 263 | o 0:60829823a42a |
|
264 | 264 | |
|
265 | 265 | $ hg st |
|
266 | 266 | M a |
|
267 | 267 | ? a.orig |
|
268 | 268 | # Unresolved merge conflicts: |
|
269 | 269 | # |
|
270 | 270 | # a |
|
271 | 271 | # |
|
272 | 272 | # To mark files as resolved: hg resolve --mark FILE |
|
273 | 273 | |
|
274 | 274 | $ cat a |
|
275 | 275 | <<<<<<< working copy: 6efa171f091b - test: 3 |
|
276 | 276 | three |
|
277 | 277 | dirty |
|
278 | 278 | ||||||| base |
|
279 | 279 | three |
|
280 | 280 | ======= |
|
281 | 281 | four |
|
282 | 282 | >>>>>>> destination: d047485b3896 b1 - test: 4 |
|
283 | 283 | $ rm a.orig |
|
284 | 284 | |
|
285 | 285 | $ echo 'update.check = noconflict' >> .hg/hgrc |
|
286 | 286 | |
|
287 | 287 | $ revtest 'none dirty cross' dirty 3 4 |
|
288 | 288 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
289 | 289 | parent=4 |
|
290 | 290 | M foo |
|
291 | 291 | |
|
292 | 292 | $ revtest 'none dirty linear' dirty 1 2 |
|
293 | 293 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
294 | 294 | parent=2 |
|
295 | 295 | M foo |
|
296 | 296 | |
|
297 | 297 | $ revtest 'none dirty linear' dirty 1 2 -c |
|
298 | 298 | abort: uncommitted changes |
|
299 | 299 | parent=1 |
|
300 | 300 | M foo |
|
301 | 301 | |
|
302 | 302 | $ revtest 'none dirty linear' dirty 1 2 -C |
|
303 | 303 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
304 | 304 | parent=2 |
|
305 | 305 | |
|
306 | 306 | Locally added file is allowed |
|
307 | 307 | $ hg up -qC 3 |
|
308 | 308 | $ echo a > bar |
|
309 | 309 | $ hg add bar |
|
310 | 310 | $ hg up -q 4 |
|
311 | 311 | $ hg st |
|
312 | 312 | A bar |
|
313 | 313 | $ hg forget bar |
|
314 | 314 | $ rm bar |
|
315 | 315 | |
|
316 | 316 | Locally removed file is allowed |
|
317 | 317 | $ hg up -qC 3 |
|
318 | 318 | $ hg rm foo |
|
319 | 319 | $ hg up -q 4 |
|
320 | 320 | |
|
321 | 321 | File conflict is not allowed |
|
322 | 322 | $ hg up -qC 3 |
|
323 | 323 | $ echo dirty >> a |
|
324 | 324 | $ hg up -q 4 |
|
325 | 325 | abort: conflicting changes |
|
326 | 326 | (commit or update --clean to discard changes) |
|
327 | 327 | [255] |
|
328 | 328 | $ hg up -m 4 |
|
329 | 329 | merging a |
|
330 | 330 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
331 | 331 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
332 | 332 | use 'hg resolve' to retry unresolved file merges |
|
333 | 333 | [1] |
|
334 | 334 | $ rm a.orig |
|
335 | 335 | $ hg status |
|
336 | 336 | M a |
|
337 | 337 | # Unresolved merge conflicts: |
|
338 | 338 | # |
|
339 | 339 | # a |
|
340 | 340 | # |
|
341 | 341 | # To mark files as resolved: hg resolve --mark FILE |
|
342 | 342 | |
|
343 | 343 | $ hg resolve -l |
|
344 | 344 | U a |
|
345 | 345 | |
|
346 | 346 | Try to make empty commit while there are conflicts |
|
347 | 347 | $ hg revert -r . a |
|
348 | 348 | $ rm a.orig |
|
349 | 349 | $ hg ci -m empty |
|
350 | 350 | abort: unresolved merge conflicts (see 'hg help resolve') |
|
351 |
[2 |
|
|
351 | [20] | |
|
352 | 352 | $ hg resolve -m a |
|
353 | 353 | (no more unresolved files) |
|
354 | 354 | $ hg resolve -l |
|
355 | 355 | R a |
|
356 | 356 | $ hg ci -m empty |
|
357 | 357 | nothing changed |
|
358 | 358 | [1] |
|
359 | 359 | $ hg resolve -l |
|
360 | 360 | |
|
361 | 361 | Change/delete conflict is not allowed |
|
362 | 362 | $ hg up -qC 3 |
|
363 | 363 | $ hg rm foo |
|
364 | 364 | $ hg up -q 4 |
|
365 | 365 | |
|
366 | 366 | Uses default value of "linear" when value is misspelled |
|
367 | 367 | $ echo 'update.check = linyar' >> .hg/hgrc |
|
368 | 368 | |
|
369 | 369 | $ revtest 'dirty cross' dirty 3 4 |
|
370 | 370 | abort: uncommitted changes |
|
371 | 371 | (commit or update --clean to discard changes) |
|
372 | 372 | parent=3 |
|
373 | 373 | M foo |
|
374 | 374 | |
|
375 | 375 | Setup for later tests |
|
376 | 376 | $ revtest 'none dirty linear' dirty 1 2 -c |
|
377 | 377 | abort: uncommitted changes |
|
378 | 378 | parent=1 |
|
379 | 379 | M foo |
|
380 | 380 | |
|
381 | 381 | $ cd .. |
|
382 | 382 | |
|
383 | 383 | Test updating to null revision |
|
384 | 384 | |
|
385 | 385 | $ hg init null-repo |
|
386 | 386 | $ cd null-repo |
|
387 | 387 | $ echo a > a |
|
388 | 388 | $ hg add a |
|
389 | 389 | $ hg ci -m a |
|
390 | 390 | $ hg up -qC 0 |
|
391 | 391 | $ echo b > b |
|
392 | 392 | $ hg add b |
|
393 | 393 | $ hg up null |
|
394 | 394 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
395 | 395 | $ hg st |
|
396 | 396 | A b |
|
397 | 397 | $ hg up -q 0 |
|
398 | 398 | $ hg st |
|
399 | 399 | A b |
|
400 | 400 | $ hg up -qC null |
|
401 | 401 | $ hg st |
|
402 | 402 | ? b |
|
403 | 403 | $ cd .. |
|
404 | 404 | |
|
405 | 405 | Test updating with closed head |
|
406 | 406 | --------------------------------------------------------------------- |
|
407 | 407 | |
|
408 | 408 | $ hg clone -U -q b1 closed-heads |
|
409 | 409 | $ cd closed-heads |
|
410 | 410 | |
|
411 | 411 | Test updating if at least one non-closed branch head exists |
|
412 | 412 | |
|
413 | 413 | if on the closed branch head: |
|
414 | 414 | - update to "." |
|
415 | 415 | - "updated to a closed branch head ...." message is displayed |
|
416 | 416 | - "N other heads for ...." message is displayed |
|
417 | 417 | |
|
418 | 418 | $ hg update -q -C 3 |
|
419 | 419 | $ hg commit --close-branch -m 6 |
|
420 | 420 | $ norevtest "on closed branch head" clean 6 |
|
421 | 421 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
422 | 422 | no open descendant heads on branch "default", updating to a closed head |
|
423 | 423 | (committing will reopen the head, use 'hg heads .' to see 1 other heads) |
|
424 | 424 | parent=6 |
|
425 | 425 | |
|
426 | 426 | if descendant non-closed branch head exists, and it is only one branch head: |
|
427 | 427 | - update to it, even if its revision is less than closed one |
|
428 | 428 | - "N other heads for ...." message isn't displayed |
|
429 | 429 | |
|
430 | 430 | $ norevtest "non-closed 2 should be chosen" clean 1 |
|
431 | 431 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
432 | 432 | parent=2 |
|
433 | 433 | |
|
434 | 434 | if all descendant branch heads are closed, but there is another branch head: |
|
435 | 435 | - update to the tipmost descendant head |
|
436 | 436 | - "updated to a closed branch head ...." message is displayed |
|
437 | 437 | - "N other heads for ...." message is displayed |
|
438 | 438 | |
|
439 | 439 | $ norevtest "all descendant branch heads are closed" clean 3 |
|
440 | 440 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
441 | 441 | no open descendant heads on branch "default", updating to a closed head |
|
442 | 442 | (committing will reopen the head, use 'hg heads .' to see 1 other heads) |
|
443 | 443 | parent=6 |
|
444 | 444 | |
|
445 | 445 | Test updating if all branch heads are closed |
|
446 | 446 | |
|
447 | 447 | if on the closed branch head: |
|
448 | 448 | - update to "." |
|
449 | 449 | - "updated to a closed branch head ...." message is displayed |
|
450 | 450 | - "all heads of branch ...." message is displayed |
|
451 | 451 | |
|
452 | 452 | $ hg update -q -C 2 |
|
453 | 453 | $ hg commit --close-branch -m 7 |
|
454 | 454 | $ norevtest "all heads of branch default are closed" clean 6 |
|
455 | 455 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
456 | 456 | no open descendant heads on branch "default", updating to a closed head |
|
457 | 457 | (committing will reopen branch "default") |
|
458 | 458 | parent=6 |
|
459 | 459 | |
|
460 | 460 | if not on the closed branch head: |
|
461 | 461 | - update to the tipmost descendant (closed) head |
|
462 | 462 | - "updated to a closed branch head ...." message is displayed |
|
463 | 463 | - "all heads of branch ...." message is displayed |
|
464 | 464 | |
|
465 | 465 | $ norevtest "all heads of branch default are closed" clean 1 |
|
466 | 466 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
467 | 467 | no open descendant heads on branch "default", updating to a closed head |
|
468 | 468 | (committing will reopen branch "default") |
|
469 | 469 | parent=7 |
|
470 | 470 | |
|
471 | 471 | $ cd .. |
|
472 | 472 | |
|
473 | 473 | Test updating if "default" branch doesn't exist and no revision is |
|
474 | 474 | checked out (= "default" is used as current branch) |
|
475 | 475 | |
|
476 | 476 | $ hg init no-default-branch |
|
477 | 477 | $ cd no-default-branch |
|
478 | 478 | |
|
479 | 479 | $ hg branch foobar |
|
480 | 480 | marked working directory as branch foobar |
|
481 | 481 | (branches are permanent and global, did you want a bookmark?) |
|
482 | 482 | $ echo a > a |
|
483 | 483 | $ hg commit -m "#0" -A |
|
484 | 484 | adding a |
|
485 | 485 | $ echo 1 >> a |
|
486 | 486 | $ hg commit -m "#1" |
|
487 | 487 | $ hg update -q 0 |
|
488 | 488 | $ echo 3 >> a |
|
489 | 489 | $ hg commit -m "#2" |
|
490 | 490 | created new head |
|
491 | 491 | $ hg commit --close-branch -m "#3" |
|
492 | 492 | |
|
493 | 493 | if there is at least one non-closed branch head: |
|
494 | 494 | - update to the tipmost branch head |
|
495 | 495 | |
|
496 | 496 | $ norevtest "non-closed 1 should be chosen" clean null |
|
497 | 497 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
498 | 498 | parent=1 |
|
499 | 499 | |
|
500 | 500 | if all branch heads are closed |
|
501 | 501 | - update to "tip" |
|
502 | 502 | - "updated to a closed branch head ...." message is displayed |
|
503 | 503 | - "all heads for branch "XXXX" are closed" message is displayed |
|
504 | 504 | |
|
505 | 505 | $ hg update -q -C 1 |
|
506 | 506 | $ hg commit --close-branch -m "#4" |
|
507 | 507 | |
|
508 | 508 | $ norevtest "all branches are closed" clean null |
|
509 | 509 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
510 | 510 | no open descendant heads on branch "foobar", updating to a closed head |
|
511 | 511 | (committing will reopen branch "foobar") |
|
512 | 512 | parent=4 |
|
513 | 513 | |
|
514 | 514 | $ cd ../b1 |
|
515 | 515 | |
|
516 | 516 | Test obsolescence behavior |
|
517 | 517 | --------------------------------------------------------------------- |
|
518 | 518 | |
|
519 | 519 | successors should be taken in account when checking head destination |
|
520 | 520 | |
|
521 | 521 | $ cat << EOF >> $HGRCPATH |
|
522 | 522 | > [ui] |
|
523 | 523 | > logtemplate={rev}:{node|short} {desc|firstline} |
|
524 | 524 | > [experimental] |
|
525 | 525 | > evolution.createmarkers=True |
|
526 | 526 | > EOF |
|
527 | 527 | |
|
528 | 528 | Test no-argument update to a successor of an obsoleted changeset |
|
529 | 529 | |
|
530 | 530 | $ hg log -G |
|
531 | 531 | o 5:ff252e8273df 5 |
|
532 | 532 | | |
|
533 | 533 | o 4:d047485b3896 4 |
|
534 | 534 | | |
|
535 | 535 | | o 3:6efa171f091b 3 |
|
536 | 536 | | | |
|
537 | 537 | | | o 2:bd10386d478c 2 |
|
538 | 538 | | |/ |
|
539 | 539 | | @ 1:0786582aa4b1 1 |
|
540 | 540 | |/ |
|
541 | 541 | o 0:60829823a42a 0 |
|
542 | 542 | |
|
543 | 543 | $ hg book bm -r 3 |
|
544 | 544 | $ hg status |
|
545 | 545 | M foo |
|
546 | 546 | |
|
547 | 547 | We add simple obsolescence marker between 3 and 4 (indirect successors) |
|
548 | 548 | |
|
549 | 549 | $ hg id --debug -i -r 3 |
|
550 | 550 | 6efa171f091b00a3c35edc15d48c52a498929953 |
|
551 | 551 | $ hg id --debug -i -r 4 |
|
552 | 552 | d047485b3896813b2a624e86201983520f003206 |
|
553 | 553 | $ hg debugobsolete 6efa171f091b00a3c35edc15d48c52a498929953 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
|
554 | 554 | 1 new obsolescence markers |
|
555 | 555 | obsoleted 1 changesets |
|
556 | 556 | $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa d047485b3896813b2a624e86201983520f003206 |
|
557 | 557 | 1 new obsolescence markers |
|
558 | 558 | |
|
559 | 559 | Test that 5 is detected as a valid destination from 3 and also accepts moving |
|
560 | 560 | the bookmark (issue4015) |
|
561 | 561 | |
|
562 | 562 | $ hg up --quiet --hidden 3 |
|
563 | 563 | $ hg up 5 |
|
564 | 564 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
565 | 565 | $ hg book bm |
|
566 | 566 | moving bookmark 'bm' forward from 6efa171f091b |
|
567 | 567 | $ hg bookmarks |
|
568 | 568 | * bm 5:ff252e8273df |
|
569 | 569 | |
|
570 | 570 | Test that we abort before we warn about the hidden commit if the working |
|
571 | 571 | directory is dirty |
|
572 | 572 | $ echo conflict > a |
|
573 | 573 | $ hg up --hidden 3 |
|
574 | 574 | abort: uncommitted changes |
|
575 | 575 | (commit or update --clean to discard changes) |
|
576 | 576 | [255] |
|
577 | 577 | |
|
578 | 578 | Test that we still warn also when there are conflicts |
|
579 | 579 | $ hg up -m --hidden 3 |
|
580 | 580 | merging a |
|
581 | 581 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
582 | 582 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
583 | 583 | use 'hg resolve' to retry unresolved file merges |
|
584 | 584 | (leaving bookmark bm) |
|
585 | 585 | updated to hidden changeset 6efa171f091b |
|
586 | 586 | (hidden revision '6efa171f091b' was rewritten as: d047485b3896) |
|
587 | 587 | [1] |
|
588 | 588 | |
|
589 | 589 | Test that statuses are reported properly before and after merge resolution. |
|
590 | 590 | $ rm a.orig |
|
591 | 591 | $ hg resolve -l |
|
592 | 592 | U a |
|
593 | 593 | $ hg status |
|
594 | 594 | M a |
|
595 | 595 | M foo |
|
596 | 596 | # Unresolved merge conflicts: |
|
597 | 597 | # |
|
598 | 598 | # a |
|
599 | 599 | # |
|
600 | 600 | # To mark files as resolved: hg resolve --mark FILE |
|
601 | 601 | |
|
602 | 602 | |
|
603 | 603 | $ hg revert -r . a |
|
604 | 604 | |
|
605 | 605 | $ rm a.orig |
|
606 | 606 | $ hg resolve -l |
|
607 | 607 | U a |
|
608 | 608 | $ hg status |
|
609 | 609 | M foo |
|
610 | 610 | # Unresolved merge conflicts: |
|
611 | 611 | # |
|
612 | 612 | # a |
|
613 | 613 | # |
|
614 | 614 | # To mark files as resolved: hg resolve --mark FILE |
|
615 | 615 | |
|
616 | 616 | $ hg status -Tjson |
|
617 | 617 | [ |
|
618 | 618 | { |
|
619 | 619 | "itemtype": "file", |
|
620 | 620 | "path": "foo", |
|
621 | 621 | "status": "M" |
|
622 | 622 | }, |
|
623 | 623 | { |
|
624 | 624 | "itemtype": "file", |
|
625 | 625 | "path": "a", |
|
626 | 626 | "unresolved": true |
|
627 | 627 | } |
|
628 | 628 | ] |
|
629 | 629 | |
|
630 | 630 | $ hg resolve -m |
|
631 | 631 | (no more unresolved files) |
|
632 | 632 | |
|
633 | 633 | $ hg resolve -l |
|
634 | 634 | R a |
|
635 | 635 | $ hg status |
|
636 | 636 | M foo |
|
637 | 637 | # No unresolved merge conflicts. |
|
638 | 638 | |
|
639 | 639 | $ hg status -Tjson |
|
640 | 640 | [ |
|
641 | 641 | { |
|
642 | 642 | "itemtype": "file", |
|
643 | 643 | "path": "foo", |
|
644 | 644 | "status": "M" |
|
645 | 645 | } |
|
646 | 646 | ] |
|
647 | 647 | |
|
648 | 648 | Test that 4 is detected as the no-argument destination from 3 and also moves |
|
649 | 649 | the bookmark with it |
|
650 | 650 | $ hg up --quiet 0 # we should be able to update to 3 directly |
|
651 | 651 | $ hg status |
|
652 | 652 | M foo |
|
653 | 653 | $ hg up --quiet --hidden 3 # but not implemented yet. |
|
654 | 654 | updated to hidden changeset 6efa171f091b |
|
655 | 655 | (hidden revision '6efa171f091b' was rewritten as: d047485b3896) |
|
656 | 656 | $ hg book -f bm |
|
657 | 657 | $ hg up |
|
658 | 658 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
659 | 659 | updating bookmark bm |
|
660 | 660 | $ hg book |
|
661 | 661 | * bm 4:d047485b3896 |
|
662 | 662 | |
|
663 | 663 | Test that 5 is detected as a valid destination from 1 |
|
664 | 664 | $ hg up --quiet 0 # we should be able to update to 3 directly |
|
665 | 665 | $ hg up --quiet --hidden 3 # but not implemented yet. |
|
666 | 666 | updated to hidden changeset 6efa171f091b |
|
667 | 667 | (hidden revision '6efa171f091b' was rewritten as: d047485b3896) |
|
668 | 668 | $ hg up 5 |
|
669 | 669 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
670 | 670 | |
|
671 | 671 | Test that 5 is not detected as a valid destination from 2 |
|
672 | 672 | $ hg up --quiet 0 |
|
673 | 673 | $ hg up --quiet 2 |
|
674 | 674 | $ hg up 5 |
|
675 | 675 | abort: uncommitted changes |
|
676 | 676 | (commit or update --clean to discard changes) |
|
677 | 677 | [255] |
|
678 | 678 | |
|
679 | 679 | Test that we don't crash when updating from a pruned changeset (i.e. has no |
|
680 | 680 | successors). Behavior should probably be that we update to the first |
|
681 | 681 | non-obsolete parent but that will be decided later. |
|
682 | 682 | $ hg id --debug -r 2 |
|
683 | 683 | bd10386d478cd5a9faf2e604114c8e6da62d3889 |
|
684 | 684 | $ hg up --quiet 0 |
|
685 | 685 | $ hg up --quiet 2 |
|
686 | 686 | $ hg debugobsolete bd10386d478cd5a9faf2e604114c8e6da62d3889 |
|
687 | 687 | 1 new obsolescence markers |
|
688 | 688 | obsoleted 1 changesets |
|
689 | 689 | $ hg up |
|
690 | 690 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
691 | 691 | |
|
692 | 692 | Test experimental revset support |
|
693 | 693 | |
|
694 | 694 | $ hg log -r '_destupdate()' |
|
695 | 695 | 2:bd10386d478c 2 (no-eol) |
|
696 | 696 | |
|
697 | 697 | Test that boolean flags allow --no-flag specification to override [defaults] |
|
698 | 698 | $ cat >> $HGRCPATH <<EOF |
|
699 | 699 | > [defaults] |
|
700 | 700 | > update = --check |
|
701 | 701 | > EOF |
|
702 | 702 | $ hg co 2 |
|
703 | 703 | abort: uncommitted changes |
|
704 | 704 | [20] |
|
705 | 705 | $ hg co --no-check 2 |
|
706 | 706 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
General Comments 0
You need to be logged in to leave comments.
Login now