mercurial/commands.py
changeset 4478 b2b55acbacdd
parent 4474 08ae451148b2
child 4494 649dd2492ae5
equal deleted inserted replaced
4477:6cbfa740c129 4478:b2b55acbacdd
   334                     if p not in seen:
   334                     if p not in seen:
   335                         seen[p] = 1
   335                         seen[p] = 1
   336                         visit.append(p)
   336                         visit.append(p)
   337     else:
   337     else:
   338         setremoteconfig(ui, opts)
   338         setremoteconfig(ui, opts)
   339         dest = ui.expandpath(dest or 'default-push', dest or 'default')
   339         dest, revs = cmdutil.parseurl(
       
   340             ui.expandpath(dest or 'default-push', dest or 'default'), revs)
   340         other = hg.repository(ui, dest)
   341         other = hg.repository(ui, dest)
   341         o = repo.findoutgoing(other, force=opts['force'])
   342         o = repo.findoutgoing(other, force=opts['force'])
   342 
   343 
   343     if revs:
   344     if revs:
   344         cg = repo.changegroupsubset(o, revs, 'bundle')
   345         cg = repo.changegroupsubset(o, revs, 'bundle')
   405     .hg/hgrc and working directory will be created on the remote side.
   406     .hg/hgrc and working directory will be created on the remote side.
   406     Look at the help text for the pull command for important details
   407     Look at the help text for the pull command for important details
   407     about ssh:// URLs.
   408     about ssh:// URLs.
   408     """
   409     """
   409     setremoteconfig(ui, opts)
   410     setremoteconfig(ui, opts)
   410     hg.clone(ui, ui.expandpath(source), dest,
   411     hg.clone(ui, source, dest,
   411              pull=opts['pull'],
   412              pull=opts['pull'],
   412              stream=opts['uncompressed'],
   413              stream=opts['uncompressed'],
   413              rev=opts['rev'],
   414              rev=opts['rev'],
   414              update=not opts['noupdate'])
   415              update=not opts['noupdate'])
   415 
   416 
  1586     For remote repository, using --bundle avoids downloading the changesets
  1587     For remote repository, using --bundle avoids downloading the changesets
  1587     twice if the incoming is followed by a pull.
  1588     twice if the incoming is followed by a pull.
  1588 
  1589 
  1589     See pull for valid source format details.
  1590     See pull for valid source format details.
  1590     """
  1591     """
  1591     source = ui.expandpath(source)
  1592     source, revs = cmdutil.parseurl(ui.expandpath(source), opts['rev'])
  1592     setremoteconfig(ui, opts)
  1593     setremoteconfig(ui, opts)
  1593 
  1594 
  1594     other = hg.repository(ui, source)
  1595     other = hg.repository(ui, source)
  1595     ui.status(_('comparing with %s\n') % source)
  1596     ui.status(_('comparing with %s\n') % source)
  1596     revs = None
  1597     if revs:
  1597     if opts['rev']:
       
  1598         if 'lookup' in other.capabilities:
  1598         if 'lookup' in other.capabilities:
  1599             revs = [other.lookup(rev) for rev in opts['rev']]
  1599             revs = [other.lookup(rev) for rev in revs]
  1600         else:
  1600         else:
  1601             error = _("Other repository doesn't support revision lookup, so a rev cannot be specified.")
  1601             error = _("Other repository doesn't support revision lookup, so a rev cannot be specified.")
  1602             raise util.Abort(error)
  1602             raise util.Abort(error)
  1603     incoming = repo.findincoming(other, heads=revs, force=opts["force"])
  1603     incoming = repo.findincoming(other, heads=revs, force=opts["force"])
  1604     if not incoming:
  1604     if not incoming:
  1889     the default push location. These are the changesets that would be pushed
  1889     the default push location. These are the changesets that would be pushed
  1890     if a push was requested.
  1890     if a push was requested.
  1891 
  1891 
  1892     See pull for valid destination format details.
  1892     See pull for valid destination format details.
  1893     """
  1893     """
  1894     dest = ui.expandpath(dest or 'default-push', dest or 'default')
  1894     dest, revs = cmdutil.parseurl(
       
  1895         ui.expandpath(dest or 'default-push', dest or 'default'), opts['rev'])
  1895     setremoteconfig(ui, opts)
  1896     setremoteconfig(ui, opts)
  1896     revs = None
  1897     if revs:
  1897     if opts['rev']:
  1898         revs = [repo.lookup(rev) for rev in revs]
  1898         revs = [repo.lookup(rev) for rev in opts['rev']]
       
  1899 
  1899 
  1900     other = hg.repository(ui, dest)
  1900     other = hg.repository(ui, dest)
  1901     ui.status(_('comparing with %s\n') % dest)
  1901     ui.status(_('comparing with %s\n') % dest)
  1902     o = repo.findoutgoing(other, force=opts['force'])
  1902     o = repo.findoutgoing(other, force=opts['force'])
  1903     if not o:
  1903     if not o:
  1987     repositories or to bundle files (as created by 'hg bundle' or
  1987     repositories or to bundle files (as created by 'hg bundle' or
  1988     'hg incoming --bundle'). The static-http:// protocol, albeit slow,
  1988     'hg incoming --bundle'). The static-http:// protocol, albeit slow,
  1989     allows access to a Mercurial repository where you simply use a web
  1989     allows access to a Mercurial repository where you simply use a web
  1990     server to publish the .hg directory as static content.
  1990     server to publish the .hg directory as static content.
  1991 
  1991 
       
  1992     An optional identifier after # indicates a particular branch, tag,
       
  1993     or changeset to pull.
       
  1994 
  1992     Some notes about using SSH with Mercurial:
  1995     Some notes about using SSH with Mercurial:
  1993     - SSH requires an accessible shell account on the destination machine
  1996     - SSH requires an accessible shell account on the destination machine
  1994       and a copy of hg in the remote path or specified with as remotecmd.
  1997       and a copy of hg in the remote path or specified with as remotecmd.
  1995     - path is relative to the remote user's home directory by default.
  1998     - path is relative to the remote user's home directory by default.
  1996       Use an extra slash at the start of a path to specify an absolute path:
  1999       Use an extra slash at the start of a path to specify an absolute path:
  2002         Host *
  2005         Host *
  2003           Compression yes
  2006           Compression yes
  2004       Alternatively specify "ssh -C" as your ssh command in your hgrc or
  2007       Alternatively specify "ssh -C" as your ssh command in your hgrc or
  2005       with the --ssh command line option.
  2008       with the --ssh command line option.
  2006     """
  2009     """
  2007     source = ui.expandpath(source)
  2010     source, revs = cmdutil.parseurl(ui.expandpath(source), opts['rev'])
  2008     setremoteconfig(ui, opts)
  2011     setremoteconfig(ui, opts)
  2009 
  2012 
  2010     other = hg.repository(ui, source)
  2013     other = hg.repository(ui, source)
  2011     ui.status(_('pulling from %s\n') % (source))
  2014     ui.status(_('pulling from %s\n') % (source))
  2012     revs = None
  2015     if revs:
  2013     if opts['rev']:
       
  2014         if 'lookup' in other.capabilities:
  2016         if 'lookup' in other.capabilities:
  2015             revs = [other.lookup(rev) for rev in opts['rev']]
  2017             revs = [other.lookup(rev) for rev in revs]
  2016         else:
  2018         else:
  2017             error = _("Other repository doesn't support revision lookup, so a rev cannot be specified.")
  2019             error = _("Other repository doesn't support revision lookup, so a rev cannot be specified.")
  2018             raise util.Abort(error)
  2020             raise util.Abort(error)
       
  2021 
  2019     modheads = repo.pull(other, heads=revs, force=opts['force'])
  2022     modheads = repo.pull(other, heads=revs, force=opts['force'])
  2020     return postincoming(ui, repo, modheads, opts['update'])
  2023     return postincoming(ui, repo, modheads, opts['update'])
  2021 
  2024 
  2022 def push(ui, repo, dest=None, **opts):
  2025 def push(ui, repo, dest=None, **opts):
  2023     """push changes to the specified destination
  2026     """push changes to the specified destination
  2038       local/filesystem/path (or file://local/filesystem/path)
  2041       local/filesystem/path (or file://local/filesystem/path)
  2039       ssh://[user@]host[:port]/[path]
  2042       ssh://[user@]host[:port]/[path]
  2040       http://[user@]host[:port]/[path]
  2043       http://[user@]host[:port]/[path]
  2041       https://[user@]host[:port]/[path]
  2044       https://[user@]host[:port]/[path]
  2042 
  2045 
       
  2046     An optional identifier after # indicates a particular branch, tag,
       
  2047     or changeset to push.
       
  2048 
  2043     Look at the help text for the pull command for important details
  2049     Look at the help text for the pull command for important details
  2044     about ssh:// URLs.
  2050     about ssh:// URLs.
  2045 
  2051 
  2046     Pushing to http:// and https:// URLs is only possible, if this
  2052     Pushing to http:// and https:// URLs is only possible, if this
  2047     feature is explicitly enabled on the remote Mercurial server.
  2053     feature is explicitly enabled on the remote Mercurial server.
  2048     """
  2054     """
  2049     dest = ui.expandpath(dest or 'default-push', dest or 'default')
  2055     dest, revs = cmdutil.parseurl(
       
  2056         ui.expandpath(dest or 'default-push', dest or 'default'), opts['rev'])
  2050     setremoteconfig(ui, opts)
  2057     setremoteconfig(ui, opts)
  2051 
  2058 
  2052     other = hg.repository(ui, dest)
  2059     other = hg.repository(ui, dest)
  2053     ui.status('pushing to %s\n' % (dest))
  2060     ui.status('pushing to %s\n' % (dest))
  2054     revs = None
  2061     if revs:
  2055     if opts['rev']:
  2062         revs = [repo.lookup(rev) for rev in revs]
  2056         revs = [repo.lookup(rev) for rev in opts['rev']]
       
  2057     r = repo.push(other, opts['force'], revs=revs)
  2063     r = repo.push(other, opts['force'], revs=revs)
  2058     return r == 0
  2064     return r == 0
  2059 
  2065 
  2060 def rawcommit(ui, repo, *pats, **opts):
  2066 def rawcommit(ui, repo, *pats, **opts):
  2061     """raw commit interface (DEPRECATED)
  2067     """raw commit interface (DEPRECATED)