| 1 |
========================================= |
| 2 |
Testing single head enforcement: Case A-4 |
| 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 4: Partial rewrite of a branch to deinterleave it |
| 14 |
|
| 15 |
.. old-state: |
| 16 |
.. |
| 17 |
.. * 2 changesets on branch default |
| 18 |
.. * 2 changesets on branch Z interleaved with the other one |
| 19 |
.. |
| 20 |
.. new-state: |
| 21 |
.. |
| 22 |
.. * 2 changesets on branch Z at the same location |
| 23 |
.. * 1 changeset on default untouched (the lower one) |
| 24 |
.. * 1 changeset on default moved on the other one |
| 25 |
.. |
| 26 |
.. expected-result: |
| 27 |
.. |
| 28 |
.. * only one head detected |
| 29 |
.. |
| 30 |
.. graph-summary: |
| 31 |
.. |
| 32 |
.. D ● (branch Z) |
| 33 |
.. | |
| 34 |
.. C ø⇠◔ C' |
| 35 |
.. | | |
| 36 |
.. B ● | (branch Z) |
| 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 A4 |
| 66 |
$ cd A4 |
| 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 |
$ hg branch Z |
| 73 |
marked working directory as branch Z |
| 74 |
(branches are permanent and global, did you want a bookmark?) |
| 75 |
$ mkcommit B0 |
| 76 |
$ hg branch default --force |
| 77 |
marked working directory as branch default |
| 78 |
$ mkcommit C0 |
| 79 |
created new head |
| 80 |
$ hg branch Z --force |
| 81 |
marked working directory as branch Z |
| 82 |
$ mkcommit D0 |
| 83 |
created new head |
| 84 |
$ hg push --new-branch |
| 85 |
pushing to $TESTTMP/A4/server |
| 86 |
searching for changes |
| 87 |
adding changesets |
| 88 |
adding manifests |
| 89 |
adding file changes |
| 90 |
added 3 changesets with 3 changes to 3 files |
| 91 |
$ hg up 'desc("A0")' |
| 92 |
0 files updated, 0 files merged, 3 files removed, 0 files unresolved |
| 93 |
$ mkcommit C1 |
| 94 |
created new head |
| 95 |
$ hg debugobsolete `getid "desc(C0)"` `getid "desc(C1)"` |
| 96 |
1 new obsolescence markers |
| 97 |
obsoleted 1 changesets |
| 98 |
1 new orphan changesets |
| 99 |
$ hg heads |
| 100 |
cfe9ed94fa4a [default] (draft): C1 |
| 101 |
78578c4306ce [Z] (draft): D0 |
| 102 |
$ hg log -G --hidden |
| 103 |
@ cfe9ed94fa4a [default] (draft): C1 |
| 104 |
| |
| 105 |
| * 78578c4306ce [Z] (draft): D0 |
| 106 |
| | |
| 107 |
| x afc55ba2ce61 [default] (draft): C0 |
| 108 |
| | |
| 109 |
| o 93e5c1321ece [Z] (draft): B0 |
| 110 |
|/ |
| 111 |
o 8aaa48160adc [default] (draft): A0 |
| 112 |
| |
| 113 |
o 1e4be0697311 [default] (public): root |
| 114 |
|
| 115 |
|
| 116 |
Actual testing |
| 117 |
-------------- |
| 118 |
|
| 119 |
(force push to make sure we get the changeset on the remote) |
| 120 |
|
| 121 |
$ hg push -r 'desc("C1")' --force |
| 122 |
pushing to $TESTTMP/A4/server |
| 123 |
searching for changes |
| 124 |
adding changesets |
| 125 |
adding manifests |
| 126 |
adding file changes |
| 127 |
added 1 changesets with 1 changes to 1 files (+1 heads) |
| 128 |
1 new obsolescence markers |
| 129 |
obsoleted 1 changesets |
| 130 |
1 new orphan changesets |