share: allow dest to default to the basename of source
authorMatt Mackall <mpm@selenic.com>
Sat, 13 Jun 2009 18:16:44 -0500
changeset 8807 8bf6eb68ddaf
parent 8806 14a0bdd59848
child 8808 38305de95f1d
share: allow dest to default to the basename of source
hgext/share.py
mercurial/hg.py
--- 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, '')