Mercurial > public > mercurial-scm > hg-stable
diff mercurial/exchange.py @ 40725:9b8d1ad851f8
push: add --publish flag to change phase of pushed changesets
This flag is copied from topic extension, where it proved to be useful. It
makes all pushed changesets public on both ends if the push succeeds.
Doesn't currently work for any subrepos that are implicitly pushed together
with their owner repo.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Sat, 27 Oct 2018 21:13:23 +0800 |
parents | 440f5b65be57 |
children | 33d30fb1e4ae |
line wrap: on
line diff
--- a/mercurial/exchange.py Mon Nov 19 17:19:54 2018 +0000 +++ b/mercurial/exchange.py Sat Oct 27 21:13:23 2018 +0800 @@ -359,7 +359,7 @@ """ def __init__(self, repo, remote, force=False, revs=None, newbranch=False, - bookmarks=(), pushvars=None): + bookmarks=(), publish=False, pushvars=None): # repo we push from self.repo = repo self.ui = repo.ui @@ -421,6 +421,8 @@ self.pkfailcb = {} # an iterable of pushvars or None self.pushvars = pushvars + # publish pushed changesets + self.publish = publish @util.propertycache def futureheads(self): @@ -478,7 +480,7 @@ def push(repo, remote, force=False, revs=None, newbranch=False, bookmarks=(), - opargs=None): + publish=False, opargs=None): '''Push outgoing changesets (limited by revs) from a local repository to remote. Return an integer: - None means nothing to push @@ -490,7 +492,7 @@ if opargs is None: opargs = {} pushop = pushoperation(repo, remote, force, revs, newbranch, bookmarks, - **pycompat.strkwargs(opargs)) + publish, **pycompat.strkwargs(opargs)) if pushop.remote.local(): missing = (set(pushop.repo.requirements) - pushop.remote.local().supported) @@ -630,7 +632,10 @@ # XXX Beware that revset break if droots is not strictly # XXX root we may want to ensure it is but it is costly fallback = list(unfi.set(revset, droots, pushop.fallbackheads)) - if not outgoing.missing: + if not pushop.remotephases.publishing and pushop.publish: + future = list(unfi.set('%ln and (not public() or %ln::)', + pushop.futureheads, droots)) + elif not outgoing.missing: future = fallback else: # adds changeset we are going to push as draft