Patchwork [4,of,6,remotenames-ext] push: do not over-check for svn/git push targets

login
register
mail settings
Submitter Ryan McElroy
Date Feb. 19, 2018, 11:53 a.m.
Message ID <b1949aca17c6456ba1a7.1519041221@devbig314.prn1.facebook.com>
Download mbox | patch
Permalink /patch/28149/
State New
Headers show

Comments

Ryan McElroy - Feb. 19, 2018, 11:53 a.m.
# HG changeset patch
# User Ryan McElroy <rmcelroy@fb.com>
# Date 1519041052 28800
#      Mon Feb 19 03:50:52 2018 -0800
# Node ID b1949aca17c6456ba1a7599e9ca121d269fb1ce6
# Parent  50ca5e43b0b816aeabcfd50b09dd9728c02dac86
push: do not over-check for svn/git push targets

Previously, if the user had an svn or git push target set up, we would
bail from the normal push --to process even if the users were pushing to a
different location. This is silly. Instead, let's only bail if the user is
actually pushing to an svn or git destination repository.

Patch

diff --git a/remotenames.py b/remotenames.py
--- a/remotenames.py
+++ b/remotenames.py
@@ -1040,6 +1040,12 @@  def expushcmd(orig, ui, repo, dest=None,
             # 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)
+            # Once we have found the path where we are pushing, do not continue
+            # checking for places we are not pushing.
+            break
+        if dest:
+            # If an explicit destination was checked, also stop checking here.
+            break
 
     if not opargs['to']:
         if ui.configbool('remotenames', 'forceto', False):
diff --git a/tests/test-remotenames-pushto-pathandname.t b/tests/test-remotenames-pushto-pathandname.t
--- a/tests/test-remotenames-pushto-pathandname.t
+++ b/tests/test-remotenames-pushto-pathandname.t
@@ -48,6 +48,7 @@  Set up an svn default push path and test
   $ hg push --to foo ../orig
   pushing rev 71b4c8f22183 to destination ../orig bookmark foo
   searching for changes
-  abort: no bookmark found to push
+  abort: not creating new remote bookmark
+  (use --create to create a new bookmark)
   [255]