| 1 |
========================================= |
| 2 |
Testing single head enforcement: Case A-2 |
| 3 |
========================================= |
| 4 |
|
| 5 |
A repository is set to only accept a single head per name (typically named |
| 6 |
branch). However, obsolete changesets can make this enforcement more |
| 7 |
complicated, because they can be kept visible by other changeset on other |
| 8 |
branch. |
| 9 |
|
| 10 |
This case is part of a series of tests checking this behavior. |
| 11 |
|
| 12 |
Category A: Involving obsolescence |
| 13 |
TestCase 2: A branch is split in two, effectively creating two heads |
| 14 |
|
| 15 |
.. old-state: |
| 16 |
.. |
| 17 |
.. * 2 changesets on branch default |
| 18 |
.. * 2 changesets on branch Z on top of them |
| 19 |
.. |
| 20 |
.. new-state: |
| 21 |
.. |
| 22 |
.. * 2 changesets on branch Z at the same location |
| 23 |
.. * 1 changeset on branch default unchanged |
| 24 |
.. * 1 changeset on branch default superseding the other ones |
| 25 |
.. |
| 26 |
.. expected-result: |
| 27 |
.. |
| 28 |
.. * two heads detected |
| 29 |
.. |
| 30 |
.. graph-summary: |
| 31 |
.. |
| 32 |
.. D ● (branch Z) |
| 33 |
.. | |
| 34 |
.. C ● (branch Z) |
| 35 |
.. | |
| 36 |
.. B ø⇠◔ B' |
| 37 |
.. | | |
| 38 |
.. A ● | |
| 39 |
.. |/ |
| 40 |
.. ● |
| 41 |
|
| 42 |
#testcases bm-v2 bm-v3 |
| 43 |
#if bm-v3 |
| 44 |
$ cat <<EOF >> $HGRCPATH |
| 45 |
> [experimental] |
| 46 |
> branch-cache-v3=yes |
| 47 |
> EOF |
| 48 |
#else |
| 49 |
$ cat <<EOF >> $HGRCPATH |
| 50 |
> [experimental] |
| 51 |
> branch-cache-v3=no |
| 52 |
> EOF |
| 53 |
#endif |
| 54 |
|
| 55 |
$ . $TESTDIR/testlib/push-checkheads-util.sh |
| 56 |
|
| 57 |
$ cat >> $HGRCPATH << EOF |
| 58 |
> [command-templates] |
| 59 |
> log = "{node|short} [{branch}] ({phase}): {desc}\n" |
| 60 |
> EOF |
| 61 |
|
| 62 |
Test setup |
| 63 |
---------- |
| 64 |
|
| 65 |
$ mkdir A2 |
| 66 |
$ cd A2 |
| 67 |
$ setuprepos single-head |
| 68 |
creating basic server and client repo |
| 69 |
updating to branch default |
| 70 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 71 |
$ cd client |
| 72 |
$ mkcommit B0 |
| 73 |
$ hg branch Z |
| 74 |
marked working directory as branch Z |
| 75 |
(branches are permanent and global, did you want a bookmark?) |
| 76 |
$ mkcommit C0 |
| 77 |
$ mkcommit D0 |
| 78 |
$ hg push --new-branch |
| 79 |
pushing to $TESTTMP/A2/server |
| 80 |
searching for changes |
| 81 |
adding changesets |
| 82 |
adding manifests |
| 83 |
adding file changes |
| 84 |
added 3 changesets with 3 changes to 3 files |
| 85 |
$ hg up 0 |
| 86 |
0 files updated, 0 files merged, 4 files removed, 0 files unresolved |
| 87 |
$ mkcommit B1 |
| 88 |
created new head |
| 89 |
$ hg debugobsolete `getid "desc(B0)"` `getid "desc(B1)"` |
| 90 |
1 new obsolescence markers |
| 91 |
obsoleted 1 changesets |
| 92 |
2 new orphan changesets |
| 93 |
$ hg heads |
| 94 |
25c56d33e4c4 [default] (draft): B1 |
| 95 |
cdf1dbb37a67 [Z] (draft): D0 |
| 96 |
8aaa48160adc [default] (draft): A0 |
| 97 |
$ hg log -G --hidden |
| 98 |
@ 25c56d33e4c4 [default] (draft): B1 |
| 99 |
| |
| 100 |
| * cdf1dbb37a67 [Z] (draft): D0 |
| 101 |
| | |
| 102 |
| * 3213e3e16c67 [Z] (draft): C0 |
| 103 |
| | |
| 104 |
| x d73caddc5533 [default] (draft): B0 |
| 105 |
| | |
| 106 |
| o 8aaa48160adc [default] (draft): A0 |
| 107 |
|/ |
| 108 |
o 1e4be0697311 [default] (public): root |
| 109 |
|
| 110 |
|
| 111 |
Actual testing |
| 112 |
-------------- |
| 113 |
|
| 114 |
(force push to make sure we get the changeset on the remote) |
| 115 |
|
| 116 |
$ hg push -r 'desc("B1")' --force |
| 117 |
pushing to $TESTTMP/A2/server |
| 118 |
searching for changes |
| 119 |
adding changesets |
| 120 |
adding manifests |
| 121 |
adding file changes |
| 122 |
transaction abort! |
| 123 |
rollback completed |
| 124 |
abort: rejecting multiple heads on branch "default" |
| 125 |
(2 heads: 8aaa48160adc 25c56d33e4c4) |
| 126 |
[255] |