Mercurial > evolve
annotate tests/test-topic-issue6500.t @ 6023:6c67219ce779 stable
topic: don't cache topic of e.g. memctx in _topiccache (issue6500)
_topiccache exists to make us hit the storage less often when we want to look
at topics for any reason. It doesn't make much sense to cache something that is
memory-only and is cheap to access however. Caching things like that was also a
source of a bug where creating multiple memctx instances in one process would
cache topic of the first one and ignore actual content of .extra() of the
others. That was happening because the cache is keyed by .rev(), but all memctx
instances have the same .rev() = None.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Sun, 29 Aug 2021 14:41:23 +0300 |
parents | 43bde39bbe65 |
children |
rev | line source |
---|---|
6022
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
1 KeyError: b'topic' on history-rewriting commands (issue6500) |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
2 https://bz.mercurial-scm.org/show_bug.cgi?id=6500 |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
3 |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
4 $ . $TESTDIR/testlib/common.sh |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
5 |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
6 Making sure we're not caching .topic() results for memctx or anything else that's not stored on-disk |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
7 |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
8 $ hg init issue6500-caching-memctx |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
9 $ cd issue6500-caching-memctx |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
10 |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
11 $ cat >> $HGRCPATH << EOF |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
12 > [extensions] |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
13 > evolve = |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
14 > topic = |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
15 > EOF |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
16 |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
17 for this test we need 2 changesets with amend_source, one with topic and one without |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
18 |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
19 $ hg topics foo |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
20 marked working directory as topic: foo |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
21 $ echo apple > a |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
22 $ hg ci -qAm 'apple' |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
23 $ echo apricot > a |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
24 $ hg ci --amend -m 'apricot' |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
25 |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
26 not using `hg topics --clear -r .` here because that would remove amend_source, see _changetopics() |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
27 |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
28 $ hg topics --clear |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
29 $ hg ci --amend -m 'no foo apricot' |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
30 |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
31 $ hg log --hidden -r 1+2 -T '{rev}: {join(extras, " ")}\n' |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
32 1: amend_source=* branch=default topic=foo (glob) |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
33 2: amend_source=* branch=default (glob) |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
34 |
6023
6c67219ce779
topic: don't cache topic of e.g. memctx in _topiccache (issue6500)
Anton Shestakov <av6@dwimlabs.net>
parents:
6022
diff
changeset
|
35 creating and handling 2 memctx instances (based on 1 and then 2) should work |
6022
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
36 |
6023
6c67219ce779
topic: don't cache topic of e.g. memctx in _topiccache (issue6500)
Anton Shestakov <av6@dwimlabs.net>
parents:
6022
diff
changeset
|
37 $ hg touch --hidden -r 1+2 --duplicate |
6c67219ce779
topic: don't cache topic of e.g. memctx in _topiccache (issue6500)
Anton Shestakov <av6@dwimlabs.net>
parents:
6022
diff
changeset
|
38 switching to topic foo |
6022
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
39 |
6023
6c67219ce779
topic: don't cache topic of e.g. memctx in _topiccache (issue6500)
Anton Shestakov <av6@dwimlabs.net>
parents:
6022
diff
changeset
|
40 make sure extras stay the same |
6022
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
41 |
43bde39bbe65
tests: demonstrate how caching topic of memctx results in issue6500
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
42 $ hg log --hidden -r 3+4 -T '{rev}: {join(extras, " ")}\n' |
6023
6c67219ce779
topic: don't cache topic of e.g. memctx in _topiccache (issue6500)
Anton Shestakov <av6@dwimlabs.net>
parents:
6022
diff
changeset
|
43 3: __touch-noise__=* amend_source=* branch=default topic=foo (glob) |
6c67219ce779
topic: don't cache topic of e.g. memctx in _topiccache (issue6500)
Anton Shestakov <av6@dwimlabs.net>
parents:
6022
diff
changeset
|
44 4: __touch-noise__=* amend_source=* branch=default (glob) |