Mercurial > hg
annotate tests/test-convert-clonebranches.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 | 701df761aa94 |
children | 75be14993fda |
rev | line source |
---|---|
5934
e495f3f35b2d
convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
1 |
23172
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
18373
diff
changeset
|
2 $ cat <<EOF >> $HGRCPATH |
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
18373
diff
changeset
|
3 > [extensions] |
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
18373
diff
changeset
|
4 > convert = |
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
18373
diff
changeset
|
5 > [convert] |
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
18373
diff
changeset
|
6 > hg.tagsbranch = 0 |
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
18373
diff
changeset
|
7 > EOF |
12518
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
8 $ hg init source |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
9 $ cd source |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
10 $ echo a > a |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
11 $ hg ci -qAm adda |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
12 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
13 Add a merge with one parent in the same branch |
5934
e495f3f35b2d
convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
14 |
12518
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
15 $ echo a >> a |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
16 $ hg ci -qAm changea |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
17 $ hg up -qC 0 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
18 $ hg branch branch0 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
19 marked working directory as branch branch0 |
15615 | 20 (branches are permanent and global, did you want a bookmark?) |
12518
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
21 $ echo b > b |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
22 $ hg ci -qAm addb |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
23 $ hg up -qC |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
24 $ hg merge default |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
25 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
26 (branch merge, don't forget to commit) |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
27 $ hg ci -qm mergeab |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
28 $ hg tag -ql mergeab |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
29 $ cd .. |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
30 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
31 Miss perl... sometimes |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
32 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
33 $ cat > filter.py <<EOF |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
34 > import sys, re |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
35 > |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
36 > r = re.compile(r'^(?:\d+|pulling from)') |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
37 > sys.stdout.writelines([l for l in sys.stdin if r.search(l)]) |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
38 > EOF |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
39 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
40 convert |
5934
e495f3f35b2d
convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
41 |
12518
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
42 $ hg convert -v --config convert.hg.clonebranches=1 source dest | |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
43 > python filter.py |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
44 3 adda |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
45 2 changea |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
46 1 addb |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
47 pulling from default into branch0 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
48 1 changesets found |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
49 0 mergeab |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
50 pulling from default into branch0 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
51 1 changesets found |
5934
e495f3f35b2d
convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
52 |
12518
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
53 Add a merge with both parents and child in different branches |
5934
e495f3f35b2d
convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
54 |
12518
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
55 $ cd source |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
56 $ hg branch branch1 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
57 marked working directory as branch branch1 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
58 $ echo a > file1 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
59 $ hg ci -qAm c1 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
60 $ hg up -qC mergeab |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
61 $ hg branch branch2 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
62 marked working directory as branch branch2 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
63 $ echo a > file2 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
64 $ hg ci -qAm c2 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
65 $ hg merge branch1 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
66 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
67 (branch merge, don't forget to commit) |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
68 $ hg branch branch3 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
69 marked working directory as branch branch3 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
70 $ hg ci -qAm c3 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
71 $ cd .. |
5934
e495f3f35b2d
convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
72 |
12518
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
73 incremental conversion |
5934
e495f3f35b2d
convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
74 |
12518
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
75 $ hg convert -v --config convert.hg.clonebranches=1 source dest | |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
76 > python filter.py |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
77 2 c1 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
78 pulling from branch0 into branch1 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
79 4 changesets found |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
80 1 c2 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
81 pulling from branch0 into branch2 |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
82 4 changesets found |
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
83 0 c3 |
18373
687ed69f6fdf
convert: process missing branches in sorted order
Mads Kiilerich <mads@kiilerich.com>
parents:
15615
diff
changeset
|
84 pulling from branch1 into branch3 |
12518
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
85 5 changesets found |
18373
687ed69f6fdf
convert: process missing branches in sorted order
Mads Kiilerich <mads@kiilerich.com>
parents:
15615
diff
changeset
|
86 pulling from branch2 into branch3 |
12518
89f1210a1238
tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents:
10119
diff
changeset
|
87 1 changesets found |