331 else: |
331 else: |
332 common = [nullid] |
332 common = [nullid] |
333 if not heads: |
333 if not heads: |
334 heads = cl.heads() |
334 heads = cl.heads() |
335 return discovery.outgoing(repo, common, heads) |
335 return discovery.outgoing(repo, common, heads) |
|
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) |
336 |
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 |
340 This function is used to allow testing of the older bundle version""" |
368 This function is used to allow testing of the older bundle version""" |
531 |
559 |
532 with wlock or util.nullcontextmanager(), \ |
560 with wlock or util.nullcontextmanager(), \ |
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) |
539 _pushchangeset(pushop) |
568 _pushchangeset(pushop) |
540 _pushsyncphase(pushop) |
569 _pushsyncphase(pushop) |