changeset 2494:73ac95671788

push, outgoing, bundle: fall back to "default" if "default-push" not defined
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Fri, 23 Jun 2006 18:09:44 -0700
parents 9c660e691e90
children 4a2a4d988ead
files mercurial/commands.py mercurial/ui.py
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -845,7 +845,7 @@ def backout(ui, repo, rev, **opts):
                         'do not forget to merge\n'))
             ui.status(_('(use "backout -m" if you want to auto-merge)\n'))
 
-def bundle(ui, repo, fname, dest="default-push", **opts):
+def bundle(ui, repo, fname, dest=None, **opts):
     """create a changegroup file
 
     Generate a compressed changegroup file collecting all changesets
@@ -860,7 +860,7 @@ def bundle(ui, repo, fname, dest="defaul
     Unlike import/export, this exactly preserves all changeset
     contents including permissions, rename data, and revision history.
     """
-    dest = ui.expandpath(dest)
+    dest = ui.expandpath(dest or 'default-push', dest or 'default')
     other = hg.repository(ui, dest)
     o = repo.findoutgoing(other, force=opts['force'])
     cg = repo.changegroup(o, 'bundle')
@@ -2047,7 +2047,7 @@ def merge(ui, repo, node=None, **opts):
     """
     return doupdate(ui, repo, node=node, merge=True, **opts)
 
-def outgoing(ui, repo, dest="default-push", **opts):
+def outgoing(ui, repo, dest=None, **opts):
     """show changesets not found in destination
 
     Show changesets not found in the specified destination repository or
@@ -2056,7 +2056,7 @@ def outgoing(ui, repo, dest="default-pus
 
     See pull for valid destination format details.
     """
-    dest = ui.expandpath(dest)
+    dest = ui.expandpath(dest or 'default-push', dest or 'default')
     if opts['ssh']:
         ui.setconfig("ui", "ssh", opts['ssh'])
     if opts['remotecmd']:
@@ -2179,7 +2179,7 @@ def pull(ui, repo, source="default", **o
     modheads = repo.pull(other, heads=revs, force=opts['force'])
     return postincoming(ui, repo, modheads, opts['update'])
 
-def push(ui, repo, dest="default-push", **opts):
+def push(ui, repo, dest=None, **opts):
     """push changes to the specified destination
 
     Push changes from the local repository to the given destination.
@@ -2201,7 +2201,7 @@ def push(ui, repo, dest="default-push", 
     Look at the help text for the pull command for important details
     about ssh:// URLs.
     """
-    dest = ui.expandpath(dest)
+    dest = ui.expandpath(dest or 'default-push', dest or 'default')
 
     if opts['ssh']:
         ui.setconfig("ui", "ssh", opts['ssh'])
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -197,12 +197,12 @@ class ui(object):
         if not self.verbose: user = util.shortuser(user)
         return user
 
-    def expandpath(self, loc):
+    def expandpath(self, loc, default=None):
         """Return repository location relative to cwd or from [paths]"""
         if loc.find("://") != -1 or os.path.exists(loc):
             return loc
 
-        return self.config("paths", loc, loc)
+        return self.config("paths", loc, default or loc)
 
     def write(self, *args):
         if self.header: