Mercurial > hg
annotate tests/test-ui-verbosity.py @ 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 | d466facc5a6e |
children | d83ca854fa21 |
rev | line source |
---|---|
28679
e48a8ac66a41
py3: make test-ui-verbosity use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
28678
diff
changeset
|
1 from __future__ import absolute_import, print_function |
28678
870dae78234c
py3: make test-ui-verbosity use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
12865
diff
changeset
|
2 |
3349
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
3 import os |
28842
d466facc5a6e
tests: alias ui as uimod in test-revlog-ancestry/test-ui-verbosity
Yuya Nishihara <yuya@tcha.org>
parents:
28679
diff
changeset
|
4 from mercurial import ( |
d466facc5a6e
tests: alias ui as uimod in test-revlog-ancestry/test-ui-verbosity
Yuya Nishihara <yuya@tcha.org>
parents:
28679
diff
changeset
|
5 ui as uimod, |
d466facc5a6e
tests: alias ui as uimod in test-revlog-ancestry/test-ui-verbosity
Yuya Nishihara <yuya@tcha.org>
parents:
28679
diff
changeset
|
6 ) |
3349
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
7 |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
8 hgrc = os.environ['HGRCPATH'] |
5523
5db730475d6d
tests/*: avoid losing the original settings from $HGRCPATH
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3349
diff
changeset
|
9 f = open(hgrc) |
5db730475d6d
tests/*: avoid losing the original settings from $HGRCPATH
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3349
diff
changeset
|
10 basehgrc = f.read() |
5db730475d6d
tests/*: avoid losing the original settings from $HGRCPATH
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3349
diff
changeset
|
11 f.close() |
3349
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
12 |
28678
870dae78234c
py3: make test-ui-verbosity use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
12865
diff
changeset
|
13 print(' hgrc settings command line options final result ') |
870dae78234c
py3: make test-ui-verbosity use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
12865
diff
changeset
|
14 print(' quiet verbo debug quiet verbo debug quiet verbo debug') |
3349
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
15 |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
16 for i in xrange(64): |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
17 hgrc_quiet = bool(i & 1<<0) |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
18 hgrc_verbose = bool(i & 1<<1) |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
19 hgrc_debug = bool(i & 1<<2) |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
20 cmd_quiet = bool(i & 1<<3) |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
21 cmd_verbose = bool(i & 1<<4) |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
22 cmd_debug = bool(i & 1<<5) |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
23 |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
24 f = open(hgrc, 'w') |
5523
5db730475d6d
tests/*: avoid losing the original settings from $HGRCPATH
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3349
diff
changeset
|
25 f.write(basehgrc) |
5db730475d6d
tests/*: avoid losing the original settings from $HGRCPATH
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3349
diff
changeset
|
26 f.write('\n[ui]\n') |
3349
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
27 if hgrc_quiet: |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
28 f.write('quiet = True\n') |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
29 if hgrc_verbose: |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
30 f.write('verbose = True\n') |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
31 if hgrc_debug: |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
32 f.write('debug = True\n') |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
33 f.close() |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
34 |
28842
d466facc5a6e
tests: alias ui as uimod in test-revlog-ancestry/test-ui-verbosity
Yuya Nishihara <yuya@tcha.org>
parents:
28679
diff
changeset
|
35 u = uimod.ui() |
8136
6b5522cb2ad2
ui: refactor option setting
Matt Mackall <mpm@selenic.com>
parents:
5523
diff
changeset
|
36 if cmd_quiet or cmd_debug or cmd_verbose: |
6b5522cb2ad2
ui: refactor option setting
Matt Mackall <mpm@selenic.com>
parents:
5523
diff
changeset
|
37 u.setconfig('ui', 'quiet', str(bool(cmd_quiet))) |
6b5522cb2ad2
ui: refactor option setting
Matt Mackall <mpm@selenic.com>
parents:
5523
diff
changeset
|
38 u.setconfig('ui', 'verbose', str(bool(cmd_verbose))) |
6b5522cb2ad2
ui: refactor option setting
Matt Mackall <mpm@selenic.com>
parents:
5523
diff
changeset
|
39 u.setconfig('ui', 'debug', str(bool(cmd_debug))) |
3349
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
40 |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
41 check = '' |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
42 if u.debugflag: |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
43 if not u.verbose or u.quiet: |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
44 check = ' *' |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
45 elif u.verbose and u.quiet: |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
46 check = ' +' |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
47 |
28678
870dae78234c
py3: make test-ui-verbosity use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
12865
diff
changeset
|
48 print(('%2d %5s %5s %5s %5s %5s %5s -> %5s %5s %5s%s' |
3349
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
49 % (i, hgrc_quiet, hgrc_verbose, hgrc_debug, |
25d270e0b27f
ui.py: untangle updateopts
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
50 cmd_quiet, cmd_verbose, cmd_debug, |
28678
870dae78234c
py3: make test-ui-verbosity use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
12865
diff
changeset
|
51 u.quiet, u.verbose, u.debugflag, check))) |