comparison tests/test-evolve-content-divergent-case-A2.t @ 5390:3216855846dd

evolve: add test coverage for content-div case A2
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Tue, 09 Jun 2020 12:00:26 +0530
parents
children
comparison
equal deleted inserted replaced
5389:8c3656505d4d 5390:3216855846dd
1 ===============================================
2 Testing content-divergence resolution: Case A.2
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 belongs to a series of tests checking the resolution of content-divergent
10 changesets.
11
12 Category A: no parents are obsolete
13 Testcase 2: no conflict: both sides amended content changes (non-conflicting changes in same file)
14
15 A.2 both sides amended content changes
16 ======================================
17
18 .. (Divergence reason):
19 .. local: amended some content changes in same file as "other" but non-conflicting
20 .. other: amended some content changes in same file as "local" but non-conflicting
21 .. Where we show that since both side amended some content changes without any relocation,
22 .. the most reasonable behaviour is to simply perform 3-way merge.
23 ..
24 .. (local):
25 ..
26 .. A ø⇠○ A'
27 .. |/
28 .. ● O
29 ..
30 .. (other):
31 ..
32 .. A ø⇠○ A''
33 .. |/
34 .. ● O
35 ..
36 .. (Resolution):
37 ..
38 .. ○ A'''
39 .. |
40 .. ● O
41 ..
42
43 Setup
44 -----
45 $ . $TESTDIR/testlib/content-divergence-util.sh
46 $ setuprepos A.2
47 creating test repo for test case A.2
48 - upstream
49 - local
50 - other
51 cd into `local` and proceed with env setup
52
53 initial
54
55 $ cd local
56 $ mkcommit A0
57 $ hg push -q
58 $ sed -i '1ifoo' A0
59 $ hg amend -m "A1"
60 $ hg log -G --hidden
61 @ 2:e1f7c24563ba (draft): A1
62 |
63 | x 1:28b51eb45704 (draft): A0
64 |/
65 o 0:a9bdc8b26820 (public): O
66
67 $ cd ../other
68 $ hg pull -uq
69 $ echo bar >> A0
70 $ hg amend
71 $ hg push -q
72
73 $ cd ../local
74 $ hg pull -q
75 2 new content-divergent changesets
76
77 Actual test of resolution
78 -------------------------
79 $ hg evolve -l
80 e1f7c24563ba: A1
81 content-divergent: 5fbe90f37421 (draft) (precursor 28b51eb45704)
82
83 5fbe90f37421: A0
84 content-divergent: e1f7c24563ba (draft) (precursor 28b51eb45704)
85
86 $ hg log -G --hidden
87 * 3:5fbe90f37421 (draft): A0 [content-divergent]
88 |
89 | @ 2:e1f7c24563ba (draft): A1 [content-divergent]
90 |/
91 | x 1:28b51eb45704 (draft): A0
92 |/
93 o 0:a9bdc8b26820 (public): O
94
95
96 $ hg evolve --content-divergent
97 merge:[2] A1
98 with: [3] A0
99 base: [1] A0
100 merging A0
101 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
102 working directory is now at 414367a5568a
103
104 $ hg log -Gp
105 @ 4:414367a5568a (draft): A1
106 | diff -r a9bdc8b26820 -r 414367a5568a A0
107 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000
108 | +++ b/A0 Thu Jan 01 00:00:00 1970 +0000
109 | @@ -0,0 +1,3 @@
110 | +foo
111 | +A0
112 | +bar
113 |
114 o 0:a9bdc8b26820 (public): O
115 diff -r 000000000000 -r a9bdc8b26820 O
116 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
117 +++ b/O Thu Jan 01 00:00:00 1970 +0000
118 @@ -0,0 +1,1 @@
119 +O
120
121 $ hg evolve -l