annotate tests/test-evolve-wdir.t @ 5777:c5dfbbe4363d

evolve: when relocating, optionally first try to do it using in-memory merge This patch adds a config option to let run evolve's relocation step using in-memory merge. It is disabled by default. When the option is on, the relocation is first attempted in memory. If that fails because of merge conflicts, it retries that commit in the working copy. There are a few reasons that I made it configurable. The most important one is that the precommit hook won't trigger when using in-memory merge. Another reason is that it lets us roll out the feature slowly to our users at Google. For now, we also update the working copy after creating the commit (in the successful case, when there are no merge conflicts). The next patch will make it so we don't do that update. Because of the unnecessary working-copy update, this patch doesn't provide any benefit on its own. Evolving 29 commits that each change one line in the hg slows down from ~4.5s to ~4.8s when the config option is on. I've added `#testcases inmemory ondisk` to select `.t` files. Almost all differences are because of the new "hit merge conflicts" message and retrying the merge. There's also one difference in `test-stabilize-order.t` caused by the different order of working copy updates (we now update the working copy at the end).
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 15 Oct 2020 15:40:36 -0700
parents 272094174185
children c2484b0217ee 46858e6f8b99 e6ae5af97683 df8df57a3ce3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5439
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
1 ===============================================
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
2 Testing evolution of obsolete working directory
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
3 ===============================================
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
4
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
5 Pulling changes from other repos can make your working directory parent (wdir)
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
6 obsolete, most probably because now it has a new successor. But there are
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
7 other cases as well where it might be pruned with no successors or split
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
8 in multiple changesets etc.
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
9
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
10 This test file deals with all the possible cases for the evolution from an
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
11 obsolete working directory parent.
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
12
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
13 .. Case A: obsolete wdp with single successor
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
14 .. Resolution : simply update to the successor
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
15 ..
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
16 .. Case B: obsolete wdp with no successor (simply pruned)
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
17 .. Resolution : update to a not-dead ancestor
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
18 ..
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
19 .. Case C: obsolete wdp with multiple successor (divergence rewriting)
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
20 .. Resolution : #TODO: not handled yet
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
21 ..
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
22 .. Case D: obsolete wdp with multiple successor (split rewriting)
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
23 .. Resolution : #TODO: not handled yet
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
24
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
25 A. Obsolete wdp with single successor
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
26 -------------------------------------
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
27
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
28 Setup
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
29 $ . $TESTDIR/testlib/common.sh
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
30 $ cat >> $HGRCPATH <<EOF
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
31 > [extensions]
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
32 > evolve=
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
33 > rebase=
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
34 > [alias]
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
35 > glog = log --graph --template "{rev}:{node|short} ({phase}): {desc|firstline} {if(troubles, '[{troubles}]')}\n"
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
36 > EOF
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
37
5777
c5dfbbe4363d evolve: when relocating, optionally first try to do it using in-memory merge
Martin von Zweigbergk <martinvonz@google.com>
parents: 5439
diff changeset
38 #testcases inmemory ondisk
c5dfbbe4363d evolve: when relocating, optionally first try to do it using in-memory merge
Martin von Zweigbergk <martinvonz@google.com>
parents: 5439
diff changeset
39 #if inmemory
c5dfbbe4363d evolve: when relocating, optionally first try to do it using in-memory merge
Martin von Zweigbergk <martinvonz@google.com>
parents: 5439
diff changeset
40 $ cat >> $HGRCPATH <<EOF
c5dfbbe4363d evolve: when relocating, optionally first try to do it using in-memory merge
Martin von Zweigbergk <martinvonz@google.com>
parents: 5439
diff changeset
41 > [experimental]
c5dfbbe4363d evolve: when relocating, optionally first try to do it using in-memory merge
Martin von Zweigbergk <martinvonz@google.com>
parents: 5439
diff changeset
42 > evolution.in-memory = yes
c5dfbbe4363d evolve: when relocating, optionally first try to do it using in-memory merge
Martin von Zweigbergk <martinvonz@google.com>
parents: 5439
diff changeset
43 > EOF
c5dfbbe4363d evolve: when relocating, optionally first try to do it using in-memory merge
Martin von Zweigbergk <martinvonz@google.com>
parents: 5439
diff changeset
44 #endif
c5dfbbe4363d evolve: when relocating, optionally first try to do it using in-memory merge
Martin von Zweigbergk <martinvonz@google.com>
parents: 5439
diff changeset
45
5439
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
46 $ hg init repo
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
47 $ cd repo
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
48 $ mkcommit c_A
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
49 $ mkcommit c_B
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
50 $ hg amend -m "u_B"
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
51 $ hg up -r 'desc(c_B)' --hidden
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
52 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
53 updated to hidden changeset 707ee88b2870
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
54 (hidden revision '707ee88b2870' was rewritten as: 9bf151312dec)
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
55 working directory parent is obsolete! (707ee88b2870)
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
56 (use 'hg evolve' to update to its successor: 9bf151312dec)
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
57
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
58 $ hg evolve
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
59 update:[2] u_B
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
60 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
61 working directory is now at 9bf151312dec
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
62 $ hg glog
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
63 @ 2:9bf151312dec (draft): u_B
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
64 |
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
65 o 0:9f0188af4c58 (draft): c_A
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
66
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
67
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
68 B. Obsolete wdp with no successor
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
69 ---------------------------------
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
70
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
71 $ hg prune .
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
72 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
73 working directory is now at 9f0188af4c58
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
74 1 changesets pruned
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
75 $ hg up -r 'desc(c_B)' --hidden
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
76 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
77 updated to hidden changeset 707ee88b2870
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
78 (hidden revision '707ee88b2870' is pruned)
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
79 working directory parent is obsolete! (707ee88b2870)
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
80 (use 'hg evolve' to update to its parent successor)
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
81
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
82 $ hg evolve
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
83 update:[0] c_A
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
84 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
85 working directory is now at 9f0188af4c58
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
86 $ hg glog
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
87 @ 0:9f0188af4c58 (draft): c_A
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
88
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
89
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
90 C. Obsolete wdp with multiple successor (divergence rewriting)
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
91 ---------------------------------------------------------------
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
92
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
93 $ hg metaedit -r 'desc(u_B)' -d '0 1' --hidden
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
94 $ hg metaedit -r 'desc(c_B)' -d '0 1' --hidden
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
95 2 new content-divergent changesets
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
96 $ hg up -r 'min(desc(c_B))' --hidden
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
97 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
98 updated to hidden changeset 707ee88b2870
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
99 (hidden revision '707ee88b2870' has diverged)
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
100 working directory parent is obsolete! (707ee88b2870)
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
101 (707ee88b2870 has diverged, use 'hg evolve --list --content-divergent' to resolve the issue)
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
102
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
103 $ hg evolve
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
104 parent is obsolete with multiple successors:
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
105 [3] u_B
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
106 [4] c_B
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
107 [2]
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
108
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
109 $ hg glog
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
110 * 4:39e54eb7aa3c (draft): c_B [content-divergent]
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
111 |
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
112 | * 3:90624b574289 (draft): u_B [content-divergent]
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
113 |/
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
114 | @ 1:707ee88b2870 (draft): c_B
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
115 |/
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
116 o 0:9f0188af4c58 (draft): c_A
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
117
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
118
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
119 D. Obsolete wdp with multiple successor (split rewriting)
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
120 ----------------------------------------------------------
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
121
272094174185 test-obsolete: move a divergence related test from the main test
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
122 #TODO: yet to write tests for this case