Mercurial > hg
annotate tests/test-merge-revert2.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 | ef1eb6df7071 |
children | ce3a133f71b3 |
rev | line source |
---|---|
12279 | 1 $ hg init |
2 | |
3 $ echo "added file1" > file1 | |
4 $ echo "another line of text" >> file1 | |
5 $ echo "added file2" > file2 | |
6 $ hg add file1 file2 | |
7 $ hg commit -m "added file1 and file2" | |
8 | |
9 $ echo "changed file1" >> file1 | |
10 $ hg commit -m "changed file1" | |
11 | |
12 $ hg -q log | |
13 1:dfab7f3c2efb | |
14 0:c3fa057dd86f | |
15 $ hg id | |
16 dfab7f3c2efb tip | |
17 | |
18 $ hg update -C 0 | |
19 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
20 $ hg id | |
21 c3fa057dd86f | |
22 | |
23 $ echo "changed file1" >> file1 | |
24 $ hg id | |
25 c3fa057dd86f+ | |
26 | |
27 $ hg revert --no-backup --all | |
28 reverting file1 | |
29 $ hg diff | |
30 $ hg status | |
31 $ hg id | |
32 c3fa057dd86f | |
33 | |
34 $ hg update | |
35 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
36 $ hg diff | |
37 $ hg status | |
38 $ hg id | |
39 dfab7f3c2efb tip | |
40 | |
41 $ hg update -C 0 | |
42 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
43 $ echo "changed file1 different" >> file1 | |
792
49ec802b4a16
Added tests for bug with three-way-merging of old tip, tip and cwd.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
44 |
12279 | 45 $ hg update |
46 merging file1 | |
26614
ef1eb6df7071
simplemerge: move conflict warning message to filemerge
Siddharth Agarwal <sid0@fb.com>
parents:
21693
diff
changeset
|
47 warning: conflicts while merging file1! (edit, then use 'hg resolve --mark') |
12279 | 48 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
49 use 'hg resolve' to retry unresolved file merges | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
50 [1] |
12279 | 51 |
52 $ hg diff --nodates | |
53 diff -r dfab7f3c2efb file1 | |
54 --- a/file1 | |
55 +++ b/file1 | |
56 @@ -1,3 +1,7 @@ | |
57 added file1 | |
58 another line of text | |
21693
9c35f3a8cac4
merge: drop the quotes around commit description
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21537
diff
changeset
|
59 +<<<<<<< working copy: c3fa057dd86f - test: added file1 and file2 |
12279 | 60 +changed file1 different |
61 +======= | |
62 changed file1 | |
21693
9c35f3a8cac4
merge: drop the quotes around commit description
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21537
diff
changeset
|
63 +>>>>>>> destination: dfab7f3c2efb - test: changed file1 |
792
49ec802b4a16
Added tests for bug with three-way-merging of old tip, tip and cwd.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
64 |
12279 | 65 $ hg status |
66 M file1 | |
67 ? file1.orig | |
68 $ hg id | |
69 dfab7f3c2efb+ tip | |
70 | |
71 $ hg revert --no-backup --all | |
72 reverting file1 | |
73 $ hg diff | |
74 $ hg status | |
75 ? file1.orig | |
76 $ hg id | |
77 dfab7f3c2efb tip | |
78 | |
79 $ hg revert -r tip --no-backup --all | |
80 $ hg diff | |
81 $ hg status | |
82 ? file1.orig | |
83 $ hg id | |
84 dfab7f3c2efb tip | |
85 | |
86 $ hg update -C | |
87 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
88 $ hg diff | |
89 $ hg status | |
90 ? file1.orig | |
91 $ hg id | |
92 dfab7f3c2efb tip | |
93 |