view tests/test-namespaces-precheck.t @ 6935:954d7ea5cd67 stable tip

stack: when stack base is obsolete, pick any successor, even if at random There are situations when s0 is obsolete and we also cannot pick just one successor for it to use in stack. In such a case, let's pick the "latest" successor from the first set. We're assuming that obsutil.successorssets() returns data in the same order (it should, since it makes sure to sort data internally). Keeping that in mind, while the successor picked for s0 by this code is not based on any sort of sophisticated logic, it should nonetheless be the same every time. This patch is probably not going to completely break anything that was previously working fine, because the previous behavior was to just abort with an exception.
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 16 Nov 2024 17:01:02 +0400
parents 80d5d4e587f7
children e846964c93c2
line wrap: on
line source

Checking affected topic namespaces before history rewrites
==========================================================

  $ . "$TESTDIR/testlib/common.sh"

  $ cat >> $HGRCPATH << EOF
  > [extensions]
  > evolve =
  > topic =
  > rebase =
  > histedit =
  > [phases]
  > publish = no
  > [experimental]
  > tns-allow-rewrite =
  > EOF

  $ hg init repo
  $ cd repo

Make sure general checks in precheck() happen before topic namespaces checks

  $ hg prune null
  abort: cannot prune the null revision
  (no changeset checked out)
  [10]

  $ echo apple > a
  $ hg ci -qAm apple

  $ hg debug-topic-namespace foo
  marked working directory as topic namespace: foo
  $ hg topic bar
  marked working directory as topic: bar
  $ echo banana > b
  $ hg ci -qAm 'banana'

Allowing topic namespaces with --config works correctly

  $ echo broccoli > b
  $ hg amend -m 'broccoli'
  abort: refusing to amend changesets with these topic namespaces: foo
  (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces)
  [10]
  $ hg amend -m 'broccoli' --config experimental.tns-allow-rewrite=foo,something-unrelated

  $ echo coconut > b
  $ hg ci -qAm 'coconut'

Testing history-rewriting commands from evolve extension

  $ hg amend -m 'coconut'
  abort: refusing to amend changesets with these topic namespaces: foo
  (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces)
  [10]
  $ hg amend --patch -m 'coconut'
  abort: refusing to amend changesets with these topic namespaces: foo
  (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces)
  [10]
  $ hg uncommit
  abort: refusing to uncommit changesets with these topic namespaces: foo
  (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces)
  [10]
  $ hg prune -r .
  abort: refusing to prune changesets with these topic namespaces: foo
  (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces)
  [10]
  $ hg split -r .
  abort: refusing to split changesets with these topic namespaces: foo
  (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces)
  [10]
  $ hg touch -r .
  abort: refusing to touch changesets with these topic namespaces: foo
  (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces)
  [10]

Testing core history-rewriting commands

  $ hg ci --amend
  abort: refusing to amend changesets with these topic namespaces: foo
  (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces)
  [10]
  $ hg branch different-branch --rev .
  abort: refusing to change branch of changesets with these topic namespaces: foo
  (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces)
  [10]
  $ hg rebase -r . -d null
  abort: refusing to rebase changesets with these topic namespaces: foo
  (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces)
  [10]
  $ hg histedit
  abort: refusing to edit changesets with these topic namespaces: foo
  (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces)
  [10]

  $ cd ..