[PATCH hglib] client: add rebase support to client.pull (issue4644)

Yuya Nishihara yuya at tcha.org
Fri Apr 8 09:50:23 EDT 2016


On Wed, 06 Apr 2016 15:51:05 +0200, Axel Hecht wrote:
> # HG changeset patch
> # User Axel Hecht <axel at pike.org>
> # Date 1442331213 -7200
> #      Tue Sep 15 17:33:33 2015 +0200
> # Node ID 98efa416f763d5f408244baeaf6ab5e2fc4fd756
> # Parent  3478adf2394ad27a4b501c91bbdae8157f06dd10
> client: add rebase support to client.pull (issue4644)
> 
> Add options to pull to use --rebase. As that's supported only via the
> rebase extension, make sure the extension is enable by passing in a
> config option.
> 
> diff --git a/hglib/client.py b/hglib/client.py
> --- a/hglib/client.py
> +++ b/hglib/client.py
> @@ -1187,7 +1187,7 @@
>  
>      def pull(self, source=None, rev=None, update=False, force=False,
>               bookmark=None, branch=None, ssh=None, remotecmd=None,
> -             insecure=False, tool=None):
> +             insecure=False, rebase=False, tool=None):
>          """Pull changes from a remote repository.
>  
>          This finds all changes from the repository specified by source
> @@ -1207,13 +1207,19 @@
>          remotecmd - specify hg command to run on the remote side
>          insecure - do not verify server certificate (ignoring
>           web.cacerts config)
> +        rebase - rebase working directory to branch head
>          tool - specify merge tool for rebase
>  
>          """
> -        args = cmdbuilder(b('pull'), source, r=rev, u=update, f=force,
> +        if rebase:
> +            # make sure the rebase extension is enabled
> +            config = [b('--config'), b('extensions.rebase=')]
> +        else:
> +            config = []

I don't think it's the right way to support --rebase option. Extensions
shouldn't be enabled implicitly, and not all extensions could be enabled
in that way.

> +        args = cmdbuilder(b('pull'), source, *config, r=rev, u=update, f=force,

Better to write config=['extensions.rebase='] ?

*args should be positional arguments, but cmdbuilder() doesn't insert '--'
before positional arguments, which seems like a bug.


More information about the Mercurial-devel mailing list