sapling/tests/test-push-checkheads-config.t
Jun Wu 4718c95974 checkheads: add a config to disable it
Summary:
Checkheads is a legacy feature that is less useful in our setups, namely:
- In commit cloud / Mononoke's world, it's intentional to have many heads.
  Pushing a new head is a normal operation that should not be forbidden.
- With remotenames, remotenames performs the check and checkheads is
  redundant, as shown by the added test.

So let's add a config option to turn it off first. Later we can remove the
feature and update all the tests.

Reviewed By: ryanmce

Differential Revision: D8148016

fbshipit-source-id: 71684f20b9ca37902440eae331292679b0feb4c6
2018-05-25 02:47:19 -07:00

79 lines
1.7 KiB
Perl

#testcases with-remotenames without-remotenames
#if with-remotenames
$ enable remotenames
#endif
$ newrepo
$ drawdag << 'EOS'
> B
> |
> A
> EOS
$ hg clone -q . $TESTTMP/cloned
$ cd $TESTTMP/cloned
$ drawdag << 'EOS'
> C
> |
> A
> EOS
$ hg up tip -q
#if with-remotenames
Remotenames adds extra checks for bookmarks. It requires "--allow-anon":
$ hg push
pushing to $TESTTMP/repo1
searching for changes
abort: push would create new anonymous heads (dc0947a82db8)
(use --allow-anon to override this warning)
[255]
However, push still fails with "--allow-anon", because of the checkheads:
$ hg push --allow-anon
pushing to $TESTTMP/repo1
searching for changes
abort: push creates new remote head dc0947a82db8!
(merge or see 'hg help push' for details about pushing new heads)
[255]
The checkheads feature should probably be disabled automatically if remotenames
is enabled.
Push with checkheads disabled:
$ hg push --config ui.checkheads=0 --allow-anon
pushing to $TESTTMP/repo1
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
#else
To be compatible with the legacy behavior, pushing a new head is forbidden:
$ hg push
pushing to $TESTTMP/repo1
searching for changes
abort: push creates new remote head dc0947a82db8!
(merge or see 'hg help push' for details about pushing new heads)
[255]
The check could be disabled:
$ hg push --config ui.checkheads=0
pushing to $TESTTMP/repo1
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
#endif