Mercurial > hg
annotate tests/test-rename-after-merge.t @ 29196:bf7b8157c483 stable
strip: invalidate phase cache after stripping changeset (issue5235)
When we remove a changeset from the changelog, the phase cache must be
invalidated, otherwise it could refer to changesets that are no longer in the
repo.
To reproduce the failure, I created an extension querying the phase cache after
the strip transaction is over.
To do that, I stripped two commits with a bookmark on one of them to force
another transaction (we open a transaction for moving bookmarks)
after the strip transaction.
Without the fix in this patch, the test leads to a stacktrace showing the issue:
repair.strip(ui, repo, revs, backup)
File "/Users/lcharignon/facebook-hg-rpms/hg-crew/mercurial/repair.py", line 205, in strip
tr.close()
File "/Users/lcharignon/facebook-hg-rpms/hg-crew/mercurial/transaction.py", line 44, in _active
return func(self, *args, **kwds)
File "/Users/lcharignon/facebook-hg-rpms/hg-crew/mercurial/transaction.py", line 490, in close
self._postclosecallback[cat](self)
File "$TESTTMP/crashstrip2.py", line 4, in test
[repo.changelog.node(r) for r in repo.revs("not public()")]
File "/Users/lcharignon/facebook-hg-rpms/hg-crew/mercurial/changelog.py", line 337, in node
return super(changelog, self).node(rev)
File "/Users/lcharignon/facebook-hg-rpms/hg-crew/mercurial/revlog.py", line 377, in node
return self.index[rev][7]
IndexError: revlog index out of range
The situation was encountered in inhibit (evolve's repo) where we would crash
following the volatile set invalidation submitted by Augie in
e6f490e328635312ee214a12bc7fd3c7d46bf9ce. Before his patch the issue was masked
as we were not accessing the phasecache after stripping a revision.
This bug uncovered another but in histedit (see explanation in issue5235).
I changed the histedit test accordingly to avoid fixing two things at once.
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Thu, 12 May 2016 06:13:59 -0700 |
parents | f2719b387380 |
children | eb586ed5d8ce |
rev | line source |
---|---|
12399
4fee1fd3de9a
tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents:
12328
diff
changeset
|
1 Issue746: renaming files brought by the second parent of a merge was |
4fee1fd3de9a
tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents:
12328
diff
changeset
|
2 broken. |
5318
c6682cdada2f
Test renaming files brought by merge second parent (issue 746)
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
3 |
12279 | 4 Create source repository: |
5 | |
6 $ hg init t | |
7 $ cd t | |
8 $ echo a > a | |
9 $ hg ci -Am a | |
10 adding a | |
11 $ cd .. | |
12 | |
13 Fork source repository: | |
5318
c6682cdada2f
Test renaming files brought by merge second parent (issue 746)
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
14 |
12279 | 15 $ hg clone t t2 |
16 updating to branch default | |
17 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
18 $ cd t2 | |
19 $ echo b > b | |
20 $ hg ci -Am b | |
21 adding b | |
22 | |
23 Update source repository: | |
24 | |
25 $ cd ../t | |
26 $ echo a >> a | |
27 $ hg ci -m a2 | |
28 | |
29 Merge repositories: | |
5318
c6682cdada2f
Test renaming files brought by merge second parent (issue 746)
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
30 |
12279 | 31 $ hg pull ../t2 |
32 pulling from ../t2 | |
33 searching for changes | |
34 adding changesets | |
35 adding manifests | |
36 adding file changes | |
37 added 1 changesets with 1 changes to 1 files (+1 heads) | |
38 (run 'hg heads' to see heads, 'hg merge' to merge) | |
39 | |
40 $ hg merge | |
41 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
42 (branch merge, don't forget to commit) | |
5318
c6682cdada2f
Test renaming files brought by merge second parent (issue 746)
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
43 |
12279 | 44 $ hg st |
45 M b | |
46 | |
47 Rename b as c: | |
5318
c6682cdada2f
Test renaming files brought by merge second parent (issue 746)
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
48 |
12279 | 49 $ hg mv b c |
50 $ hg st | |
51 A c | |
52 R b | |
53 | |
54 Rename back c as b: | |
55 | |
56 $ hg mv c b | |
57 $ hg st | |
58 M b | |
59 | |
60 $ cd .. | |
7689
d821ea464465
Fix a corner case when committing a rename after a merge (issue1476)
Patrick Mezard <pmezard@gmail.com>
parents:
5608
diff
changeset
|
61 |
12399
4fee1fd3de9a
tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents:
12328
diff
changeset
|
62 Issue 1476: renaming a first parent file into another first parent |
4fee1fd3de9a
tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents:
12328
diff
changeset
|
63 file while none of them belong to the second parent was broken |
12279 | 64 |
65 $ hg init repo1476 | |
66 $ cd repo1476 | |
67 $ echo a > a | |
68 $ hg ci -Am adda | |
69 adding a | |
70 $ echo b1 > b1 | |
71 $ echo b2 > b2 | |
72 $ hg ci -Am changea | |
73 adding b1 | |
74 adding b2 | |
75 $ hg up -C 0 | |
76 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
77 $ echo c1 > c1 | |
78 $ echo c2 > c2 | |
79 $ hg ci -Am addcandd | |
80 adding c1 | |
81 adding c2 | |
82 created new head | |
83 | |
84 Merge heads: | |
85 | |
86 $ hg merge | |
87 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
88 (branch merge, don't forget to commit) | |
89 | |
90 $ hg mv -Af c1 c2 | |
7689
d821ea464465
Fix a corner case when committing a rename after a merge (issue1476)
Patrick Mezard <pmezard@gmail.com>
parents:
5608
diff
changeset
|
91 |
12279 | 92 Commit issue 1476: |
7689
d821ea464465
Fix a corner case when committing a rename after a merge (issue1476)
Patrick Mezard <pmezard@gmail.com>
parents:
5608
diff
changeset
|
93 |
12279 | 94 $ hg ci -m merge |
7689
d821ea464465
Fix a corner case when committing a rename after a merge (issue1476)
Patrick Mezard <pmezard@gmail.com>
parents:
5608
diff
changeset
|
95 |
12279 | 96 $ hg log -r tip -C -v | grep copies |
97 copies: c2 (c1) | |
98 | |
99 $ hg rollback | |
13446
1e497df514e2
rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents:
12399
diff
changeset
|
100 repository tip rolled back to revision 2 (undo commit) |
13455
053c042118bc
rollback, i18n: avoid parameterized message
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
13446
diff
changeset
|
101 working directory now based on revisions 2 and 1 |
12279 | 102 |
103 $ hg up -C . | |
104 2 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
105 | |
106 Merge heads again: | |
107 | |
108 $ hg merge | |
109 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
110 (branch merge, don't forget to commit) | |
111 | |
112 $ hg mv -Af b1 b2 | |
113 | |
114 Commit issue 1476 with a rename on the other side: | |
115 | |
116 $ hg ci -m merge | |
117 | |
118 $ hg log -r tip -C -v | grep copies | |
119 copies: b2 (b1) | |
120 | |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
13455
diff
changeset
|
121 $ cd .. |