view tests/test-evolve-extras.t @ 6655:81fe0a498447 stable

topic: internal config option to fix hg pick behavior (issue6406) After some consideration, hg pick was made to always use current topic (and topic namespace), even if it's not set, in which case the resulting changeset will not have any topic. Previously the intended behavior was to only update topic if there was an active topic, and not touch commit extras at all otherwise. That wasn't ideal, since pick doesn't change active topic, and amending the just-picked commit would unset its topic without clear user's intent to do so and to their surprise.
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 27 Jan 2024 17:36:39 -0300
parents e36883d88108
children
line wrap: on
line source

Testing retained_extras_on_rebase usage in evolve and modifying it in an extension

  $ . $TESTDIR/testlib/common.sh

  $ hg init repo
  $ cd repo
  $ cat > .hg/hgrc << EOF
  > [extensions]
  > evolve =
  > EOF

  $ echo apple > a
  $ hg ci -qAm 'apple'
  $ echo banana > b
  $ hg ci -qAm 'banana' --config extensions.commitextras= \
  > --extra useful=b-for-banana \
  > --extra useless=banana-peel

amending apple

  $ hg prev
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  [0] apple
  $ echo apricot > a
  $ hg amend -m 'apricot'
  1 new orphan changesets

the commit still has all extras that we added previously

  $ hg log -r 'desc("banana")' -T '{join(extras, " ")}\n'
  *useful=b-for-banana*useless=banana-peel* (glob)

let's run evolve with our extension

  $ hg --config extensions.retained_extras=${TESTDIR}/testlib/retain-extras-ext.py evolve
  move:[1] banana
  atop:[2] apricot

evolving banana retained "useful" and discarded "useless"

  $ hg log -r 'desc("banana")' -T '{join(extras, " ")}\n'
  *useful=b-for-banana* (glob)