view tests/test-namespaces-reject.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 ab60707314e9
children 80d5e11713f5
line wrap: on
line source

Rejecting changesets with any topic namespaces during push

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

  $ cat >> $HGRCPATH << EOF
  > [extensions]
  > topic =
  > [phases]
  > publish = no
  > [devel]
  > tns-report-transactions = push
  > [ui]
  > logtemplate = "{rev}: {desc} {fqbn} ({phase})\n"
  > EOF

  $ hg init orig
  $ hg clone orig clone -q

  $ cd clone

changesets without topic namespace are freely exchanged

  $ echo apple > a
  $ hg debug-topic-namespace --clear
  $ hg topic apple
  marked working directory as topic: apple
  $ hg ci -qAm apple

  $ hg log -r . -T '{rev}: {join(extras, " ")}\n'
  0: branch=default topic=apple

  $ hg push
  pushing to * (glob)
  searching for changes
  adding changesets
  adding manifests
  adding file changes
  added 1 changesets with 1 changes to 1 files

changesets with topic namespaces are rejected when server configuration disallows

  $ cat >> ../orig/.hg/hgrc << EOF
  > [experimental]
  > tns-reject-push = yes
  > EOF

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

  $ hg push
  pushing to $TESTTMP/orig
  searching for changes
  adding changesets
  adding manifests
  adding file changes
  transaction abort!
  rollback completed
  abort: rejecting draft changesets with topic namespace: ed9751f04a18
  [255]

changesets with topic namespaces are only exchanged if server configuration allows

  $ cat >> ../orig/.hg/hgrc << EOF
  > [experimental]
  > tns-reject-push = no
  > EOF

  $ hg push
  pushing to $TESTTMP/orig
  searching for changes
  adding changesets
  adding manifests
  adding file changes
  topic namespaces affected: bob
  added 1 changesets with 1 changes to 1 files

  $ cd ..