subrepo: detect issue3781 case earlier so it apply to bundle2

We are doing some strange special casing of phase push when:

- the source is a subrepo
- the destination is publishing
- some changeset are still draft on the destination

In that case we do not push phases information (to publish the draft changesets)
because it could break simple cycle of 'clone/pull/push' of subrepos. We have to
detect this case earlier to have bundle2 respecting it.

We change the test to check the behavior for both bundle1 and bundle2.
This commit is contained in:
Pierre-Yves David 2015-05-27 06:08:14 -07:00
parent d0e8796a75
commit d83ef60585
2 changed files with 25 additions and 1 deletions

View File

@ -305,6 +305,20 @@ def _pushdiscoveryphase(pushop):
unfi = pushop.repo.unfiltered()
remotephases = pushop.remote.listkeys('phases')
publishing = remotephases.get('publishing', False)
if (pushop.ui.configbool('ui', '_usedassubrepo', False)
and remotephases # server supports phases
and not pushop.outgoing.missing # no changesets to be pushed
and publishing):
# When:
# - this is a subrepo push
# - and remote support phase
# - and no changeset are to be pushed
# - and remote is publishing
# We may be in issue 3871 case!
# We drop the possible phase synchronisation done by
# courtesy to publish changesets possibly locally draft
# on the remote.
remotephases = {'publishing': 'True'}
ana = phases.analyzeremotephases(pushop.repo,
pushop.fallbackheads,
remotephases)

View File

@ -1490,7 +1490,17 @@ Courtesy phases synchronisation to publishing server does not block the push
> [paths]
> default=../issue3781-dest/
> EOF
$ hg push
$ hg push --config experimental.bundle2-exp=False
pushing to $TESTTMP/issue3781-dest (glob)
pushing subrepo s to $TESTTMP/issue3781-dest/s
searching for changes
no changes found
searching for changes
no changes found
[1]
# clean the push cache
$ rm s/.hg/cache/storehash/*
$ hg push --config experimental.bundle2-exp=True
pushing to $TESTTMP/issue3781-dest (glob)
pushing subrepo s to $TESTTMP/issue3781-dest/s
searching for changes