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