changeset 8807:8bf6eb68ddaf

share: allow dest to default to the basename of source
author Matt Mackall <mpm@selenic.com>
date Sat, 13 Jun 2009 18:16:44 -0500
parents 14a0bdd59848
children 38305de95f1d
files hgext/share.py mercurial/hg.py
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/share.py	Sat Jun 13 18:08:51 2009 -0500
+++ b/hgext/share.py	Sat Jun 13 18:16:44 2009 -0500
@@ -9,7 +9,7 @@
 from mercurial.i18n import _
 from mercurial import hg, commands
 
-def share(ui, source, dest, noupdate=False):
+def share(ui, source, dest=None, noupdate=False):
     """create a new shared repository (experimental)
 
     Initialize a new repository and working directory that shares its
@@ -25,7 +25,7 @@
     "share":
     (share,
      [('U', 'noupdate', None, _('do not create a working copy'))],
-     _('[-U] SOURCE DEST')),
+     _('[-U] SOURCE [DEST]')),
 }
 
 commands.norepo += " share"
--- a/mercurial/hg.py	Sat Jun 13 18:08:51 2009 -0500
+++ b/mercurial/hg.py	Sat Jun 13 18:16:44 2009 -0500
@@ -81,12 +81,15 @@
         return path[5:]
     return path
 
-def share(ui, source, dest, update=True):
+def share(ui, source, dest=None, update=True):
     '''create a shared repository'''
 
     if not islocal(source):
         raise util.Abort(_('can only share local repositories'))
 
+    if not dest:
+        dest = os.path.basename(source)
+
     if isinstance(source, str):
         origsource = ui.expandpath(source)
         source, rev, checkout = parseurl(origsource, '')