Mercurial > evolve
annotate tests/test-topic-fold.t @ 3846:f9dad99a90d5
evolve: create a new commit instead of amending one of the divergents
This patch changes the behavior of evolve command while resolving
content-divergence to create a new commit instead of amending one of the
divergent ones.
In past, I have made this change, backed out this change and now today again I
am doing this change, so let's dive in some history.
Using cmdrewrite.amend() was never a good option as that requires hack to delete
the evolvestate and also gives us less control over things. We can't make the
commit on top of different parents as that of content-divergent ones. Due to all
these, I first made this change to create a new commit instead of amending one.
But, after few days, there was flakiness observed in the tests and turned out
that we need to do some dirstate dance as repo.dirstate.setparents() does not
always fix the dirstate. That flakiness was a blocker for progress at that time
and we decided to switch to amend back so that we can have things working with
some hacks and we can later fix the implementation part.
Now, yesterday while tackling resolving content-divergence of a stack which is
as follows:
C1 C2
| |
B1 B2
| |
A1 A2
\/
base
where, A1-A2, B1-B2, C1-C2 are content-divergent with each other. Now we can
resolve A1-A2 very well because they have the same parent and let's say that
resolution leads to A3.
Now, we want to resolve B1-B2 and make the new resolution commit on top of A3 so
that we can end up something like:
C3
|
B3
|
A3
|
base
however, amending one of the divergent changesets, it's not possible to create a
commit on a different parent like A3 here without some relocation. We should
prevent relocation as that may leads to some conflicts and should change the
parent before committing.
So, looking ahead, we can't move with using amend as still using that we will
need some relocation hacks making code ugly and prone to bad behaviors, bugs.
Let's change back to creating a new commit so that we can move forward in a good
way.
About repo.dirstate.setparents() not setting the dirstate, I have researched
yesterday night about how we can do that and found out that we can use
cmdrewrite._uncommitdirstate() here. Expect upcoming patches to improve the
documentation of that function.
There are lot of test changes because of change in hash but there is no behavior
change. The only behavior change is in test-evolve-abort-contentdiv.t which is
nice because creating a new commit helps us in stripping that while aborting.
We have a lot of testing of content-divergence and no behavior change gives
enough confidence for making this change.
I reviewed the patch carefully to make sure there is no behavior change and I
suggest reviewer to do the same.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 13 Jun 2018 17:15:10 +0530 |
parents | 1bc4b0807c37 |
children | fb4801478d5d |
rev | line source |
---|---|
2666
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
1 test of the fold command |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
2 ------------------------ |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
3 |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
4 $ cat >> $HGRCPATH <<EOF |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
5 > [defaults] |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
6 > amend=-d "0 0" |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
7 > fold=-d "0 0" |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
8 > split=-d "0 0" |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
9 > amend=-d "0 0" |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
10 > [web] |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
11 > push_ssl = false |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
12 > allow_push = * |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
13 > [phases] |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
14 > publish = False |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
15 > [diff] |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
16 > git = 1 |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
17 > unified = 0 |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
18 > [ui] |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
19 > interactive = true |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
20 > [extensions] |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
21 > EOF |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
22 $ echo "topic=$(echo $(dirname $TESTDIR))/hgext3rd/topic/" >> $HGRCPATH |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
23 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
24 $ mkcommit() { |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
25 > echo "$1" > "$1" |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
26 > hg add "$1" |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
27 > hg ci -m "add $1" $2 $3 |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
28 > } |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
29 $ logtopic() { |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
30 > hg log -G -T "{rev}:{node}\ntopics: {topics}" |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
31 > } |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
32 |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
33 Check that fold keep the topic if all revisions have the topic |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
34 -------------------------------------------------------------- |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
35 |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
36 $ hg init testfold |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
37 $ cd testfold |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
38 $ mkcommit ROOT |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
39 $ hg topic myfeature |
2985
f63c97c01f92
topics/ui: signal when the topics command creates a new (empty) topic
Aurélien Campéas
parents:
2984
diff
changeset
|
40 marked working directory as topic: myfeature |
2666
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
41 $ mkcommit feature1 |
2988
62201935e1a7
topics/ui: detect and signal when an empty changeset becomes non-empty
Aurélien Campéas
parents:
2986
diff
changeset
|
42 active topic 'myfeature' grew its first changeset |
3769
1bc4b0807c37
topic: display a hint pointing at help when a topic becomes non-empty
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
3397
diff
changeset
|
43 (see 'hg help topics' for more information) |
2666
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
44 $ mkcommit feature2 |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
45 $ logtopic |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
46 @ 2:d76a6166b18c835be9a487c5e21c7d260f0a1676 |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
47 | topics: myfeature |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
48 o 1:39e7a938055e87615edf675c24a10997ff05bb06 |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
49 | topics: myfeature |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
50 o 0:3e7df3b3b17c6deb4a1c70e790782fdf17af96a7 |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
51 topics: |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
52 $ hg fold --exact -r "(tip~1)::" -m "folded" |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
53 2 changesets folded |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
54 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
55 $ hg stack |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
56 ### topic: myfeature |
2997
a61634f52742
topic: try to clarify the "branch" part in stack
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2988
diff
changeset
|
57 ### target: default (branch) |
2666
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
58 t1@ folded (current) |
2712
f19b314d8475
topics: add t0 and b0 to the stack
Pulkit Goyal <7895pulkit@gmail.com>
parents:
2666
diff
changeset
|
59 t0^ add ROOT (base) |
2666
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
60 $ logtopic |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
61 @ 3:4fd43e5bdc443dc8489edffac19bd8f93ccf1a5c |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
62 | topics: myfeature |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
63 o 0:3e7df3b3b17c6deb4a1c70e790782fdf17af96a7 |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
64 topics: |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
65 $ hg summary |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
66 parent: 3:4fd43e5bdc44 tip |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
67 folded |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
68 branch: default |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
69 commit: (clean) |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
70 update: (current) |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
71 phases: 2 draft |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
72 topic: myfeature |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
73 |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
74 Check that fold dismis the topic if not all revisions have the topic |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
75 -------------------------------------------------------------------- |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
76 |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
77 (I'm not sure this behavior make senses, but now it is tested) |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
78 |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
79 $ hg topic --clear |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
80 $ mkcommit feature3 |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
81 created new head |
3397
f7129e3d5a38
topic: suggest using topic when user creates a new head on branch
Pulkit Goyal <7895pulkit@gmail.com>
parents:
2997
diff
changeset
|
82 (consider using topic for lightweight branches. See 'hg help topic') |
2666
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
83 $ hg topic myotherfeature |
2985
f63c97c01f92
topics/ui: signal when the topics command creates a new (empty) topic
Aurélien Campéas
parents:
2984
diff
changeset
|
84 marked working directory as topic: myotherfeature |
2666
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
85 $ mkcommit feature4 |
2988
62201935e1a7
topics/ui: detect and signal when an empty changeset becomes non-empty
Aurélien Campéas
parents:
2986
diff
changeset
|
86 active topic 'myotherfeature' grew its first changeset |
3769
1bc4b0807c37
topic: display a hint pointing at help when a topic becomes non-empty
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
3397
diff
changeset
|
87 (see 'hg help topics' for more information) |
2666
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
88 $ logtopic |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
89 @ 5:5ded4d6d578c37f339b0716de2e46e12ece7cbde |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
90 | topics: myotherfeature |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
91 o 4:bdf6950b9b5b7c6b377c8132667c73ec86d5734f |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
92 | topics: |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
93 o 3:4fd43e5bdc443dc8489edffac19bd8f93ccf1a5c |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
94 | topics: myfeature |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
95 o 0:3e7df3b3b17c6deb4a1c70e790782fdf17af96a7 |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
96 topics: |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
97 $ hg fold --exact -r "(tip~1)::" -m "folded 2" |
2986
4746b92cc1f8
topics/ui: signal when an operation entails voiding a topic
Aurélien Campéas
parents:
2985
diff
changeset
|
98 active topic 'myotherfeature' is now empty |
2666
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
99 2 changesets folded |
2984
30f6030dca8f
topics: signal to the end user when a topic has been forgotten
Aurélien Campéas
parents:
2776
diff
changeset
|
100 clearing empty topic "myotherfeature" |
2666
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
101 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
102 $ logtopic |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
103 @ 6:03da8f7238e9a4d708d6b8af402c91c68f271477 |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
104 | topics: |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
105 o 3:4fd43e5bdc443dc8489edffac19bd8f93ccf1a5c |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
106 | topics: myfeature |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
107 o 0:3e7df3b3b17c6deb4a1c70e790782fdf17af96a7 |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
108 topics: |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
109 $ hg summary |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
110 parent: 6:03da8f7238e9 tip |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
111 folded 2 |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
112 branch: default |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
113 commit: (clean) |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
114 update: (current) |
2d828f448081
topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
115 phases: 3 draft |