# HG changeset patch # User Matt Mackall # Date 2009-06-13 23:16:44 # Node ID 8bf6eb68ddaf1e6b8fa9247d9071f9458e66a6b6 # Parent 14a0bdd59848859ed879c2702b2f0c4d611a8db5 share: allow dest to default to the basename of source diff --git a/hgext/share.py b/hgext/share.py --- a/hgext/share.py +++ b/hgext/share.py @@ -9,7 +9,7 @@ import os 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 @@ cmdtable = { "share": (share, [('U', 'noupdate', None, _('do not create a working copy'))], - _('[-U] SOURCE DEST')), + _('[-U] SOURCE [DEST]')), } commands.norepo += " share" diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -81,12 +81,15 @@ def localpath(path): 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, '')