comparison tests/test-evolve-orphan-corner-cases.t @ 4587:90cc85a82be7

test: move a test to an appropriate test file This patch introduce a new test file test-evolve-orphan-corner-cases.t for tests which covers corner cases.
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Sun, 21 Apr 2019 13:04:40 +0530
parents tests/test-evolve.t@1b91a518d10c
children b62ed7c69561
comparison
equal deleted inserted replaced
4586:1b91a518d10c 4587:90cc85a82be7
1 =======================================================
2 Tests the resolution of orphan changesets: corner cases
3 =======================================================
4
5 Setup
6 =====
7 $ cat >> $HGRCPATH <<EOF
8 > [alias]
9 > glog = log -GT "{rev}:{node|short} {desc|firstline}\n {phase} {troubles}\n\n"
10 > [phases]
11 > publish = False
12 > [extensions]
13 > rebase =
14 > EOF
15 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
16
17 $ glog() {
18 > hg log -G --template '{rev}:{node|short}@{branch}({phase}) {desc|firstline}\n' "$@"
19 > }
20
21 Test to make sure that `lastsolved` always has correct value and things don't break:
22 ------------------------------------------------------------------------------------
23 (before we were not updating it in case of orphan merge)
24
25 Prepare the repo:
26 $ hg init orphanmergerepo
27 $ cd orphanmergerepo
28 $ for fn in a b c; do echo foo > $fn; hg ci -Am "added "$fn; done;
29 adding a
30 adding b
31 adding c
32 Let's create a merge commit so that we can create orphan merge later:
33 $ hg up 1 -q
34 $ echo feature > f
35 $ hg ci -Am "added feature f"
36 adding f
37 created new head
38 $ hg merge
39 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
40 (branch merge, don't forget to commit)
41 $ hg ci -m "merge feature branch"
42 $ glog
43 @ 4:2c0a98d38026@default(draft) merge feature branch
44 |\
45 | o 3:4c33e511041e@default(draft) added feature f
46 | |
47 o | 2:8be98ac1a569@default(draft) added c
48 |/
49 o 1:80e6d2c47cfe@default(draft) added b
50 |
51 o 0:f7ad41964313@default(draft) added a
52
53
54 Now make the parents of merge commit obsolete to get a orphan merge:
55 $ hg up 2 -q
56 $ echo "fixit" > c
57 $ hg ci --amend -m "updated c"
58 1 new orphan changesets
59 $ hg up 3 -q
60 $ echo "fixit" > c
61 $ hg ci --amend -m "updated f"
62 $ glog
63 @ 6:086d9bedcd75@default(draft) updated f
64 |
65 | o 5:f84f2c548fbc@default(draft) updated c
66 |/
67 | * 4:2c0a98d38026@default(draft) merge feature branch
68 | |\
69 +---x 3:4c33e511041e@default(draft) added feature f
70 | |
71 | x 2:8be98ac1a569@default(draft) added c
72 |/
73 o 1:80e6d2c47cfe@default(draft) added b
74 |
75 o 0:f7ad41964313@default(draft) added a
76
77
78 To check `lastsolved` contain right value after completion of orphan-merge
79 resolution there should be one more instability to be evolved; lets create one:
80 $ hg up 1 -q
81 $ echo d > d
82 $ hg ci -Am "added d"
83 adding c
84 adding d
85 created new head
86 $ echo e > e
87 $ hg ci -Am "added e"
88 adding e
89 $ hg up .^
90 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
91 $ echo "updated d" >> d
92 $ hg ci --amend -m "updated d"
93 1 new orphan changesets
94 $ glog
95 @ 9:7c4d1834c346@default(draft) updated d
96 |
97 | * 8:421f7614462a@default(draft) added e
98 | |
99 | x 7:afe5acea1990@default(draft) added d
100 |/
101 | o 6:086d9bedcd75@default(draft) updated f
102 |/
103 | o 5:f84f2c548fbc@default(draft) updated c
104 |/
105 | * 4:2c0a98d38026@default(draft) merge feature branch
106 | |\
107 +---x 3:4c33e511041e@default(draft) added feature f
108 | |
109 | x 2:8be98ac1a569@default(draft) added c
110 |/
111 o 1:80e6d2c47cfe@default(draft) added b
112 |
113 o 0:f7ad41964313@default(draft) added a
114
115 Now we have one orphan merge and one more orphan cset that we just created.
116 Lets evolve:
117 $ hg evolve --all --any
118 move:[4] merge feature branch
119 atop:[5] updated c
120 move:[10] merge feature branch
121 atop:[6] updated f
122 move:[8] added e
123 atop:[9] updated d