This is an archive of the discontinued Mercurial Phabricator instance.

streamclone: preserve remote phases (issue5648)
Needs RevisionPublic

Authored by indygreg on Dec 24 2017, 1:06 PM.

Details

Reviewers
yuja
Group Reviewers
hg-reviewers
Summary

As the tests added by the previous changeset demonstrate, stream clones
were never taught about the existence of phases. As a result, all
changesets applied via stream clone were made public, even if they
were draft (or even secret) on the remote.

This commit integrates phases knowledge into stream clones.

As the inline comment explains, because there are scenarios where
we can't disambiguate phases support, the resulting phase data may
not match the server exactly. However, I believe the remaining
areas of buggy behavior are confined to secret changesets. Secret
changesets aren't common. And transferring them via stream clones
either requires a buggy Mercurial server or a specially-configured
server. I think it will require stream clone support in bundle2
before we can properly handle secret phases for stream clones.

It /might/ be acceptable to force all local changesets to secret
and then promote to draft or public from remote phases data. However,
I was having trouble implementing this. Existing phases code doesn't
seem geared towards supporting this scenario and I didn't want to
incur a lot of extra work to refactor the phases code. Perfect is
the enemy of good: I'm inclined to tackle secret phase as part of
supporting stream clones in bundle2.

This change introduces a roots(all()) revset, which will require
a linear scan of the changelog during clone bundles. On a Firefox
repo, this may slow down stream clones by ~1s. Again, support for
stream clones in bundle2 should help here.

.. fix::

Draft changeset phase is now preserved during a stream clone.

Before, all changesets pulled via a stream clone would have a
public phase, even if they were draft on the remote and the remote
was non-publishing.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

indygreg created this revision.Dec 24 2017, 1:06 PM
yuja requested changes to this revision.Dec 26 2017, 8:05 AM
yuja added a subscriber: yuja.
yuja added inline comments.
mercurial/streamclone.py
191

Shouldn't we test remotephases.get('publishing', False) for
mixed-phase + publishing server?

200

It seems odd that remotephases data aren't used at all, but
I'm not sure.

This revision now requires changes to proceed.Dec 26 2017, 8:05 AM
indygreg added inline comments.Dec 27 2017, 1:34 PM
mercurial/streamclone.py
191

Maybe.

My reasoning here was that if the remote advertises phases data, then it is phases aware and the code below will ensure phases are adjusted appropriately. We certainly could special case the mixed phase + publishing case and skip all phase adjustment.

yuja added inline comments.Dec 28 2017, 8:14 AM
mercurial/streamclone.py
191

Perhaps the remote sends back actual phases data even if it is a publishing server.
That's probably why exchange._pullapplyphases() checks 'publishing' flag.