[PATCH 6 of 6 RFC] push: allow specifying default-push as defaultpush

Augie Fackler raf at durin42.com
Fri Aug 2 09:15:05 CDT 2013


# HG changeset patch
# User Augie Fackler <durin42 at gmail.com>
# Date 1374709814 14400
#      Wed Jul 24 19:50:14 2013 -0400
# Node ID d59a05f3c4e013ecf9c7d3b40c04fa9900b7f74f
# Parent  4c9c2538d46bed89734a465ae01dbda483154425
push: allow specifying default-push as defaultpush

diff --git a/hgext/largefiles/basestore.py b/hgext/largefiles/basestore.py
--- a/hgext/largefiles/basestore.py
+++ b/hgext/largefiles/basestore.py
@@ -173,10 +173,10 @@
         else:
             path = ui.expandpath('default-push', 'default')
 
-        # ui.expandpath() leaves 'default-push' and 'default' alone if
-        # they cannot be expanded: fallback to the empty string,
-        # meaning the current directory.
-        if path == 'default-push' or path == 'default':
+        # ui.expandpath() leaves 'defaultpush', 'default-push' and
+        # 'default' alone if they cannot be expanded: fallback to the
+        # empty string, meaning the current directory.
+        if path in ('default-push', 'defaultpush', 'default'):
             path = ''
             remote = repo
         else:
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4403,14 +4403,14 @@
     configuration file and in ``/etc/mercurial/hgrc``. If run inside a
     repository, ``.hg/hgrc`` is used, too.
 
-    The path names ``default`` and ``default-push`` have a special
+    The path names ``default`` and ``defaultpush`` have a special
     meaning.  When performing a push or pull operation, they are used
     as fallbacks if no location is specified on the command-line.
-    When ``default-push`` is set, it will be used for push and
+    When ``defaultpush`` is set, it will be used for push and
     ``default`` will be used for pull; otherwise ``default`` is used
     as the fallback for both.  When cloning a repository, the clone
     source is written as ``default`` in ``.hg/hgrc``.  Note that
-    ``default`` and ``default-push`` apply to all inbound (e.g.
+    ``default`` and ``defaultpush`` apply to all inbound (e.g.
     :hg:`incoming`) and outbound (e.g. :hg:`outgoing`, :hg:`email` and
     :hg:`bundle`) operations.
 
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -285,8 +285,8 @@
     else: # recursion reached top repo
         if util.safehasattr(repo, '_subtoppath'):
             return repo._subtoppath
-        if push and repo.ui.config('paths', 'default-push'):
-            return repo.ui.config('paths', 'default-push')
+        if push and repo.ui.config('paths', ['defaultpush', 'default-push']):
+            return repo.ui.config('paths', ['defaultpush', 'default-push'])
         if repo.ui.config('paths', 'default'):
             return repo.ui.config('paths', 'default')
         if repo.sharedpath != repo.path:
@@ -543,7 +543,7 @@
             defpushpath = _abssource(self._repo, True, abort=False)
             addpathconfig('default', defpath)
             if defpath != defpushpath:
-                addpathconfig('default-push', defpushpath)
+                addpathconfig('defaultpush', defpushpath)
             fp.close()
 
     @annotatesubrepoerror
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -465,9 +465,13 @@
         if util.hasscheme(loc) or os.path.isdir(os.path.join(loc, '.hg')):
             return loc
 
+        if loc in ('defaultpush', 'default-push'):
+            loc = ['defaultpush', 'default-push']
         path = self.config('paths', loc)
         if not path and default is not None:
             path = self.config('paths', default)
+        if isinstance(loc, list):
+            loc = loc[0]
         return path or loc
 
     def pushbuffer(self):
diff --git a/tests/test-bundle-r.t b/tests/test-bundle-r.t
--- a/tests/test-bundle-r.t
+++ b/tests/test-bundle-r.t
@@ -162,7 +162,7 @@
   abort: --base is incompatible with specifying a destination
   [255]
   $ hg -R test bundle -r tip test-bundle-branch1.hg
-  abort: repository default-push not found!
+  abort: repository defaultpush not found!
   [255]
 
   $ hg -R test bundle --base 2 -r tip test-bundle-branch1.hg


More information about the Mercurial-devel mailing list