Mercurial > hg
annotate tests/test-merge-closedheads.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 | 8197b395710e |
rev | line source |
---|---|
11971
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
1 $ hgcommit() { |
12156
4c94b6d0fb1c
tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents:
11971
diff
changeset
|
2 > hg commit -u user "$@" |
11971
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
3 > } |
8694
ca8d05e1f1d1
localrepo: set heads and branchheads to be closed=False by default
John Mulligan <phlogistonjohn@asynchrono.us>
parents:
diff
changeset
|
4 |
11971
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
5 $ hg init clhead |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
6 $ cd clhead |
8694
ca8d05e1f1d1
localrepo: set heads and branchheads to be closed=False by default
John Mulligan <phlogistonjohn@asynchrono.us>
parents:
diff
changeset
|
7 |
11971
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
8 $ touch foo && hg add && hgcommit -m 'foo' |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
9 adding foo |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
10 $ touch bar && hg add && hgcommit -m 'bar' |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
11 adding bar |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
12 $ touch baz && hg add && hgcommit -m 'baz' |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
13 adding baz |
8694
ca8d05e1f1d1
localrepo: set heads and branchheads to be closed=False by default
John Mulligan <phlogistonjohn@asynchrono.us>
parents:
diff
changeset
|
14 |
11971
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
15 $ echo "flub" > foo |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
16 $ hgcommit -m "flub" |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
17 $ echo "nub" > foo |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
18 $ hgcommit -m "nub" |
8694
ca8d05e1f1d1
localrepo: set heads and branchheads to be closed=False by default
John Mulligan <phlogistonjohn@asynchrono.us>
parents:
diff
changeset
|
19 |
11971
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
20 $ hg up -C 2 |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
21 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
8694
ca8d05e1f1d1
localrepo: set heads and branchheads to be closed=False by default
John Mulligan <phlogistonjohn@asynchrono.us>
parents:
diff
changeset
|
22 |
11971
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
23 $ echo "c1" > c1 |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
24 $ hg add c1 |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
25 $ hgcommit -m "c1" |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
26 created new head |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
27 $ echo "c2" > c1 |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
28 $ hgcommit -m "c2" |
8694
ca8d05e1f1d1
localrepo: set heads and branchheads to be closed=False by default
John Mulligan <phlogistonjohn@asynchrono.us>
parents:
diff
changeset
|
29 |
11971
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
30 $ hg up -C 2 |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
31 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
8694
ca8d05e1f1d1
localrepo: set heads and branchheads to be closed=False by default
John Mulligan <phlogistonjohn@asynchrono.us>
parents:
diff
changeset
|
32 |
11971
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
33 $ echo "d1" > d1 |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
34 $ hg add d1 |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
35 $ hgcommit -m "d1" |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
36 created new head |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
37 $ echo "d2" > d1 |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
38 $ hgcommit -m "d2" |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
39 $ hg tag -l good |
8694
ca8d05e1f1d1
localrepo: set heads and branchheads to be closed=False by default
John Mulligan <phlogistonjohn@asynchrono.us>
parents:
diff
changeset
|
40 |
11971
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
41 fail with three heads |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
42 $ hg up -C good |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
43 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
44 $ hg merge |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
45 abort: branch 'default' has 3 heads - please merge with an explicit rev |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
46 (run 'hg heads .' to see heads) |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
47 [255] |
8694
ca8d05e1f1d1
localrepo: set heads and branchheads to be closed=False by default
John Mulligan <phlogistonjohn@asynchrono.us>
parents:
diff
changeset
|
48 |
11971
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
49 close one of the heads |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
50 $ hg up -C 6 |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
51 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
52 $ hgcommit -m 'close this head' --close-branch |
8694
ca8d05e1f1d1
localrepo: set heads and branchheads to be closed=False by default
John Mulligan <phlogistonjohn@asynchrono.us>
parents:
diff
changeset
|
53 |
11971
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
54 succeed with two open heads |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
55 $ hg up -C good |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
56 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
57 $ hg up -C good |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
58 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
59 $ hg merge |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
60 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
61 (branch merge, don't forget to commit) |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
62 $ hgcommit -m 'merged heads' |
8694
ca8d05e1f1d1
localrepo: set heads and branchheads to be closed=False by default
John Mulligan <phlogistonjohn@asynchrono.us>
parents:
diff
changeset
|
63 |
11516
ee876e42dd74
test-merge-closedheads: test cc982ff2dcf8
Martin Geisler <mg@aragost.com>
parents:
8694
diff
changeset
|
64 hg update -C 8 |
11971
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
65 $ hg update -C 8 |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
66 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
8694
ca8d05e1f1d1
localrepo: set heads and branchheads to be closed=False by default
John Mulligan <phlogistonjohn@asynchrono.us>
parents:
diff
changeset
|
67 |
11516
ee876e42dd74
test-merge-closedheads: test cc982ff2dcf8
Martin Geisler <mg@aragost.com>
parents:
8694
diff
changeset
|
68 hg branch some-branch |
11971
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
69 $ hg branch some-branch |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
70 marked working directory as branch some-branch |
15615 | 71 (branches are permanent and global, did you want a bookmark?) |
11971
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
72 hg commit |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
73 $ hgcommit -m 'started some-branch' |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
74 hg commit --close-branch |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
75 $ hgcommit --close-branch -m 'closed some-branch' |
11516
ee876e42dd74
test-merge-closedheads: test cc982ff2dcf8
Martin Geisler <mg@aragost.com>
parents:
8694
diff
changeset
|
76 |
ee876e42dd74
test-merge-closedheads: test cc982ff2dcf8
Martin Geisler <mg@aragost.com>
parents:
8694
diff
changeset
|
77 hg update default |
11971
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
78 $ hg update default |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
79 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
11516
ee876e42dd74
test-merge-closedheads: test cc982ff2dcf8
Martin Geisler <mg@aragost.com>
parents:
8694
diff
changeset
|
80 hg merge some-branch |
11971
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
81 $ hg merge some-branch |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
82 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
83 (branch merge, don't forget to commit) |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
84 hg commit (no reopening of some-branch) |
71105dd7d4df
tests: unify test-merge-closedheads
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
11516
diff
changeset
|
85 $ hgcommit -m 'merge with closed branch' |
11516
ee876e42dd74
test-merge-closedheads: test cc982ff2dcf8
Martin Geisler <mg@aragost.com>
parents:
8694
diff
changeset
|
86 |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
15615
diff
changeset
|
87 $ cd .. |