Show More
@@ -449,6 +449,9 b" coreconfigitem('email', 'to'," | |||||
449 | coreconfigitem('experimental', 'archivemetatemplate', |
|
449 | coreconfigitem('experimental', 'archivemetatemplate', | |
450 | default=dynamicdefault, |
|
450 | default=dynamicdefault, | |
451 | ) |
|
451 | ) | |
|
452 | coreconfigitem('experimental', 'auto-publish', | |||
|
453 | default='publish', | |||
|
454 | ) | |||
452 | coreconfigitem('experimental', 'bundle-phases', |
|
455 | coreconfigitem('experimental', 'bundle-phases', | |
453 | default=False, |
|
456 | default=False, | |
454 | ) |
|
457 | ) |
@@ -334,6 +334,34 b' def _computeoutgoing(repo, heads, common' | |||||
334 | heads = cl.heads() |
|
334 | heads = cl.heads() | |
335 | return discovery.outgoing(repo, common, heads) |
|
335 | return discovery.outgoing(repo, common, heads) | |
336 |
|
336 | |||
|
337 | def _checkpublish(pushop): | |||
|
338 | repo = pushop.repo | |||
|
339 | ui = repo.ui | |||
|
340 | behavior = ui.config('experimental', 'auto-publish') | |||
|
341 | if pushop.publish or behavior not in ('warn', 'confirm', 'abort'): | |||
|
342 | return | |||
|
343 | remotephases = listkeys(pushop.remote, 'phases') | |||
|
344 | if not remotephases.get('publishing', False): | |||
|
345 | return | |||
|
346 | ||||
|
347 | if pushop.revs is None: | |||
|
348 | published = repo.filtered('served').revs('not public()') | |||
|
349 | else: | |||
|
350 | published = repo.revs('::%ln - public()', pushop.revs) | |||
|
351 | if published: | |||
|
352 | if behavior == 'warn': | |||
|
353 | ui.warn(_('%i changesets about to be published\n') | |||
|
354 | % len(published)) | |||
|
355 | elif behavior == 'confirm': | |||
|
356 | if ui.promptchoice(_('push and publish %i changesets (yn)?' | |||
|
357 | '$$ &Yes $$ &No') % len(published)): | |||
|
358 | raise error.Abort(_('user quit')) | |||
|
359 | elif behavior == 'abort': | |||
|
360 | msg = _('push would publish %i changesets') % len(published) | |||
|
361 | hint = _("use --publish or adjust 'experimental.auto-publish'" | |||
|
362 | " config") | |||
|
363 | raise error.Abort(msg, hint=hint) | |||
|
364 | ||||
337 | def _forcebundle1(op): |
|
365 | def _forcebundle1(op): | |
338 | """return true if a pull/push must use bundle1 |
|
366 | """return true if a pull/push must use bundle1 | |
339 |
|
367 | |||
@@ -533,6 +561,7 b' def push(repo, remote, force=False, revs' | |||||
533 | lock or util.nullcontextmanager(), \ |
|
561 | lock or util.nullcontextmanager(), \ | |
534 | pushop.trmanager or util.nullcontextmanager(): |
|
562 | pushop.trmanager or util.nullcontextmanager(): | |
535 | pushop.repo.checkpush(pushop) |
|
563 | pushop.repo.checkpush(pushop) | |
|
564 | _checkpublish(pushop) | |||
536 | _pushdiscovery(pushop) |
|
565 | _pushdiscovery(pushop) | |
537 | if not _forcebundle1(pushop): |
|
566 | if not _forcebundle1(pushop): | |
538 | _pushbundle2(pushop) |
|
567 | _pushbundle2(pushop) |
@@ -1562,6 +1562,73 b' of phase heads computation)' | |||||
1562 | $ killdaemons.py |
|
1562 | $ killdaemons.py | |
1563 |
|
1563 | |||
1564 |
|
1564 | |||
|
1565 | auto-publish config | |||
|
1566 | ------------------- | |||
|
1567 | ||||
|
1568 | $ hg init auto-publish-orig | |||
|
1569 | $ hg clone -q auto-publish-orig auto-publish-clone | |||
|
1570 | $ cd auto-publish-clone | |||
|
1571 | $ mkcommit a-p-A | |||
|
1572 | test-debug-phase: new rev 0: x -> 1 | |||
|
1573 | $ mkcommit a-p-B | |||
|
1574 | test-debug-phase: new rev 1: x -> 1 | |||
|
1575 | ||||
|
1576 | abort behavior | |||
|
1577 | ||||
|
1578 | $ hg push --config experimental.auto-publish=abort | |||
|
1579 | pushing to $TESTTMP/auto-publish-orig | |||
|
1580 | abort: push would publish 2 changesets | |||
|
1581 | (use --publish or adjust 'experimental.auto-publish' config) | |||
|
1582 | [255] | |||
|
1583 | $ hg push -r '.^' --config experimental.auto-publish=abort | |||
|
1584 | pushing to $TESTTMP/auto-publish-orig | |||
|
1585 | abort: push would publish 1 changesets | |||
|
1586 | (use --publish or adjust 'experimental.auto-publish' config) | |||
|
1587 | [255] | |||
|
1588 | ||||
|
1589 | --publish flag makes push succeed | |||
|
1590 | ||||
|
1591 | $ hg push -r '.^' --publish --config experimental.auto-publish=abort | |||
|
1592 | pushing to $TESTTMP/auto-publish-orig | |||
|
1593 | searching for changes | |||
|
1594 | adding changesets | |||
|
1595 | adding manifests | |||
|
1596 | adding file changes | |||
|
1597 | added 1 changesets with 1 changes to 1 files | |||
|
1598 | test-debug-phase: new rev 0: x -> 0 | |||
|
1599 | test-debug-phase: move rev 0: 1 -> 0 | |||
|
1600 | ||||
|
1601 | warn behavior | |||
|
1602 | ||||
|
1603 | $ hg push --config experimental.auto-publish=warn | |||
|
1604 | pushing to $TESTTMP/auto-publish-orig | |||
|
1605 | 1 changesets about to be published | |||
|
1606 | searching for changes | |||
|
1607 | adding changesets | |||
|
1608 | adding manifests | |||
|
1609 | adding file changes | |||
|
1610 | added 1 changesets with 1 changes to 1 files | |||
|
1611 | test-debug-phase: new rev 1: x -> 0 | |||
|
1612 | test-debug-phase: move rev 1: 1 -> 0 | |||
|
1613 | ||||
|
1614 | confirm behavior | |||
|
1615 | ||||
|
1616 | $ mkcommit a-p-C | |||
|
1617 | test-debug-phase: new rev 2: x -> 1 | |||
|
1618 | $ hg push --config experimental.auto-publish=confirm | |||
|
1619 | pushing to $TESTTMP/auto-publish-orig | |||
|
1620 | push and publish 1 changesets (yn)? y | |||
|
1621 | searching for changes | |||
|
1622 | adding changesets | |||
|
1623 | adding manifests | |||
|
1624 | adding file changes | |||
|
1625 | added 1 changesets with 1 changes to 1 files | |||
|
1626 | test-debug-phase: new rev 2: x -> 0 | |||
|
1627 | test-debug-phase: move rev 2: 1 -> 0 | |||
|
1628 | ||||
|
1629 | $ cd .. | |||
|
1630 | ||||
|
1631 | ||||
1565 | --publish flag |
|
1632 | --publish flag | |
1566 | -------------- |
|
1633 | -------------- | |
1567 |
|
1634 |
General Comments 0
You need to be logged in to leave comments.
Login now