push, outgoing, bundle: fall back to "default" if "default-push" not defined
authorVadim Gelfer <vadim.gelfer@gmail.com>
Fri, 23 Jun 2006 18:09:44 -0700
changeset 2494 73ac95671788
parent 2493 9c660e691e90
child 2495 4a2a4d988ead
push, outgoing, bundle: fall back to "default" if "default-push" not defined
mercurial/commands.py
mercurial/ui.py
--- a/mercurial/commands.py	Fri Jun 23 17:33:10 2006 -0700
+++ b/mercurial/commands.py	Fri Jun 23 18:09:44 2006 -0700
@@ -845,7 +845,7 @@
                         '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 @@
     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 @@
     """
     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 @@
 
     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 @@
     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 @@
     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	Fri Jun 23 17:33:10 2006 -0700
+++ b/mercurial/ui.py	Fri Jun 23 18:09:44 2006 -0700
@@ -197,12 +197,12 @@
         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: