[PATCH [RFC]] push: propagate --new_branch option when pushing subrepos

Martin Geisler mg at lazybytes.net
Thu Sep 29 13:26:31 CDT 2011

Angel Ezquerra <angel.ezquerra at gmail.com> writes:

> # HG changeset patch
> # User Angel Ezquerra <angel.ezquerra at gmail.com>
> # Date 1317309604 -7200
> # Node ID e6eb3657e327c3e60f042f4cdf77cfb90c4735ac
> # Parent  8df4166b6f634b305934fdd49c0e0ae64184d4ed
> push: propagate --new_branch option when pushing subrepos

The flag is called --new-branch with a hyphen, and this is then turned
into an underscore in the code because '-' is not valid in a Python
identifier (the name is used as an identifier when it's used directly as
a keyword argument).

> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -4077,7 +4077,7 @@
>          c = repo['']
>          subs = c.substate # only repos that are committed
>          for s in sorted(subs):
> -            if not c.sub(s).push(opts.get('force')):
> +            if not c.sub(s).push(opts.get('force'), opts.get('new_branch')):

I think it would make sense to propagate the entire opts dictionary
instead. That would be a bigger chance, but it would mean that things
like --ssh and --remotecmd are also propagated.

Martin Geisler

Mercurial links: http://mercurial.ch/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20110929/11fb2e6c/attachment.pgp>

More information about the Mercurial-devel mailing list