| 1 |
========================================= |
| 2 |
Testing single head enforcement: Case A-5 |
| 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 5: Obsoleting a merge reveals two heads |
| 14 |
|
| 15 |
.. old-state: |
| 16 |
.. |
| 17 |
.. * 3 changesets on branch default (2 on their own branch + 1 merge) |
| 18 |
.. * 1 changeset on branch Z (children of the merge) |
| 19 |
.. |
| 20 |
.. new-state: |
| 21 |
.. |
| 22 |
.. * 2 changesets on branch default (merge is obsolete) each a head |
| 23 |
.. * 1 changeset on branch Z keeping the merge visible |
| 24 |
.. |
| 25 |
.. expected-result: |
| 26 |
.. |
| 27 |
.. * 2 heads detected (because we skip the merge) |
| 28 |
.. |
| 29 |
.. graph-summary: |
| 30 |
.. |
| 31 |
.. C ● (branch Z) |
| 32 |
.. | |
| 33 |
.. M ⊗ |
| 34 |
.. |\ |
| 35 |
.. A ● ● B |
| 36 |
.. |/ |
| 37 |
.. ● |
| 38 |
|
| 39 |
#testcases bm-v2 bm-v3 |
| 40 |
#if bm-v3 |
| 41 |
$ cat <<EOF >> $HGRCPATH |
| 42 |
> [experimental] |
| 43 |
> branch-cache-v3=yes |
| 44 |
> EOF |
| 45 |
#else |
| 46 |
$ cat <<EOF >> $HGRCPATH |
| 47 |
> [experimental] |
| 48 |
> branch-cache-v3=no |
| 49 |
> EOF |
| 50 |
#endif |
| 51 |
|
| 52 |
$ . $TESTDIR/testlib/push-checkheads-util.sh |
| 53 |
|
| 54 |
$ cat >> $HGRCPATH << EOF |
| 55 |
> [command-templates] |
| 56 |
> log = "{node|short} [{branch}] ({phase}): {desc}\n" |
| 57 |
> EOF |
| 58 |
|
| 59 |
Test setup |
| 60 |
---------- |
| 61 |
|
| 62 |
$ mkdir A5 |
| 63 |
$ cd A5 |
| 64 |
$ setuprepos single-head |
| 65 |
creating basic server and client repo |
| 66 |
updating to branch default |
| 67 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 68 |
$ cd client |
| 69 |
$ hg up 0 |
| 70 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 71 |
$ mkcommit B0 |
| 72 |
created new head |
| 73 |
$ hg merge |
| 74 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 75 |
(branch merge, don't forget to commit) |
| 76 |
$ hg ci -m 'M0' |
| 77 |
$ hg branch Z |
| 78 |
marked working directory as branch Z |
| 79 |
(branches are permanent and global, did you want a bookmark?) |
| 80 |
$ mkcommit C0 |
| 81 |
$ hg push --new-branch |
| 82 |
pushing to $TESTTMP/A5/server |
| 83 |
searching for changes |
| 84 |
adding changesets |
| 85 |
adding manifests |
| 86 |
adding file changes |
| 87 |
added 3 changesets with 2 changes to 2 files |
| 88 |
$ hg debugobsolete `getid "desc(M0)"` --record-parents |
| 89 |
1 new obsolescence markers |
| 90 |
obsoleted 1 changesets |
| 91 |
1 new orphan changesets |
| 92 |
$ hg heads |
| 93 |
61c95483cc12 [Z] (draft): C0 |
| 94 |
74ff5441d343 [default] (draft): B0 |
| 95 |
8aaa48160adc [default] (draft): A0 |
| 96 |
$ hg log -G --hidden |
| 97 |
@ 61c95483cc12 [Z] (draft): C0 |
| 98 |
| |
| 99 |
x 14d3d4d41d1a [default] (draft): M0 |
| 100 |
|\ |
| 101 |
| o 74ff5441d343 [default] (draft): B0 |
| 102 |
| | |
| 103 |
o | 8aaa48160adc [default] (draft): A0 |
| 104 |
|/ |
| 105 |
o 1e4be0697311 [default] (public): root |
| 106 |
|
| 107 |
|
| 108 |
Actual testing |
| 109 |
-------------- |
| 110 |
|
| 111 |
(force push to make sure we get the changeset on the remote) |
| 112 |
|
| 113 |
$ hg push -r 'desc("C0")' --force |
| 114 |
pushing to $TESTTMP/A5/server |
| 115 |
searching for changes |
| 116 |
no changes found |
| 117 |
transaction abort! |
| 118 |
rollback completed |
| 119 |
abort: rejecting multiple heads on branch "default" |
| 120 |
(2 heads: 8aaa48160adc 74ff5441d343) |
| 121 |
[255] |