Show More
@@ -0,0 +1,77 b'' | |||
|
1 | #!/bin/sh | |
|
2 | # check that renames are correctly saved by a commit after a merge | |
|
3 | ||
|
4 | HGMERGE=merge | |
|
5 | export HGMERGE | |
|
6 | ||
|
7 | # test with the merge on 3 having the rename on the local parent | |
|
8 | hg init a | |
|
9 | cd a | |
|
10 | ||
|
11 | echo line1 > foo | |
|
12 | hg add foo | |
|
13 | hg ci -m '0: add foo' -d '0 0' | |
|
14 | ||
|
15 | echo line2 >> foo | |
|
16 | hg ci -m '1: change foo' -d '0 0' | |
|
17 | ||
|
18 | hg up -C 0 | |
|
19 | hg mv foo bar | |
|
20 | rm bar | |
|
21 | echo line0 > bar | |
|
22 | echo line1 >> bar | |
|
23 | hg ci -m '2: mv foo bar; change bar' -d '0 0' | |
|
24 | ||
|
25 | hg merge 1 | |
|
26 | echo '% contents of bar should be line0 line1 line2' | |
|
27 | cat bar | |
|
28 | hg ci -m '3: merge with local rename' -d '0 0' | |
|
29 | hg debugindex .hg/store/data/bar.i | |
|
30 | hg debugrename bar | |
|
31 | hg debugindex .hg/store/data/foo.i | |
|
32 | ||
|
33 | # revert the content change from rev 2 | |
|
34 | hg up -C 2 | |
|
35 | rm bar | |
|
36 | echo line1 > bar | |
|
37 | hg ci -m '4: revert content change from rev 2' -d '0 0' | |
|
38 | ||
|
39 | hg log --template '#rev#:#node|short# #parents#\n' | |
|
40 | echo '% this should use bar@rev2 as the ancestor' | |
|
41 | hg --debug merge 3 | |
|
42 | echo '% contents of bar should be line1 line2' | |
|
43 | cat bar | |
|
44 | hg ci -m '5: merge' -d '0 0' | |
|
45 | hg debugindex .hg/store/data/bar.i | |
|
46 | ||
|
47 | ||
|
48 | # same thing, but with the merge on 3 having the rename on the remote parent | |
|
49 | echo | |
|
50 | echo | |
|
51 | cd .. | |
|
52 | hg clone -U -r 1 -r 2 a b | |
|
53 | cd b | |
|
54 | ||
|
55 | hg up -C 1 | |
|
56 | hg merge 2 | |
|
57 | echo '% contents of bar should be line0 line1 line2' | |
|
58 | cat bar | |
|
59 | hg ci -m '3: merge with remote rename' -d '0 0' | |
|
60 | hg debugindex .hg/store/data/bar.i | |
|
61 | hg debugrename bar | |
|
62 | hg debugindex .hg/store/data/foo.i | |
|
63 | ||
|
64 | # revert the content change from rev 2 | |
|
65 | hg up -C 2 | |
|
66 | rm bar | |
|
67 | echo line1 > bar | |
|
68 | hg ci -m '4: revert content change from rev 2' -d '0 0' | |
|
69 | ||
|
70 | hg log --template '#rev#:#node|short# #parents#\n' | |
|
71 | echo '% this should use bar@rev2 as the ancestor' | |
|
72 | hg --debug merge 3 | |
|
73 | echo '% contents of bar should be line1 line2' | |
|
74 | cat bar | |
|
75 | hg ci -m '5: merge' -d '0 0' | |
|
76 | hg debugindex .hg/store/data/bar.i | |
|
77 |
@@ -0,0 +1,83 b'' | |||
|
1 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
2 | merging bar and foo | |
|
3 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
|
4 | (branch merge, don't forget to commit) | |
|
5 | % contents of bar should be line0 line1 line2 | |
|
6 | line0 | |
|
7 | line1 | |
|
8 | line2 | |
|
9 | rev offset length base linkrev nodeid p1 p2 | |
|
10 | 0 0 77 0 2 da78c0659611 000000000000 000000000000 | |
|
11 | 1 77 76 0 3 4b358025380b 000000000000 da78c0659611 | |
|
12 | bar renamed from foo:9e25c27b87571a1edee5ae4dddee5687746cc8e2 | |
|
13 | rev offset length base linkrev nodeid p1 p2 | |
|
14 | 0 0 7 0 0 690b295714ae 000000000000 000000000000 | |
|
15 | 1 7 13 1 1 9e25c27b8757 690b295714ae 000000000000 | |
|
16 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
17 | 4:2d2f9a22c82b 2:0a3ab4856510 | |
|
18 | 3:7d3b554bfdf1 2:0a3ab4856510 1:5cd961e4045d | |
|
19 | 2:0a3ab4856510 0:2665aaee66e9 | |
|
20 | 1:5cd961e4045d | |
|
21 | 0:2665aaee66e9 | |
|
22 | % this should use bar@rev2 as the ancestor | |
|
23 | resolving manifests | |
|
24 | overwrite None partial False | |
|
25 | ancestor 0a3ab4856510 local 2d2f9a22c82b+ remote 7d3b554bfdf1 | |
|
26 | bar: versions differ -> m | |
|
27 | merging bar | |
|
28 | my bar@2d2f9a22c82b+ other bar@7d3b554bfdf1 ancestor bar@0a3ab4856510 | |
|
29 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
|
30 | (branch merge, don't forget to commit) | |
|
31 | % contents of bar should be line1 line2 | |
|
32 | line1 | |
|
33 | line2 | |
|
34 | rev offset length base linkrev nodeid p1 p2 | |
|
35 | 0 0 77 0 2 da78c0659611 000000000000 000000000000 | |
|
36 | 1 77 76 0 3 4b358025380b 000000000000 da78c0659611 | |
|
37 | 2 153 7 2 4 4defe5eec418 da78c0659611 000000000000 | |
|
38 | 3 160 13 3 5 4663501da27b 4defe5eec418 4b358025380b | |
|
39 | ||
|
40 | ||
|
41 | requesting all changes | |
|
42 | adding changesets | |
|
43 | adding manifests | |
|
44 | adding file changes | |
|
45 | added 3 changesets with 3 changes to 2 files (+1 heads) | |
|
46 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
47 | merging foo and bar | |
|
48 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
|
49 | (branch merge, don't forget to commit) | |
|
50 | % contents of bar should be line0 line1 line2 | |
|
51 | line0 | |
|
52 | line1 | |
|
53 | line2 | |
|
54 | rev offset length base linkrev nodeid p1 p2 | |
|
55 | 0 0 77 0 2 da78c0659611 000000000000 000000000000 | |
|
56 | 1 77 76 0 3 4b358025380b 000000000000 da78c0659611 | |
|
57 | bar renamed from foo:9e25c27b87571a1edee5ae4dddee5687746cc8e2 | |
|
58 | rev offset length base linkrev nodeid p1 p2 | |
|
59 | 0 0 7 0 0 690b295714ae 000000000000 000000000000 | |
|
60 | 1 7 13 1 1 9e25c27b8757 690b295714ae 000000000000 | |
|
61 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
62 | 4:2d2f9a22c82b 2:0a3ab4856510 | |
|
63 | 3:96ab80c60897 1:5cd961e4045d 2:0a3ab4856510 | |
|
64 | 2:0a3ab4856510 0:2665aaee66e9 | |
|
65 | 1:5cd961e4045d | |
|
66 | 0:2665aaee66e9 | |
|
67 | % this should use bar@rev2 as the ancestor | |
|
68 | resolving manifests | |
|
69 | overwrite None partial False | |
|
70 | ancestor 0a3ab4856510 local 2d2f9a22c82b+ remote 96ab80c60897 | |
|
71 | bar: versions differ -> m | |
|
72 | merging bar | |
|
73 | my bar@2d2f9a22c82b+ other bar@96ab80c60897 ancestor bar@0a3ab4856510 | |
|
74 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
|
75 | (branch merge, don't forget to commit) | |
|
76 | % contents of bar should be line1 line2 | |
|
77 | line1 | |
|
78 | line2 | |
|
79 | rev offset length base linkrev nodeid p1 p2 | |
|
80 | 0 0 77 0 2 da78c0659611 000000000000 000000000000 | |
|
81 | 1 77 76 0 3 4b358025380b 000000000000 da78c0659611 | |
|
82 | 2 153 7 2 4 4defe5eec418 da78c0659611 000000000000 | |
|
83 | 3 160 13 3 5 4663501da27b 4defe5eec418 4b358025380b |
@@ -607,6 +607,24 b' class localrepository(repo.repository):' | |||
|
607 | 607 | meta = {} |
|
608 | 608 | cp = self.dirstate.copied(fn) |
|
609 | 609 | if cp: |
|
610 | # Mark the new revision of this file as a copy of another | |
|
611 | # file. This copy data will effectively act as a parent | |
|
612 | # of this new revision. If this is a merge, the first | |
|
613 | # parent will be the nullid (meaning "look up the copy data") | |
|
614 | # and the second one will be the other parent. For example: | |
|
615 | # | |
|
616 | # 0 --- 1 --- 3 rev1 changes file foo | |
|
617 | # \ / rev2 renames foo to bar and changes it | |
|
618 | # \- 2 -/ rev3 should have bar with all changes and | |
|
619 | # should record that bar descends from | |
|
620 | # bar in rev2 and foo in rev1 | |
|
621 | # | |
|
622 | # this allows this merge to succeed: | |
|
623 | # | |
|
624 | # 0 --- 1 --- 3 rev4 reverts the content change from rev2 | |
|
625 | # \ / merging rev3 and rev4 should use bar@rev2 | |
|
626 | # \- 2 --- 4 as the merge base | |
|
627 | # | |
|
610 | 628 | meta["copy"] = cp |
|
611 | 629 | if not manifest2: # not a branch merge |
|
612 | 630 | meta["copyrev"] = hex(manifest1.get(cp, nullid)) |
@@ -615,7 +633,7 b' class localrepository(repo.repository):' | |||
|
615 | 633 | meta["copyrev"] = hex(manifest1.get(cp, nullid)) |
|
616 | 634 | elif fp1 != nullid: # copied on local side, reversed |
|
617 | 635 | meta["copyrev"] = hex(manifest2.get(cp)) |
|
618 |
fp2 = |
|
|
636 | fp2 = fp1 | |
|
619 | 637 | else: # directory rename |
|
620 | 638 | meta["copyrev"] = hex(manifest1.get(cp, nullid)) |
|
621 | 639 | self.ui.debug(_(" %s: copy %s:%s\n") % |
General Comments 0
You need to be logged in to leave comments.
Login now