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.
--- a/mercurial/exchange.py Tue May 26 23:06:17 2015 -0700
+++ b/mercurial/exchange.py Wed May 27 06:08:14 2015 -0700
@@ -305,6 +305,20 @@
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)
--- a/tests/test-subrepo.t Tue May 26 23:06:17 2015 -0700
+++ b/tests/test-subrepo.t Wed May 27 06:08:14 2015 -0700
@@ -1490,7 +1490,17 @@
> [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