[PATCH remotenames-ext] push: better job checking for git or svn path

Jun Wu quark at fb.com
Wed Apr 19 18:49:56 EDT 2017


Looks good to me.

Excerpts from Ryan McElroy's message of 2017-04-19 06:56:20 -0700:
> # HG changeset patch
> # User Ryan McElroy <rmcelroy at fb.com>
> # Date 1492609910 25200
> #      Wed Apr 19 06:51:50 2017 -0700
> # Node ID 3fbe113a35b8686b08d5288f8be8eeeeace9ef9a
> # Parent  e3d4101c550fbbcc5089109f078be905b9d729de
> push: better job checking for git or svn path
> 
> diff --git a/remotenames.py b/remotenames.py
> --- a/remotenames.py
> +++ b/remotenames.py
> @@ -951,14 +951,13 @@ def expushcmd(orig, ui, repo, dest=None,
>      if not origdest and dest == 'default' and 'default-push' in paths:
>          dest = 'default-push'
>  
> -    try:
> -        # hgsubversion and hggit do funcky things on push. Just call it
> -        # directly
> -        path = paths[dest]
> -        if path.startswith('svn+') or path.startswith('git+'):
> -            return orig(ui, repo, dest, opargs=opargs, **opts)
> -    except KeyError:
> -        pass
> +    # get the actual path we will push to so we can do some url sniffing
> +    for check in [dest, 'default-push', 'default']:
> +        if check in paths:
> +            path = paths[check]
> +            # hgsubversion and hggit do funky things on push. Just call direct.
> +            if path.startswith('svn+') or path.startswith('git+'):
> +                return orig(ui, repo, dest, opargs=opargs, **opts)
>  
>      if not opargs['to']:
>          if ui.configbool('remotenames', 'forceto', False):


More information about the Mercurial-devel mailing list