comparison tests/test-evolve-content-divergent-user-independent-resolution.t @ 5926:aca07ac01167

divergence-resolution: use last evolution date to choose p1 when merging Before this patch, we choose the minimum revision as p1 while merging the two divergent csets which had a drawback that if independent user resolve the same divergence, their final resolved cset would have different hashes (because of 'divergence_source_local' and 'divergence_source_other' extras). Now, we decide the p1 on the basis of which of the two divergent cset was rewritten more recently. This new logic removes the "different hash" problem. To save us from big output changes in the tests due to this change, I also added the second factor i.e revision_number while sorting the csets wrt dates (as date is same for all the csets in tests) to fallback to the old way of picking the revision i.e choosing the minimum rev number. And to demonstrate that now divergence resolution is independent of which side user run the `hg evolve --content-div` resolved cset id won't change, I have added a separate test file. Flag --config devel.default-date='...' is being used here to record a custom date in the obsmarkers.
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Wed, 03 Mar 2021 12:40:59 +0530
parents
children 5e14782908e4
comparison
equal deleted inserted replaced
5925:e5250f24eed7 5926:aca07ac01167
1 =====================================
2 Testing content-divergence resolution
3 =====================================
4
5 Independent rewrites of same changeset can lead to content-divergence. In most
6 common cases, it can occur when multiple users rewrite the same changeset
7 independently and push it.
8
9 This test aims to check that the resolution of content-divergent changesets is
10 independent of the user resolving the divergence. In other words, the two users
11 resolving the same divergence should end up with the same result.
12
13 Setup
14 -----
15 $ . $TESTDIR/testlib/content-divergence-util.sh
16 $ setuprepos user-independent-resolution
17 creating test repo for test case user-independent-resolution
18 - upstream
19 - local
20 - other
21 cd into `local` and proceed with env setup
22
23 initial
24
25 $ cd upstream
26 $ mkcommit A0
27
28 $ cd ../local
29 $ hg pull -uq
30 $ hg amend -m "A1" --config devel.default-date='172800 19800'
31
32 $ cd ../other
33 $ hg pull -uq
34 $ hg amend -d '2 0' --config devel.default-date='86400 7200'
35 $ hg push -q
36
37 $ cd ../local
38 $ hg push -q
39 2 new content-divergent changesets
40 $ hg pull -q
41 2 new content-divergent changesets
42
43 'local' amended desc, 'other' amended date
44 ------------------------------------------
45 $ hg log -G
46 * 3:1a0af03d20ad (draft): A0 [content-divergent]
47 |
48 | @ 2:0d8c87cec5fc (draft): A1 [content-divergent]
49 |/
50 o 0:a9bdc8b26820 (public): O
51
52 $ hg evolve --content-div
53 merge:[2] A1
54 with: [3] A0
55 base: [1] A0
56 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
57 working directory is now at 276e2aee8fe1
58 $ hg log -G
59 @ 4:276e2aee8fe1 (draft): A1
60 |
61 o 0:a9bdc8b26820 (public): O
62
63 $ hg evolve -l
64
65 'local' amended date, 'other' amended desc
66 ------------------------------------------
67 $ cd ../other
68 $ hg pull -q
69 2 new content-divergent changesets
70 $ hg log -G
71 * 3:0d8c87cec5fc (draft): A1 [content-divergent]
72 |
73 | @ 2:1a0af03d20ad (draft): A0 [content-divergent]
74 |/
75 o 0:a9bdc8b26820 (public): O
76
77 $ hg evolve --content-div
78 merge:[3] A1
79 with: [2] A0
80 base: [1] A0
81 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
82 working directory is now at 276e2aee8fe1
83
84 $ hg log -G
85 @ 4:276e2aee8fe1 (draft): A1
86 |
87 o 0:a9bdc8b26820 (public): O
88
89 $ hg evolve -l
90
91 both users can push/pull without any issue
92 ------------------------------------------
93
94 $ hg push
95 pushing to $TESTTMP/user-independent-resolution/upstream
96 searching for changes
97 adding changesets
98 adding manifests
99 adding file changes
100 added 1 changesets with 0 changes to 1 files (+1 heads)
101 2 new obsolescence markers
102 obsoleted 2 changesets
103 $ hg pull ../local
104 pulling from ../local
105 searching for changes
106 no changes found
107 $ hg debugobsolete -r tip
108 0d8c87cec5fc1540b7c0324332375d530856fb56 276e2aee8fe1d3aae5e21dfee47be818fba8d7fc 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '32', 'operation': 'evolve', 'user': 'test'}
109 1a0af03d20ad8b4e3a99d30620c8734efe076900 276e2aee8fe1d3aae5e21dfee47be818fba8d7fc 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'evolve', 'user': 'test'}
110 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 0d8c87cec5fc1540b7c0324332375d530856fb56 0 (Fri Jan 02 18:30:00 1970 -0530) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
111 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 1a0af03d20ad8b4e3a99d30620c8734efe076900 0 (Thu Jan 01 22:00:00 1970 -0200) {'ef1': '32', 'operation': 'amend', 'user': 'test'}
112
113 $ cd ../local
114 $ hg push
115 pushing to $TESTTMP/user-independent-resolution/upstream
116 searching for changes
117 no changes found
118 [1]
119 $ hg pull ../other
120 pulling from ../other
121 searching for changes
122 no changes found
123 $ hg debugobsolete -r tip
124 0d8c87cec5fc1540b7c0324332375d530856fb56 276e2aee8fe1d3aae5e21dfee47be818fba8d7fc 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '32', 'operation': 'evolve', 'user': 'test'}
125 1a0af03d20ad8b4e3a99d30620c8734efe076900 276e2aee8fe1d3aae5e21dfee47be818fba8d7fc 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'evolve', 'user': 'test'}
126 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 0d8c87cec5fc1540b7c0324332375d530856fb56 0 (Fri Jan 02 18:30:00 1970 -0530) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
127 28b51eb45704506b5c603decd6bf7ac5e0f6a52f 1a0af03d20ad8b4e3a99d30620c8734efe076900 0 (Thu Jan 01 22:00:00 1970 -0200) {'ef1': '32', 'operation': 'amend', 'user': 'test'}