[PATCH 2 of 2] cmdutil: factor out pushsubrepos

Augie Fackler raf at durin42.com
Thu Feb 19 14:42:44 CST 2015


On Tue, Feb 17, 2015 at 11:27:44AM -0500, Augie Fackler wrote:
> On Thu, Feb 12, 2015 at 12:41:05AM -0800, Ryan McElroy wrote:
> > # HG changeset patch
> > # User Ryan McElroy <rmcelroy at fb.com>
> > # Date 1423729275 28800
> > #      Thu Feb 12 00:21:15 2015 -0800
> > # Node ID ffd1a811f1c7c1998460e7bb64169183ad2c1657
> > # Parent  05e7d10145be0af89e1eb6cf70c56e97f81101ab
> > cmdutil: factor out pushsubrepos
>
> I tried to come up with a reason to not do this, but I couldn't. Queued.

I'm dropping these for the moment because they break these:

Failed test-propertycache.py: output changed and returned error code 1
Failed test-status-inprocess.py: output changed and returned error code 1
Failed test-module-imports.t: output changed

Please investigate and do a v2.

>
> >
> > In the remotenames extension, we replace large parts of the functionality of
> > the push command. By factoring out this code, we can call it from the extension
> > and avoid rewriting it in the extension.
> >
> > diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> > --- a/mercurial/cmdutil.py
> > +++ b/mercurial/cmdutil.py
> > @@ -2977,3 +2977,16 @@ def pushdest(ui, repo, dest, opts):
> >              raise
> >
> >      return (dest, branches, revs, other)
> > +
> > +def pushsubrepos(repo, dest, opts):
> > +    repo._subtoppath = dest
> > +    try:
> > +        # push subrepos depth-first for coherent ordering
> > +        c = repo['']
> > +        subs = c.substate # only repos that are committed
> > +        for s in sorted(subs):
> > +            result = c.sub(s).push(opts)
> > +            if result == 0:
> > +                return not result
> > +    finally:
> > +        del repo._subtoppath
> > diff --git a/mercurial/commands.py b/mercurial/commands.py
> > --- a/mercurial/commands.py
> > +++ b/mercurial/commands.py
> > @@ -5088,17 +5088,8 @@ def push(ui, repo, dest=None, **opts):
> >      if revs:
> >          revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)]
> >
> > -    repo._subtoppath = dest
> > -    try:
> > -        # push subrepos depth-first for coherent ordering
> > -        c = repo['']
> > -        subs = c.substate # only repos that are committed
> > -        for s in sorted(subs):
> > -            result = c.sub(s).push(opts)
> > -            if result == 0:
> > -                return not result
> > -    finally:
> > -        del repo._subtoppath
> > +    cmdutil.pushsubrepos(repo, dest, opts)
> > +
> >      pushop = exchange.push(repo, other, opts.get('force'), revs=revs,
> >                             newbranch=opts.get('new_branch'),
> >                             bookmarks=opts.get('bookmark', ()))
> > _______________________________________________
> > Mercurial-devel mailing list
> > Mercurial-devel at selenic.com
> > http://selenic.com/mailman/listinfo/mercurial-devel
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list