##// END OF EJS Templates
Add ui method to set --ssh/--remotecmd, use it in init/clone/pull/push/in/out....
Thomas Arendsen Hein -
r2598:b898afee default
parent child Browse files
Show More
@@ -956,11 +956,7 b' def clone(ui, source, dest=None, **opts)'
956 .hg/hgrc will be created on the remote side. Look at the help text
956 .hg/hgrc will be created on the remote side. Look at the help text
957 for the pull command for important details about ssh:// URLs.
957 for the pull command for important details about ssh:// URLs.
958 """
958 """
959 if opts['ssh']:
959 ui.setconfig_remoteopts(**opts)
960 ui.setconfig("ui", "ssh", opts['ssh'])
961 if opts['remotecmd']:
962 ui.setconfig("ui", "remotecmd", opts['remotecmd'])
963
964 hg.clone(ui, ui.expandpath(source), dest,
960 hg.clone(ui, ui.expandpath(source), dest,
965 pull=opts['pull'],
961 pull=opts['pull'],
966 rev=opts['rev'],
962 rev=opts['rev'],
@@ -1818,10 +1814,7 b' def incoming(ui, repo, source="default",'
1818 See pull for valid source format details.
1814 See pull for valid source format details.
1819 """
1815 """
1820 source = ui.expandpath(source)
1816 source = ui.expandpath(source)
1821 if opts['ssh']:
1817 ui.setconfig_remoteopts(**opts)
1822 ui.setconfig("ui", "ssh", opts['ssh'])
1823 if opts['remotecmd']:
1824 ui.setconfig("ui", "remotecmd", opts['remotecmd'])
1825
1818
1826 other = hg.repository(ui, source)
1819 other = hg.repository(ui, source)
1827 incoming = repo.findincoming(other, force=opts["force"])
1820 incoming = repo.findincoming(other, force=opts["force"])
@@ -1865,7 +1858,7 b' def incoming(ui, repo, source="default",'
1865 if cleanup:
1858 if cleanup:
1866 os.unlink(cleanup)
1859 os.unlink(cleanup)
1867
1860
1868 def init(ui, dest="."):
1861 def init(ui, dest=".", **opts):
1869 """create a new repository in the given directory
1862 """create a new repository in the given directory
1870
1863
1871 Initialize a new repository in the given directory. If the given
1864 Initialize a new repository in the given directory. If the given
@@ -1877,6 +1870,7 b' def init(ui, dest="."):'
1877 Look at the help text for the pull command for important details
1870 Look at the help text for the pull command for important details
1878 about ssh:// URLs.
1871 about ssh:// URLs.
1879 """
1872 """
1873 ui.setconfig_remoteopts(**opts)
1880 hg.repository(ui, dest, create=1)
1874 hg.repository(ui, dest, create=1)
1881
1875
1882 def locate(ui, repo, *pats, **opts):
1876 def locate(ui, repo, *pats, **opts):
@@ -2054,10 +2048,7 b' def outgoing(ui, repo, dest=None, **opts'
2054 See pull for valid destination format details.
2048 See pull for valid destination format details.
2055 """
2049 """
2056 dest = ui.expandpath(dest or 'default-push', dest or 'default')
2050 dest = ui.expandpath(dest or 'default-push', dest or 'default')
2057 if opts['ssh']:
2051 ui.setconfig_remoteopts(**opts)
2058 ui.setconfig("ui", "ssh", opts['ssh'])
2059 if opts['remotecmd']:
2060 ui.setconfig("ui", "remotecmd", opts['remotecmd'])
2061 revs = None
2052 revs = None
2062 if opts['rev']:
2053 if opts['rev']:
2063 revs = [repo.lookup(rev) for rev in opts['rev']]
2054 revs = [repo.lookup(rev) for rev in opts['rev']]
@@ -2164,11 +2155,7 b' def pull(ui, repo, source="default", **o'
2164 with the --ssh command line option.
2155 with the --ssh command line option.
2165 """
2156 """
2166 source = ui.expandpath(source)
2157 source = ui.expandpath(source)
2167
2158 ui.setconfig_remoteopts(**opts)
2168 if opts['ssh']:
2169 ui.setconfig("ui", "ssh", opts['ssh'])
2170 if opts['remotecmd']:
2171 ui.setconfig("ui", "remotecmd", opts['remotecmd'])
2172
2159
2173 other = hg.repository(ui, source)
2160 other = hg.repository(ui, source)
2174 ui.status(_('pulling from %s\n') % (source))
2161 ui.status(_('pulling from %s\n') % (source))
@@ -2206,11 +2193,7 b' def push(ui, repo, dest=None, **opts):'
2206 feature is enabled on the remote Mercurial server.
2193 feature is enabled on the remote Mercurial server.
2207 """
2194 """
2208 dest = ui.expandpath(dest or 'default-push', dest or 'default')
2195 dest = ui.expandpath(dest or 'default-push', dest or 'default')
2209
2196 ui.setconfig_remoteopts(**opts)
2210 if opts['ssh']:
2211 ui.setconfig("ui", "ssh", opts['ssh'])
2212 if opts['remotecmd']:
2213 ui.setconfig("ui", "remotecmd", opts['remotecmd'])
2214
2197
2215 other = hg.repository(ui, dest)
2198 other = hg.repository(ui, dest)
2216 ui.status('pushing to %s\n' % (dest))
2199 ui.status('pushing to %s\n' % (dest))
@@ -3013,7 +2996,12 b' table = {'
3013 _('specify hg command to run on the remote side'))],
2996 _('specify hg command to run on the remote side'))],
3014 _('hg incoming [-p] [-n] [-M] [-r REV]...'
2997 _('hg incoming [-p] [-n] [-M] [-r REV]...'
3015 ' [--bundle FILENAME] [SOURCE]')),
2998 ' [--bundle FILENAME] [SOURCE]')),
3016 "^init": (init, [], _('hg init [DEST]')),
2999 "^init":
3000 (init,
3001 [('e', 'ssh', '', _('specify ssh command to use')),
3002 ('', 'remotecmd', '',
3003 _('specify hg command to run on the remote side'))],
3004 _('hg init [-e FILE] [--remotecmd FILE] [DEST]')),
3017 "locate":
3005 "locate":
3018 (locate,
3006 (locate,
3019 [('r', 'rev', '', _('search the repository as it stood at rev')),
3007 [('r', 'rev', '', _('search the repository as it stood at rev')),
@@ -3074,7 +3062,7 b' table = {'
3074 ('r', 'rev', [], _('a specific revision you would like to pull')),
3062 ('r', 'rev', [], _('a specific revision you would like to pull')),
3075 ('', 'remotecmd', '',
3063 ('', 'remotecmd', '',
3076 _('specify hg command to run on the remote side'))],
3064 _('specify hg command to run on the remote side'))],
3077 _('hg pull [-u] [-e FILE] [-r REV]... [--remotecmd FILE] [SOURCE]')),
3065 _('hg pull [-u] [-r REV]... [-e FILE] [--remotecmd FILE] [SOURCE]')),
3078 "^push":
3066 "^push":
3079 (push,
3067 (push,
3080 [('f', 'force', None, _('force push')),
3068 [('f', 'force', None, _('force push')),
@@ -3082,7 +3070,7 b' table = {'
3082 ('r', 'rev', [], _('a specific revision you would like to push')),
3070 ('r', 'rev', [], _('a specific revision you would like to push')),
3083 ('', 'remotecmd', '',
3071 ('', 'remotecmd', '',
3084 _('specify hg command to run on the remote side'))],
3072 _('specify hg command to run on the remote side'))],
3085 _('hg push [-f] [-e FILE] [-r REV]... [--remotecmd FILE] [DEST]')),
3073 _('hg push [-f] [-r REV]... [-e FILE] [--remotecmd FILE] [DEST]')),
3086 "debugrawcommit|rawcommit":
3074 "debugrawcommit|rawcommit":
3087 (rawcommit,
3075 (rawcommit,
3088 [('p', 'parent', [], _('parent')),
3076 [('p', 'parent', [], _('parent')),
@@ -217,6 +217,12 b' class ui(object):'
217 path = self.config("paths", default)
217 path = self.config("paths", default)
218 return path or loc
218 return path or loc
219
219
220 def setconfig_remoteopts(self, **opts):
221 if opts.get('ssh'):
222 self.setconfig("ui", "ssh", opts['ssh'])
223 if opts.get('remotecmd'):
224 self.setconfig("ui", "remotecmd", opts['remotecmd'])
225
220 def write(self, *args):
226 def write(self, *args):
221 if self.header:
227 if self.header:
222 if self.header != self.prev_header:
228 if self.header != self.prev_header:
General Comments 0
You need to be logged in to leave comments. Login now