Mercurial > evolve
view tests/test-topic-shelve.t @ 6574:054a7c342463
topic: use distinct names for distinct origvalidator and _validate()
Here, the same topicrepo.transaction method, we set up various transaction
validators. On older hg versions (5.3 and older) this involves storing the
original transaction validator (i.e. tr._validator function) and creating a
wrapper function to use as the replacement.
In cases when multiple
topic-related validators were needed, the code used to store tr._validator
multiple times, and create a wrapper function that used origvalidator multiple
times as well. In such cases we can no longer use the same names for the
functions/variables, as they are used inside multiple validator functions, but
are going to be overridden by later assignments/definitions (due to the shared
names), since it's done in the scope of the same topicrepo.transaction().
Names can be better, but it'll do for now, and at some point we'll simply drop
compatibility for 5.3, which should happen relatively soon.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Sat, 14 Oct 2023 15:53:40 -0300 |
parents | fb4801478d5d |
children | 9da0114a8a02 |
line wrap: on
line source
testing topic with shelve extension ------------------------------------ $ . "$TESTDIR/testlib/topic_setup.sh" $ hg init repo $ cd repo $ cat <<EOF >>.hg/hgrc > [extensions] > shelve= > EOF $ touch a $ echo "Hello" >> a $ hg topic "testing-shelve" marked working directory as topic: testing-shelve $ hg topic * testing-shelve (0 changesets) $ hg ci -m "First commit" -A adding a active topic 'testing-shelve' grew its first changeset (see 'hg help topics' for more information) $ hg topic * testing-shelve (1 changesets) $ echo " World" >> a $ hg stack ### topic: testing-shelve ### target: default (branch) s1@ First commit (current) shelve test ----------- $ hg shelve shelved as default 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg topic * testing-shelve (1 changesets) $ hg stack ### topic: testing-shelve ### target: default (branch) s1@ First commit (current) unshelve test ------------- $ hg unshelve unshelving change 'default' $ hg topic * testing-shelve (1 changesets) $ hg stack ### topic: testing-shelve ### target: default (branch) s1@ First commit (current)