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

login
register
mail settings
Submitter Ryan McElroy
Date April 19, 2017, 1:56 p.m.
Message ID <3fbe113a35b8686b08d5.1492610180@devbig314.prn1.facebook.com>
Download mbox | patch
Permalink /patch/20264/
State Accepted
Headers show

Comments

Ryan McElroy - April 19, 2017, 1:56 p.m.
# HG changeset patch
# User Ryan McElroy <rmcelroy@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
Jun Wu - April 19, 2017, 10:49 p.m.
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@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):
Sean Farley - April 20, 2017, 7:24 a.m.
Ryan McElroy <rm@fb.com> writes:

> # HG changeset patch
> # User Ryan McElroy <rmcelroy@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

Looks good. Queued.

Patch

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):