mercurial/commands.py
changeset 2739 3248aa10b388
parent 2735 eb1bde9560bc
parent 2738 ad4155e757da
child 2741 ae5ce3454ef5
equal deleted inserted replaced
2737:400a4a502001 2739:3248aa10b388
   545         except SyntaxError, inst:
   545         except SyntaxError, inst:
   546             raise util.Abort(inst.args[0])
   546             raise util.Abort(inst.args[0])
   547         if tmpl: t.use_template(tmpl)
   547         if tmpl: t.use_template(tmpl)
   548         return t
   548         return t
   549     return changeset_printer(ui, repo)
   549     return changeset_printer(ui, repo)
       
   550 
       
   551 def setremoteconfig(ui, opts):
       
   552     "copy remote options to ui tree"
       
   553     if opts.get('ssh'):
       
   554         ui.setconfig("ui", "ssh", opts['ssh'])
       
   555     if opts.get('remotecmd'):
       
   556         ui.setconfig("ui", "remotecmd", opts['remotecmd'])
   550 
   557 
   551 def show_version(ui):
   558 def show_version(ui):
   552     """output version and copyright information"""
   559     """output version and copyright information"""
   553     ui.write(_("Mercurial Distributed SCM (version %s)\n")
   560     ui.write(_("Mercurial Distributed SCM (version %s)\n")
   554              % version.get_version())
   561              % version.get_version())
   980 
   987 
   981     It is possible to specify an ssh:// URL as the destination, but no
   988     It is possible to specify an ssh:// URL as the destination, but no
   982     .hg/hgrc will be created on the remote side. Look at the help text
   989     .hg/hgrc will be created on the remote side. Look at the help text
   983     for the pull command for important details about ssh:// URLs.
   990     for the pull command for important details about ssh:// URLs.
   984     """
   991     """
   985     ui.setconfig_remoteopts(**opts)
   992     setremoteconfig(ui, opts)
   986     hg.clone(ui, ui.expandpath(source), dest,
   993     hg.clone(ui, ui.expandpath(source), dest,
   987              pull=opts['pull'],
   994              pull=opts['pull'],
   988              stream=opts['uncompressed'],
   995              stream=opts['uncompressed'],
   989              rev=opts['rev'],
   996              rev=opts['rev'],
   990              update=not opts['noupdate'])
   997              update=not opts['noupdate'])
  1825     twice if the incoming is followed by a pull.
  1832     twice if the incoming is followed by a pull.
  1826 
  1833 
  1827     See pull for valid source format details.
  1834     See pull for valid source format details.
  1828     """
  1835     """
  1829     source = ui.expandpath(source)
  1836     source = ui.expandpath(source)
  1830     ui.setconfig_remoteopts(**opts)
  1837     setremoteconfig(ui, opts)
  1831 
  1838 
  1832     other = hg.repository(ui, source)
  1839     other = hg.repository(ui, source)
  1833     incoming = repo.findincoming(other, force=opts["force"])
  1840     incoming = repo.findincoming(other, force=opts["force"])
  1834     if not incoming:
  1841     if not incoming:
  1835         ui.status(_("no changes found\n"))
  1842         ui.status(_("no changes found\n"))
  1881 
  1888 
  1882     It is possible to specify an ssh:// URL as the destination.
  1889     It is possible to specify an ssh:// URL as the destination.
  1883     Look at the help text for the pull command for important details
  1890     Look at the help text for the pull command for important details
  1884     about ssh:// URLs.
  1891     about ssh:// URLs.
  1885     """
  1892     """
  1886     ui.setconfig_remoteopts(**opts)
  1893     setremoteconfig(ui, opts)
  1887     hg.repository(ui, dest, create=1)
  1894     hg.repository(ui, dest, create=1)
  1888 
  1895 
  1889 def locate(ui, repo, *pats, **opts):
  1896 def locate(ui, repo, *pats, **opts):
  1890     """locate files matching specific patterns
  1897     """locate files matching specific patterns
  1891 
  1898 
  2059     if a push was requested.
  2066     if a push was requested.
  2060 
  2067 
  2061     See pull for valid destination format details.
  2068     See pull for valid destination format details.
  2062     """
  2069     """
  2063     dest = ui.expandpath(dest or 'default-push', dest or 'default')
  2070     dest = ui.expandpath(dest or 'default-push', dest or 'default')
  2064     ui.setconfig_remoteopts(**opts)
  2071     setremoteconfig(ui, opts)
  2065     revs = None
  2072     revs = None
  2066     if opts['rev']:
  2073     if opts['rev']:
  2067         revs = [repo.lookup(rev) for rev in opts['rev']]
  2074         revs = [repo.lookup(rev) for rev in opts['rev']]
  2068 
  2075 
  2069     other = hg.repository(ui, dest)
  2076     other = hg.repository(ui, dest)
  2181           Compression on
  2188           Compression on
  2182       Alternatively specify "ssh -C" as your ssh command in your hgrc or
  2189       Alternatively specify "ssh -C" as your ssh command in your hgrc or
  2183       with the --ssh command line option.
  2190       with the --ssh command line option.
  2184     """
  2191     """
  2185     source = ui.expandpath(source)
  2192     source = ui.expandpath(source)
  2186     ui.setconfig_remoteopts(**opts)
  2193     setremoteconfig(ui, opts)
  2187 
  2194 
  2188     other = hg.repository(ui, source)
  2195     other = hg.repository(ui, source)
  2189     ui.status(_('pulling from %s\n') % (source))
  2196     ui.status(_('pulling from %s\n') % (source))
  2190     revs = None
  2197     revs = None
  2191     if opts['rev'] and not other.local():
  2198     if opts['rev'] and not other.local():
  2219 
  2226 
  2220     Pushing to http:// and https:// URLs is possible, too, if this
  2227     Pushing to http:// and https:// URLs is possible, too, if this
  2221     feature is enabled on the remote Mercurial server.
  2228     feature is enabled on the remote Mercurial server.
  2222     """
  2229     """
  2223     dest = ui.expandpath(dest or 'default-push', dest or 'default')
  2230     dest = ui.expandpath(dest or 'default-push', dest or 'default')
  2224     ui.setconfig_remoteopts(**opts)
  2231     setremoteconfig(ui, opts)
  2225 
  2232 
  2226     other = hg.repository(ui, dest)
  2233     other = hg.repository(ui, dest)
  2227     ui.status('pushing to %s\n' % (dest))
  2234     ui.status('pushing to %s\n' % (dest))
  2228     revs = None
  2235     revs = None
  2229     if opts['rev']:
  2236     if opts['rev']: