comparison mercurial/commands.py @ 2731:ad4155e757da

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