comparison mercurial/localrepo.py @ 18520:751135cca13c stable

subrepo: allows to drop courtesy phase sync (issue3781) Publishing server may contains draft changeset when they are created locally. As publishing is the default, it is actually fairly common. Because of this "inconsistency" phases synchronization may be done even to publishing server. This may cause severe issues for subrepo. It is possible to reference read-only repository as subrepo. Push in a super repo recursively push subrepo. Those pushes to potential read only repo are not optional, they are "suffered" not "choosed". This does not break because as the repo is untouched the push is supposed to be empty. If the reference repo locally contains draft changesets, a courtesy push is triggered to turn them public. As the repo is read only, the push fails (after possible prompt asking for credential). Failure of the sub-push aborts the whole subrepo push. This force the user to define a custom default-push for such subrepo. This changeset introduce a prevention of this error client side by skipping the courtesy phase synchronisation in problematic situation. The phases synchronisation is skipped when four conditions are gathered: - this is a subrepo push, (normal push to read-only repo) - and remote support phase - and remote is publishing - and no changesets was pushed (if we pushed changesets, repo is not read only) The internal config option used in this version is not definitive. It is here to demonstrate a working fix to the issue. In the future we probably wants to track subrepo changes and avoid pushing to untouched one. That will prevent any attempt to push to read-only or unreachable subrepo. Another fix to prevent courtesy push from older clients to push to newer server is also still needed.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Thu, 31 Jan 2013 01:44:29 +0100
parents 4d9f7dd2ac82
children 3e92772d5383 5b7175377bab
comparison
equal deleted inserted replaced
18519:ca430fb6a668 18520:751135cca13c
1872 outgoing.commonheads, 1872 outgoing.commonheads,
1873 outgoing.missing) 1873 outgoing.missing)
1874 cheads.extend(c.node() for c in revset) 1874 cheads.extend(c.node() for c in revset)
1875 # even when we don't push, exchanging phase data is useful 1875 # even when we don't push, exchanging phase data is useful
1876 remotephases = remote.listkeys('phases') 1876 remotephases = remote.listkeys('phases')
1877 if (self.ui.configbool('ui', '_usedassubrepo', False)
1878 and remotephases # server supports phases
1879 and ret is None # nothing was pushed
1880 and remotephases.get('publishing', False)):
1881 # When:
1882 # - this is a subrepo push
1883 # - and remote support phase
1884 # - and no changeset was pushed
1885 # - and remote is publishing
1886 # We may be in issue 3871 case!
1887 # We drop the possible phase synchronisation done by
1888 # courtesy to publish changesets possibly locally draft
1889 # on the remote.
1890 remotephases = {'publishing': 'True'}
1877 if not remotephases: # old server or public only repo 1891 if not remotephases: # old server or public only repo
1878 phases.advanceboundary(self, phases.public, cheads) 1892 phases.advanceboundary(self, phases.public, cheads)
1879 # don't push any phase data as there is nothing to push 1893 # don't push any phase data as there is nothing to push
1880 else: 1894 else:
1881 ana = phases.analyzeremotephases(self, cheads, remotephases) 1895 ana = phases.analyzeremotephases(self, cheads, remotephases)