changeset 6022:43bde39bbe65 stable

tests: demonstrate how caching topic of memctx results in issue6500
author Anton Shestakov <av6@dwimlabs.net>
date Sun, 29 Aug 2021 14:30:37 +0300
parents bcdccdd48d99
children 6c67219ce779
files tests/test-check-sdist.t tests/test-topic-issue6500.t
diffstat 2 files changed, 46 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-check-sdist.t	Wed Aug 25 17:38:27 2021 +0300
+++ b/tests/test-check-sdist.t	Sun Aug 29 14:30:37 2021 +0300
@@ -35,7 +35,7 @@
 
   $ tar -tzf hg-evolve-*.tar.gz | sed 's|^hg-evolve-[^/]*/||' | sort > files
   $ wc -l files
-  350 files
+  351 files
   $ fgrep debian files
   tests/test-check-debian.t
   $ fgrep __init__.py files
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-topic-issue6500.t	Sun Aug 29 14:30:37 2021 +0300
@@ -0,0 +1,45 @@
+KeyError: b'topic' on history-rewriting commands (issue6500)
+https://bz.mercurial-scm.org/show_bug.cgi?id=6500
+
+  $ . $TESTDIR/testlib/common.sh
+
+Making sure we're not caching .topic() results for memctx or anything else that's not stored on-disk
+
+  $ hg init issue6500-caching-memctx
+  $ cd issue6500-caching-memctx
+
+  $ cat >> $HGRCPATH << EOF
+  > [extensions]
+  > evolve =
+  > topic =
+  > EOF
+
+for this test we need 2 changesets with amend_source, one with topic and one without
+
+  $ hg topics foo
+  marked working directory as topic: foo
+  $ echo apple > a
+  $ hg ci -qAm 'apple'
+  $ echo apricot > a
+  $ hg ci --amend -m 'apricot'
+
+not using `hg topics --clear -r .` here because that would remove amend_source, see _changetopics()
+
+  $ hg topics --clear
+  $ hg ci --amend -m 'no foo apricot'
+
+  $ hg log --hidden -r 1+2 -T '{rev}: {join(extras, " ")}\n'
+  1: amend_source=* branch=default topic=foo (glob)
+  2: amend_source=* branch=default (glob)
+
+TODO: creating and handling 2 memctx instances (based on 1 and then 2) should work
+
+  $ hg touch --hidden -r 1+2 --duplicate 2>&1 | tail -2
+      del ctx.extra()[constants.extrakey]
+  KeyError: b'topic'
+
+TODO: make sure extras stay the same
+
+  $ hg log --hidden -r 3+4 -T '{rev}: {join(extras, " ")}\n'
+  abort: unknown revision '3' (glob)
+  [255]