Mercurial > hg
annotate tests/test-push-validation.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 | 2a03a365f645 |
children |
rev | line source |
---|---|
12279 | 1 $ hg init test |
2 $ cd test | |
3 | |
4 $ cat > .hg/hgrc <<EOF | |
5 > [server] | |
6 > validate=1 | |
7 > EOF | |
8 | |
9 $ echo alpha > alpha | |
10 $ echo beta > beta | |
11 $ hg addr | |
12 adding alpha | |
13 adding beta | |
14 $ hg ci -m 1 | |
15 | |
16 $ cd .. | |
17 $ hg clone test test-clone | |
18 updating to branch default | |
19 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
20 | |
18422
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
21 Test spurious filelog entries: |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
22 |
12279 | 23 $ cd test-clone |
18422
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
24 $ echo blah >> beta |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
25 $ cp .hg/store/data/beta.i tmp1 |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
26 $ hg ci -m 2 |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
27 $ cp .hg/store/data/beta.i tmp2 |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
28 $ hg -q rollback |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
29 $ mv tmp2 .hg/store/data/beta.i |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
30 $ echo blah >> beta |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
31 $ hg ci -m '2 (corrupt)' |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
32 |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
33 Expected to fail: |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
34 |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
35 $ hg verify |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
36 checking changesets |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
37 checking manifests |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
38 crosschecking files in changesets and manifests |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
39 checking files |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
40 beta@1: dddc47b3ba30 not in manifests |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
41 2 files, 2 changesets, 4 total revisions |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
42 1 integrity errors encountered! |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
43 (first damaged changeset appears to be 1) |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
44 [1] |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
45 |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
46 $ hg push |
18506
ef60083b5536
tests: fix for windows - slashes and no serve
Mads Kiilerich <madski@unity3d.com>
parents:
18422
diff
changeset
|
47 pushing to $TESTTMP/test (glob) |
18422
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
48 searching for changes |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
49 adding changesets |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
50 adding manifests |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
51 adding file changes |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
52 transaction abort! |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
53 rollback completed |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
54 abort: received spurious file revlog entry |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
55 [255] |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
56 |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
57 $ hg -q rollback |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
58 $ mv tmp1 .hg/store/data/beta.i |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
59 $ echo beta > beta |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
60 |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
61 Test missing filelog entries: |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
62 |
12279 | 63 $ cp .hg/store/data/beta.i tmp |
64 $ echo blah >> beta | |
65 $ hg ci -m '2 (corrupt)' | |
66 $ mv tmp .hg/store/data/beta.i | |
10418
5fc090ba08a6
localrepo: add optional validation (defaults to off) for incoming changes
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
67 |
12279 | 68 Expected to fail: |
69 | |
70 $ hg verify | |
71 checking changesets | |
72 checking manifests | |
73 crosschecking files in changesets and manifests | |
74 checking files | |
28114
2a03a365f645
verify: use similar language for missing manifest and file revisions
Martin von Zweigbergk <martinvonz@google.com>
parents:
18506
diff
changeset
|
75 beta@1: manifest refers to unknown revision dddc47b3ba30 |
12279 | 76 2 files, 2 changesets, 2 total revisions |
77 1 integrity errors encountered! | |
78 (first damaged changeset appears to be 1) | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
79 [1] |
10418
5fc090ba08a6
localrepo: add optional validation (defaults to off) for incoming changes
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
80 |
12279 | 81 $ hg push |
15447
9910f60a37ee
tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents:
12640
diff
changeset
|
82 pushing to $TESTTMP/test (glob) |
12279 | 83 searching for changes |
84 adding changesets | |
85 adding manifests | |
86 adding file changes | |
87 transaction abort! | |
88 rollback completed | |
89 abort: missing file data for beta:dddc47b3ba30e54484720ce0f4f768a0f4b6efb9 - run hg verify | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
90 [255] |
12279 | 91 |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
15447
diff
changeset
|
92 $ cd .. |