##// END OF EJS Templates
add cmdutil.remoteui...
Matt Mackall -
r8188:f3abe032 default
parent child Browse files
Show More
@@ -60,9 +60,8 b" def fetch(ui, repo, source='default', **"
60 60 raise util.Abort(_('multiple heads in this branch '
61 61 '(use "hg heads ." and "hg merge" to merge)'))
62 62
63 cmdutil.setremoteconfig(ui, opts)
64
65 other = hg.repository(ui, ui.expandpath(source))
63 other = hg.repository(cmdutil.remoteui(repo, opts),
64 ui.expandpath(source))
66 65 ui.status(_('pulling from %s\n') %
67 66 url.hidepassword(ui.expandpath(source)))
68 67 revs = None
@@ -321,10 +321,9 b' def goutgoing(ui, repo, dest=None, **opt'
321 321 dest, revs, checkout = hg.parseurl(
322 322 ui.expandpath(dest or 'default-push', dest or 'default'),
323 323 opts.get('rev'))
324 cmdutil.setremoteconfig(ui, opts)
325 324 if revs:
326 325 revs = [repo.lookup(rev) for rev in revs]
327 other = hg.repository(ui, dest)
326 other = hg.repository(cmdutil.remoteui(ui, opts), dest)
328 327 ui.status(_('comparing with %s\n') % url.hidepassword(dest))
329 328 o = repo.findoutgoing(other, force=opts.get('force'))
330 329 if not o:
@@ -348,9 +347,7 b' def gincoming(ui, repo, source="default"'
348 347
349 348 check_unsupported_flags(opts)
350 349 source, revs, checkout = hg.parseurl(ui.expandpath(source), opts.get('rev'))
351 cmdutil.setremoteconfig(ui, opts)
352
353 other = hg.repository(ui, source)
350 other = hg.repository(cmdutil.remoteui(repo, opts), source)
354 351 ui.status(_('comparing with %s\n') % url.hidepassword(source))
355 352 if revs:
356 353 revs = [other.lookup(rev) for rev in revs]
@@ -1744,10 +1744,9 b' def clone(ui, source, dest=None, **opts)'
1744 1744 if url.endswith('/'):
1745 1745 url = url[:-1]
1746 1746 return url + '/.hg/patches'
1747 cmdutil.setremoteconfig(ui, opts)
1748 1747 if dest is None:
1749 1748 dest = hg.defaultdest(source)
1750 sr = hg.repository(ui, ui.expandpath(source))
1749 sr = hg.repository(cmdutil.remoteui(ui, opts), ui.expandpath(source))
1751 1750 if opts['patches']:
1752 1751 patchespath = ui.expandpath(opts['patches'])
1753 1752 else:
@@ -220,7 +220,7 b' def patchbomb(ui, repo, *revs, **opts):'
220 220 '''Return the revisions present locally but not in dest'''
221 221 dest = ui.expandpath(dest or 'default-push', dest or 'default')
222 222 revs = [repo.lookup(rev) for rev in revs]
223 other = hg.repository(ui, dest)
223 other = hg.repository(cmdutil.remoteui(repo, opts), dest)
224 224 ui.status(_('comparing with %s\n') % dest)
225 225 o = repo.findoutgoing(other)
226 226 if not o:
@@ -258,7 +258,6 b' def patchbomb(ui, repo, *revs, **opts):'
258 258 or opts.get('patches')):
259 259 raise util.Abort(_('specify at least one changeset with -r or -o'))
260 260
261 cmdutil.setremoteconfig(ui, opts)
262 261 if opts.get('outgoing') and opts.get('bundle'):
263 262 raise util.Abort(_("--outgoing mode always on with --bundle;"
264 263 " do not re-specify --outgoing"))
@@ -98,12 +98,25 b' def loglimit(opts):'
98 98 limit = sys.maxint
99 99 return limit
100 100
101 def setremoteconfig(ui, opts):
102 "copy remote options to ui tree"
103 if opts.get('ssh'):
104 ui.setconfig("ui", "ssh", opts['ssh'])
105 if opts.get('remotecmd'):
106 ui.setconfig("ui", "remotecmd", opts['remotecmd'])
101 def remoteui(src, opts):
102 'build a remote ui from ui or repo and opts'
103 if hasattr(src, 'ui'): # looks like a repository
104 dst = src.ui.parentui # drop repo-specific config
105 src = src.ui # copy target options from repo
106 else: # assume it's a ui object
107 dst = src # keep all global options
108
109 # copy ssh-specific options
110 for o in 'ssh', 'remotecmd':
111 v = opts.get(o) or src.config('ui', o)
112 if v:
113 dst.setconfig("ui", o, v)
114 # copy bundle-specific options
115 r = src.config('bundle', 'mainreporoot')
116 if r:
117 dst.setconfig('bundle', 'mainreporoot', r)
118
119 return dst
107 120
108 121 def revpair(repo, revs):
109 122 '''return pair of nodes, given list of revisions. second item can
@@ -521,10 +521,9 b' def bundle(ui, repo, fname, dest=None, *'
521 521 seen[p] = 1
522 522 visit.append(p)
523 523 else:
524 cmdutil.setremoteconfig(ui, opts)
525 524 dest, revs, checkout = hg.parseurl(
526 525 ui.expandpath(dest or 'default-push', dest or 'default'), revs)
527 other = hg.repository(ui, dest)
526 other = hg.repository(cmdutil.remoteui(repo, opts), dest)
528 527 o = repo.findoutgoing(other, force=opts.get('force'))
529 528
530 529 if revs:
@@ -615,8 +614,7 b' def clone(ui, source, dest=None, **opts)'
615 614 metadata under the .hg directory, such as mq.
616 615
617 616 """
618 cmdutil.setremoteconfig(ui, opts)
619 hg.clone(ui, source, dest,
617 hg.clone(cmdutil.remoteui(ui, opts), source, dest,
620 618 pull=opts.get('pull'),
621 619 stream=opts.get('uncompressed'),
622 620 rev=opts.get('rev'),
@@ -1766,9 +1764,7 b' def incoming(ui, repo, source="default",'
1766 1764 """
1767 1765 limit = cmdutil.loglimit(opts)
1768 1766 source, revs, checkout = hg.parseurl(ui.expandpath(source), opts.get('rev'))
1769 cmdutil.setremoteconfig(ui, opts)
1770
1771 other = hg.repository(ui, source)
1767 other = hg.repository(cmdutil.remoteui(repo, opts), source)
1772 1768 ui.status(_('comparing with %s\n') % url.hidepassword(source))
1773 1769 if revs:
1774 1770 revs = [other.lookup(rev) for rev in revs]
@@ -1834,8 +1830,7 b' def init(ui, dest=".", **opts):'
1834 1830 It is possible to specify an ssh:// URL as the destination.
1835 1831 See 'hg help urls' for more information.
1836 1832 """
1837 cmdutil.setremoteconfig(ui, opts)
1838 hg.repository(ui, dest, create=1)
1833 hg.repository(cmdutil.remoteui(ui, opts), dest, create=1)
1839 1834
1840 1835 def locate(ui, repo, *pats, **opts):
1841 1836 """locate files matching specific patterns
@@ -2084,11 +2079,10 b' def outgoing(ui, repo, dest=None, **opts'
2084 2079 limit = cmdutil.loglimit(opts)
2085 2080 dest, revs, checkout = hg.parseurl(
2086 2081 ui.expandpath(dest or 'default-push', dest or 'default'), opts.get('rev'))
2087 cmdutil.setremoteconfig(ui, opts)
2088 2082 if revs:
2089 2083 revs = [repo.lookup(rev) for rev in revs]
2090 2084
2091 other = hg.repository(ui, dest)
2085 other = hg.repository(cmdutil.remoteui(repo, opts), dest)
2092 2086 ui.status(_('comparing with %s\n') % url.hidepassword(dest))
2093 2087 o = repo.findoutgoing(other, force=opts.get('force'))
2094 2088 if not o:
@@ -2199,9 +2193,7 b' def pull(ui, repo, source="default", **o'
2199 2193 See 'hg help urls' for more information.
2200 2194 """
2201 2195 source, revs, checkout = hg.parseurl(ui.expandpath(source), opts.get('rev'))
2202 cmdutil.setremoteconfig(ui, opts)
2203
2204 other = hg.repository(ui, source)
2196 other = hg.repository(cmdutil.remoteui(repo, opts), source)
2205 2197 ui.status(_('pulling from %s\n') % url.hidepassword(source))
2206 2198 if revs:
2207 2199 try:
@@ -2237,9 +2229,7 b' def push(ui, repo, dest=None, **opts):'
2237 2229 """
2238 2230 dest, revs, checkout = hg.parseurl(
2239 2231 ui.expandpath(dest or 'default-push', dest or 'default'), opts.get('rev'))
2240 cmdutil.setremoteconfig(ui, opts)
2241
2242 other = hg.repository(ui, dest)
2232 other = hg.repository(cmdutil.remoteui(repo, opts), dest)
2243 2233 ui.status(_('pushing to %s\n') % url.hidepassword(dest))
2244 2234 if revs:
2245 2235 revs = [repo.lookup(rev) for rev in revs]
General Comments 0
You need to be logged in to leave comments. Login now