comparison tests/test-evolve-wdir.t @ 5439:272094174185 stable

test-obsolete: move a divergence related test from the main test Adding a new test file for test cases of evolution from an obsolete working directory parent. So this patch moves one divergence related case from test-obsolete.t to newly added test-evolve-obsolete.t and add few new cases as well. The new cases are probably there in other files, but not at the same place and I think having these cases in a single file make more sense. We can remove those duplicated tests from others file, let's see. In new test file there is one TODO (split case) which is yet to be written. I plan to add that after this, if that's not a blocker. Co-authored By: Pierre-Yves David <pierre-yves.david@octobus.net>
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Wed, 22 Jul 2020 14:23:58 +0200
parents
children 053f1fc12545 c5dfbbe4363d
comparison
equal deleted inserted replaced
5438:2aba2e371162 5439:272094174185
1 ===============================================
2 Testing evolution of obsolete working directory
3 ===============================================
4
5 Pulling changes from other repos can make your working directory parent (wdir)
6 obsolete, most probably because now it has a new successor. But there are
7 other cases as well where it might be pruned with no successors or split
8 in multiple changesets etc.
9
10 This test file deals with all the possible cases for the evolution from an
11 obsolete working directory parent.
12
13 .. Case A: obsolete wdp with single successor
14 .. Resolution : simply update to the successor
15 ..
16 .. Case B: obsolete wdp with no successor (simply pruned)
17 .. Resolution : update to a not-dead ancestor
18 ..
19 .. Case C: obsolete wdp with multiple successor (divergence rewriting)
20 .. Resolution : #TODO: not handled yet
21 ..
22 .. Case D: obsolete wdp with multiple successor (split rewriting)
23 .. Resolution : #TODO: not handled yet
24
25 A. Obsolete wdp with single successor
26 -------------------------------------
27
28 Setup
29 $ . $TESTDIR/testlib/common.sh
30 $ cat >> $HGRCPATH <<EOF
31 > [extensions]
32 > evolve=
33 > rebase=
34 > [alias]
35 > glog = log --graph --template "{rev}:{node|short} ({phase}): {desc|firstline} {if(troubles, '[{troubles}]')}\n"
36 > EOF
37
38 $ hg init repo
39 $ cd repo
40 $ mkcommit c_A
41 $ mkcommit c_B
42 $ hg amend -m "u_B"
43 $ hg up -r 'desc(c_B)' --hidden
44 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
45 updated to hidden changeset 707ee88b2870
46 (hidden revision '707ee88b2870' was rewritten as: 9bf151312dec)
47 working directory parent is obsolete! (707ee88b2870)
48 (use 'hg evolve' to update to its successor: 9bf151312dec)
49
50 $ hg evolve
51 update:[2] u_B
52 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
53 working directory is now at 9bf151312dec
54 $ hg glog
55 @ 2:9bf151312dec (draft): u_B
56 |
57 o 0:9f0188af4c58 (draft): c_A
58
59
60 B. Obsolete wdp with no successor
61 ---------------------------------
62
63 $ hg prune .
64 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
65 working directory is now at 9f0188af4c58
66 1 changesets pruned
67 $ hg up -r 'desc(c_B)' --hidden
68 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
69 updated to hidden changeset 707ee88b2870
70 (hidden revision '707ee88b2870' is pruned)
71 working directory parent is obsolete! (707ee88b2870)
72 (use 'hg evolve' to update to its parent successor)
73
74 $ hg evolve
75 update:[0] c_A
76 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
77 working directory is now at 9f0188af4c58
78 $ hg glog
79 @ 0:9f0188af4c58 (draft): c_A
80
81
82 C. Obsolete wdp with multiple successor (divergence rewriting)
83 ---------------------------------------------------------------
84
85 $ hg metaedit -r 'desc(u_B)' -d '0 1' --hidden
86 $ hg metaedit -r 'desc(c_B)' -d '0 1' --hidden
87 2 new content-divergent changesets
88 $ hg up -r 'min(desc(c_B))' --hidden
89 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 updated to hidden changeset 707ee88b2870
91 (hidden revision '707ee88b2870' has diverged)
92 working directory parent is obsolete! (707ee88b2870)
93 (707ee88b2870 has diverged, use 'hg evolve --list --content-divergent' to resolve the issue)
94
95 $ hg evolve
96 parent is obsolete with multiple successors:
97 [3] u_B
98 [4] c_B
99 [2]
100
101 $ hg glog
102 * 4:39e54eb7aa3c (draft): c_B [content-divergent]
103 |
104 | * 3:90624b574289 (draft): u_B [content-divergent]
105 |/
106 | @ 1:707ee88b2870 (draft): c_B
107 |/
108 o 0:9f0188af4c58 (draft): c_A
109
110
111 D. Obsolete wdp with multiple successor (split rewriting)
112 ----------------------------------------------------------
113
114 #TODO: yet to write tests for this case