[PATCH 2 of 2] ui: path option to declare which revisions to push by default
Yuya Nishihara
yuya at tcha.org
Wed Dec 9 06:48:02 CST 2015
On Tue, 8 Dec 2015 18:56:22 -0800, Pierre-Yves David wrote:
> On 12/07/2015 12:03 AM, Gregory Szorc wrote:
> > # HG changeset patch
> > # User Gregory Szorc <gregory.szorc at gmail.com>
> > # Date 1449475003 28800
> > # Sun Dec 06 23:56:43 2015 -0800
> > # Node ID 645acc7913bf6832235f582ea5a90a1c7631586c
> > # Parent e9487562e005c6d112240199c023a0b6f79add2d
> > ui: path option to declare which revisions to push by default
> >
> > Now that we have a mechanism for declaring path sub-options, we can
> > start to pile on features!
> >
> > Many power users have expressed frustration that bare `hg push`
> > attempts to push all local revisions to the remote. This patch
> > introduces the "pushrev" path sub-option to control which revisions
> > are pushed when no "-r" argument is specified.
> >
> > The value of this sub-option is a revset, naturally.
> >
> > A future feature addition could potentially introduce a "pushnames"
> > sub-options that declares the list of names (branches, bookmarks,
> > topics, etc) to push by default. The entire "what to push by default"
> > feature should probably be considered before this patch lands.
>
> You mean something more generic than: mybranch+mybookmark+mytopic
> because branch and topic can have multiple heads?
>
> > diff --git a/mercurial/commands.py b/mercurial/commands.py
> > --- a/mercurial/commands.py
> > +++ b/mercurial/commands.py
> > @@ -5647,16 +5647,24 @@ def push(ui, repo, dest=None, **opts):
> > revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
> > other = hg.peer(repo, opts, dest)
> >
> > if revs:
> > revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)]
> > if not revs:
> > raise error.Abort(_("specified revisions evaluate to an empty set"),
> > hint=_("use different revision arguments"))
> > + elif path.pushrev:
> > + # It doesn't make any sense to specify ancestor revisions. So limit
> > + # to DAG heads to make discovery simpler.
> > + revs = repo.revs('heads(%s)' % path.pushrev)
>
> You are looking for `repo.revs('heads(%r)', path.pushrev)` revset have
> special %X logic.
repo.revs() shouldn't be used for user input because it ignores revsetalias.
More information about the Mercurial-devel
mailing list