| 1 |
===================== |
| 2 |
Test workflow options |
| 3 |
===================== |
| 4 |
|
| 5 |
$ . "$TESTDIR/testlib/obsmarker-common.sh" |
| 6 |
|
| 7 |
Test single head enforcing - Setup |
| 8 |
============================================= |
| 9 |
|
| 10 |
$ cat << EOF >> $HGRCPATH |
| 11 |
> [experimental] |
| 12 |
> evolution = all |
| 13 |
> EOF |
| 14 |
$ hg init single-head-server |
| 15 |
$ cd single-head-server |
| 16 |
$ cat <<EOF >> .hg/hgrc |
| 17 |
> [phases] |
| 18 |
> publish = no |
| 19 |
> [experimental] |
| 20 |
> single-head-per-branch = yes |
| 21 |
> EOF |
| 22 |
$ mkcommit ROOT |
| 23 |
$ mkcommit c_dA0 |
| 24 |
$ cd .. |
| 25 |
|
| 26 |
$ hg clone single-head-server client |
| 27 |
updating to branch default |
| 28 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 29 |
|
| 30 |
Test single head enforcing - with branch only |
| 31 |
--------------------------------------------- |
| 32 |
|
| 33 |
$ cd client |
| 34 |
|
| 35 |
continuing the current defaultbranch |
| 36 |
|
| 37 |
$ mkcommit c_dB0 |
| 38 |
$ hg push |
| 39 |
pushing to $TESTTMP/single-head-server |
| 40 |
searching for changes |
| 41 |
adding changesets |
| 42 |
adding manifests |
| 43 |
adding file changes |
| 44 |
added 1 changesets with 1 changes to 1 files |
| 45 |
|
| 46 |
creating a new branch |
| 47 |
|
| 48 |
$ hg up 'desc("ROOT")' |
| 49 |
0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
| 50 |
$ hg branch branch_A |
| 51 |
marked working directory as branch branch_A |
| 52 |
(branches are permanent and global, did you want a bookmark?) |
| 53 |
$ mkcommit c_aC0 |
| 54 |
$ hg push --new-branch |
| 55 |
pushing to $TESTTMP/single-head-server |
| 56 |
searching for changes |
| 57 |
adding changesets |
| 58 |
adding manifests |
| 59 |
adding file changes |
| 60 |
added 1 changesets with 1 changes to 1 files (+1 heads) |
| 61 |
|
| 62 |
Create a new head on the default branch |
| 63 |
|
| 64 |
$ hg up 'desc("c_dA0")' |
| 65 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 66 |
$ mkcommit c_dD0 |
| 67 |
created new head |
| 68 |
$ hg log -r 'heads(::branch("default"))' -T '{node|short}\n' |
| 69 |
286d02a6e2a2 |
| 70 |
9bf953aa81f6 |
| 71 |
$ hg push -f |
| 72 |
pushing to $TESTTMP/single-head-server |
| 73 |
searching for changes |
| 74 |
adding changesets |
| 75 |
adding manifests |
| 76 |
adding file changes |
| 77 |
transaction abort! |
| 78 |
rollback completed |
| 79 |
abort: rejecting multiple heads on branch "default" |
| 80 |
(2 heads: 286d02a6e2a2 9bf953aa81f6) |
| 81 |
[255] |
| 82 |
|
| 83 |
remerge them |
| 84 |
|
| 85 |
$ hg merge |
| 86 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 87 |
(branch merge, don't forget to commit) |
| 88 |
$ mkcommit c_dE0 |
| 89 |
$ hg push |
| 90 |
pushing to $TESTTMP/single-head-server |
| 91 |
searching for changes |
| 92 |
adding changesets |
| 93 |
adding manifests |
| 94 |
adding file changes |
| 95 |
added 2 changesets with 2 changes to 2 files |
| 96 |
|
| 97 |
Test single head enforcing - after rewrite |
| 98 |
------------------------------------------ |
| 99 |
|
| 100 |
$ mkcommit c_dF0 |
| 101 |
$ hg push |
| 102 |
pushing to $TESTTMP/single-head-server |
| 103 |
searching for changes |
| 104 |
adding changesets |
| 105 |
adding manifests |
| 106 |
adding file changes |
| 107 |
added 1 changesets with 1 changes to 1 files |
| 108 |
$ hg commit --amend -m c_dF1 |
| 109 |
$ hg push |
| 110 |
pushing to $TESTTMP/single-head-server |
| 111 |
searching for changes |
| 112 |
adding changesets |
| 113 |
adding manifests |
| 114 |
adding file changes |
| 115 |
added 1 changesets with 0 changes to 1 files (+1 heads) |
| 116 |
1 new obsolescence markers |
| 117 |
obsoleted 1 changesets |
| 118 |
|
| 119 |
Check it does not interfer with strip |
| 120 |
------------------------------------- |
| 121 |
|
| 122 |
setup |
| 123 |
|
| 124 |
$ hg branch branch_A --force |
| 125 |
marked working directory as branch branch_A |
| 126 |
$ mkcommit c_aG0 |
| 127 |
created new head |
| 128 |
$ hg update 'desc("c_dF1")' |
| 129 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 130 |
$ mkcommit c_dH0 |
| 131 |
$ hg update 'desc("c_aG0")' |
| 132 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 133 |
$ hg merge |
| 134 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 135 |
(branch merge, don't forget to commit) |
| 136 |
$ mkcommit c_aI0 |
| 137 |
$ hg log -G |
| 138 |
@ changeset: 10:49003e504178 |
| 139 |
|\ branch: branch_A |
| 140 |
| | tag: tip |
| 141 |
| | parent: 8:a33fb808fb4b |
| 142 |
| | parent: 3:840af1c6bc88 |
| 143 |
| | user: test |
| 144 |
| | date: Thu Jan 01 00:00:00 1970 +0000 |
| 145 |
| | summary: c_aI0 |
| 146 |
| | |
| 147 |
| | o changeset: 9:fe47ea669cea |
| 148 |
| | | parent: 7:99a2dc242c5d |
| 149 |
| | | user: test |
| 150 |
| | | date: Thu Jan 01 00:00:00 1970 +0000 |
| 151 |
| | | summary: c_dH0 |
| 152 |
| | | |
| 153 |
| o | changeset: 8:a33fb808fb4b |
| 154 |
| |/ branch: branch_A |
| 155 |
| | user: test |
| 156 |
| | date: Thu Jan 01 00:00:00 1970 +0000 |
| 157 |
| | summary: c_aG0 |
| 158 |
| | |
| 159 |
| o changeset: 7:99a2dc242c5d |
| 160 |
| | parent: 5:6ed1df20edb1 |
| 161 |
| | user: test |
| 162 |
| | date: Thu Jan 01 00:00:00 1970 +0000 |
| 163 |
| | summary: c_dF1 |
| 164 |
| | |
| 165 |
| o changeset: 5:6ed1df20edb1 |
| 166 |
| |\ parent: 4:9bf953aa81f6 |
| 167 |
| | | parent: 2:286d02a6e2a2 |
| 168 |
| | | user: test |
| 169 |
| | | date: Thu Jan 01 00:00:00 1970 +0000 |
| 170 |
| | | summary: c_dE0 |
| 171 |
| | | |
| 172 |
| | o changeset: 4:9bf953aa81f6 |
| 173 |
| | | parent: 1:134bc3852ad2 |
| 174 |
| | | user: test |
| 175 |
| | | date: Thu Jan 01 00:00:00 1970 +0000 |
| 176 |
| | | summary: c_dD0 |
| 177 |
| | | |
| 178 |
o | | changeset: 3:840af1c6bc88 |
| 179 |
| | | branch: branch_A |
| 180 |
| | | parent: 0:ea207398892e |
| 181 |
| | | user: test |
| 182 |
| | | date: Thu Jan 01 00:00:00 1970 +0000 |
| 183 |
| | | summary: c_aC0 |
| 184 |
| | | |
| 185 |
| o | changeset: 2:286d02a6e2a2 |
| 186 |
| |/ user: test |
| 187 |
| | date: Thu Jan 01 00:00:00 1970 +0000 |
| 188 |
| | summary: c_dB0 |
| 189 |
| | |
| 190 |
| o changeset: 1:134bc3852ad2 |
| 191 |
|/ user: test |
| 192 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 193 |
| summary: c_dA0 |
| 194 |
| |
| 195 |
o changeset: 0:ea207398892e |
| 196 |
user: test |
| 197 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 198 |
summary: ROOT |
| 199 |
|
| 200 |
|
| 201 |
actual stripping |
| 202 |
|
| 203 |
$ hg strip --config extensions.strip= --rev 'desc("c_dH0")' |
| 204 |
saved backup bundle to $TESTTMP/client/.hg/strip-backup/fe47ea669cea-a41bf5a9-backup.hg |
| 205 |
|
| 206 |
Test that closing heads are ignored by default |
| 207 |
----------------------------------------------- |
| 208 |
|
| 209 |
$ hg up 'desc("c_aG0")' |
| 210 |
0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
| 211 |
$ mkcommit c_aJ0 |
| 212 |
created new head |
| 213 |
|
| 214 |
pushing the new head should fails |
| 215 |
|
| 216 |
$ hg push -f |
| 217 |
pushing to $TESTTMP/single-head-server |
| 218 |
searching for changes |
| 219 |
adding changesets |
| 220 |
adding manifests |
| 221 |
adding file changes |
| 222 |
transaction abort! |
| 223 |
rollback completed |
| 224 |
abort: rejecting multiple heads on branch "branch_A" |
| 225 |
(2 heads: 49003e504178 468bd81ccc5d) |
| 226 |
[255] |
| 227 |
|
| 228 |
|
| 229 |
closing the head and pushing should succeed |
| 230 |
|
| 231 |
$ mkcommit c_aK0 --close-branch |
| 232 |
$ hg push -f |
| 233 |
pushing to $TESTTMP/single-head-server |
| 234 |
searching for changes |
| 235 |
adding changesets |
| 236 |
adding manifests |
| 237 |
adding file changes |
| 238 |
added 4 changesets with 4 changes to 4 files (-1 heads) |
| 239 |
|
| 240 |
|
| 241 |
Test that closing heads can be explicitly accounted for |
| 242 |
------------------------------------------------------- |
| 243 |
|
| 244 |
$ cat <<EOF >> $TESTTMP/single-head-server/.hg/hgrc |
| 245 |
> [experimental] |
| 246 |
> single-head-per-branch:account-closed-heads = yes |
| 247 |
> EOF |
| 248 |
|
| 249 |
$ hg up 'desc("c_aG0")' |
| 250 |
0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
| 251 |
$ mkcommit c_aL0 |
| 252 |
created new head |
| 253 |
$ mkcommit c_aM0 --close-branch |
| 254 |
$ hg push -f |
| 255 |
pushing to $TESTTMP/single-head-server |
| 256 |
searching for changes |
| 257 |
adding changesets |
| 258 |
adding manifests |
| 259 |
adding file changes |
| 260 |
transaction abort! |
| 261 |
rollback completed |
| 262 |
abort: rejecting multiple heads on branch "branch_A" |
| 263 |
(3 heads: 49003e504178 5254bcccab93 42b9fe70a3c1) |
| 264 |
[255] |
| 265 |
|
| 266 |
|
| 267 |
Test that config can be overriden as the boolean it is |
| 268 |
------------------------------------------------------ |
| 269 |
|
| 270 |
$ cat <<EOF >> $TESTTMP/single-head-server/.hg/hgrc |
| 271 |
> [experimental] |
| 272 |
> single-head-per-branch = no |
| 273 |
> EOF |
| 274 |
|
| 275 |
Because of previous test, we'll also push c_aL0 and c_aM0. |
| 276 |
|
| 277 |
$ hg out -T "{desc}\n" |
| 278 |
comparing with $TESTTMP/single-head-server |
| 279 |
searching for changes |
| 280 |
c_aL0 |
| 281 |
c_aM0 |
| 282 |
|
| 283 |
Let's make a new head and push everything. The server feedback will mention |
| 284 |
exactly one new head because c_aM0 is closed. |
| 285 |
|
| 286 |
$ hg up 'desc("c_aG0")' |
| 287 |
0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
| 288 |
$ mkcommit c_aN0 |
| 289 |
created new head |
| 290 |
$ hg push -f |
| 291 |
pushing to $TESTTMP/single-head-server |
| 292 |
searching for changes |
| 293 |
adding changesets |
| 294 |
adding manifests |
| 295 |
adding file changes |
| 296 |
added 3 changesets with 3 changes to 3 files (+1 heads) |
| 297 |
$ cd .. |
| 298 |
|
| 299 |
|
| 300 |
Test that singe-head-per-branch can be restricted to public changes |
| 301 |
------------------------------------------------------------------- |
| 302 |
|
| 303 |
$ hg clone -r 49003e504178 single-head-server public-only |
| 304 |
adding changesets |
| 305 |
adding manifests |
| 306 |
adding file changes |
| 307 |
added 9 changesets with 9 changes to 9 files |
| 308 |
1 new obsolescence markers |
| 309 |
new changesets ea207398892e:49003e504178 (9 drafts) |
| 310 |
updating to branch branch_A |
| 311 |
9 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 312 |
$ cd public-only |
| 313 |
$ cat <<EOF >> .hg/hgrc |
| 314 |
> [phases] |
| 315 |
> publish = no |
| 316 |
> [experimental] |
| 317 |
> single-head-per-branch = yes |
| 318 |
> single-head-per-branch:public-changes-only = yes |
| 319 |
> EOF |
| 320 |
> hg phase -p : |
| 321 |
$ hg update 'desc("c_aG0")' |
| 322 |
0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
| 323 |
$ mkcommit c_dO0 |
| 324 |
created new head |
| 325 |
$ hg log -G |
| 326 |
@ changeset: 9:8058fd35cc2b |
| 327 |
| branch: branch_A |
| 328 |
| tag: tip |
| 329 |
| parent: 7:a33fb808fb4b |
| 330 |
| user: test |
| 331 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 332 |
| summary: c_dO0 |
| 333 |
| |
| 334 |
| o changeset: 8:49003e504178 |
| 335 |
|/| branch: branch_A |
| 336 |
| | parent: 7:a33fb808fb4b |
| 337 |
| | parent: 3:840af1c6bc88 |
| 338 |
| | user: test |
| 339 |
| | date: Thu Jan 01 00:00:00 1970 +0000 |
| 340 |
| | summary: c_aI0 |
| 341 |
| | |
| 342 |
o | changeset: 7:a33fb808fb4b |
| 343 |
| | branch: branch_A |
| 344 |
| | user: test |
| 345 |
| | date: Thu Jan 01 00:00:00 1970 +0000 |
| 346 |
| | summary: c_aG0 |
| 347 |
| | |
| 348 |
o | changeset: 6:99a2dc242c5d |
| 349 |
| | user: test |
| 350 |
| | date: Thu Jan 01 00:00:00 1970 +0000 |
| 351 |
| | summary: c_dF1 |
| 352 |
| | |
| 353 |
o | changeset: 5:6ed1df20edb1 |
| 354 |
|\ \ parent: 4:9bf953aa81f6 |
| 355 |
| | | parent: 2:286d02a6e2a2 |
| 356 |
| | | user: test |
| 357 |
| | | date: Thu Jan 01 00:00:00 1970 +0000 |
| 358 |
| | | summary: c_dE0 |
| 359 |
| | | |
| 360 |
| o | changeset: 4:9bf953aa81f6 |
| 361 |
| | | parent: 1:134bc3852ad2 |
| 362 |
| | | user: test |
| 363 |
| | | date: Thu Jan 01 00:00:00 1970 +0000 |
| 364 |
| | | summary: c_dD0 |
| 365 |
| | | |
| 366 |
| | o changeset: 3:840af1c6bc88 |
| 367 |
| | | branch: branch_A |
| 368 |
| | | parent: 0:ea207398892e |
| 369 |
| | | user: test |
| 370 |
| | | date: Thu Jan 01 00:00:00 1970 +0000 |
| 371 |
| | | summary: c_aC0 |
| 372 |
| | | |
| 373 |
o | | changeset: 2:286d02a6e2a2 |
| 374 |
|/ / user: test |
| 375 |
| | date: Thu Jan 01 00:00:00 1970 +0000 |
| 376 |
| | summary: c_dB0 |
| 377 |
| | |
| 378 |
o | changeset: 1:134bc3852ad2 |
| 379 |
|/ user: test |
| 380 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 381 |
| summary: c_dA0 |
| 382 |
| |
| 383 |
o changeset: 0:ea207398892e |
| 384 |
user: test |
| 385 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 386 |
summary: ROOT |
| 387 |
|
| 388 |
$ hg phase -p . |
| 389 |
abort: rejecting multiple heads on branch "branch_A" |
| 390 |
(2 heads: 49003e504178 8058fd35cc2b) |
| 391 |
[255] |