Mercurial > hg
annotate tests/test-permissions.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 | 8fb6844a4ff1 |
children | 435f63d12475 |
rev | line source |
---|---|
22047
8fb6844a4ff1
tests: change some #ifs to #requires
Matt Mackall <mpm@selenic.com>
parents:
21023
diff
changeset
|
1 #require unix-permissions no-root |
15443
a1914d214579
tests: use 'hghave unix-permissions' for tests that really use chmod
Mads Kiilerich <mads@kiilerich.com>
parents:
12640
diff
changeset
|
2 |
12279 | 3 $ hg init t |
4 $ cd t | |
5 | |
6 $ echo foo > a | |
7 $ hg add a | |
8 | |
9 $ hg commit -m "1" | |
10 | |
11 $ hg verify | |
12 checking changesets | |
13 checking manifests | |
14 crosschecking files in changesets and manifests | |
15 checking files | |
16 1 files, 1 changesets, 1 total revisions | |
17 | |
18 $ chmod -r .hg/store/data/a.i | |
19 | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
20 $ hg verify |
12279 | 21 checking changesets |
22 checking manifests | |
23 crosschecking files in changesets and manifests | |
24 checking files | |
12640
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12376
diff
changeset
|
25 abort: Permission denied: $TESTTMP/t/.hg/store/data/a.i |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
26 [255] |
12279 | 27 |
28 $ chmod +r .hg/store/data/a.i | |
29 | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
30 $ hg verify |
12279 | 31 checking changesets |
32 checking manifests | |
33 crosschecking files in changesets and manifests | |
34 checking files | |
35 1 files, 1 changesets, 1 total revisions | |
1497 | 36 |
12279 | 37 $ chmod -w .hg/store/data/a.i |
38 | |
39 $ echo barber > a | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
40 $ hg commit -m "2" |
12279 | 41 trouble committing a! |
12640
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12376
diff
changeset
|
42 abort: Permission denied: $TESTTMP/t/.hg/store/data/a.i |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
43 [255] |
12279 | 44 |
45 $ chmod -w . | |
46 | |
47 $ hg diff --nodates | |
48 diff -r 2a18120dc1c9 a | |
49 --- a/a | |
50 +++ b/a | |
51 @@ -1,1 +1,1 @@ | |
52 -foo | |
53 +barber | |
7099
6f750e76fb46
dirstate.walk: skip unreadable directories (issue1213)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5519
diff
changeset
|
54 |
12279 | 55 $ chmod +w . |
56 | |
57 $ chmod +w .hg/store/data/a.i | |
58 $ mkdir dir | |
59 $ touch dir/a | |
60 $ hg status | |
61 M a | |
62 ? dir/a | |
63 $ chmod -rx dir | |
64 $ hg status | |
65 dir: Permission denied | |
66 M a | |
67 | |
68 Reenable perm to allow deletion: | |
69 | |
70 $ chmod +rx dir | |
71 | |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
15443
diff
changeset
|
72 $ cd .. |