Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 8188:f3abe032fc89
add cmdutil.remoteui
remoteui sorts out the issues of getting ssh config options from the
local repo into the remote one while not copying other options like hooks.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 26 Apr 2009 16:50:43 -0500 |
parents | b97abc7c1135 |
children | d2899a856f9f |
comparison
equal
deleted
inserted
replaced
8187:d2504744e7a5 | 8188:f3abe032fc89 |
---|---|
519 for p in parents: | 519 for p in parents: |
520 if p not in seen: | 520 if p not in seen: |
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: |
531 cg = repo.changegroupsubset(o, revs, 'bundle') | 530 cg = repo.changegroupsubset(o, revs, 'bundle') |
532 else: | 531 else: |
613 breaks hardlinks (Emacs and most Linux Kernel tools do so). Also, | 612 breaks hardlinks (Emacs and most Linux Kernel tools do so). Also, |
614 this is not compatible with certain extensions that place their | 613 this is not compatible with certain extensions that place their |
615 metadata under the .hg directory, such as mq. | 614 metadata under the .hg directory, such as mq. |
616 | 615 |
617 """ | 616 """ |
618 cmdutil.setremoteconfig(ui, opts) | 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'), |
623 update=not opts.get('noupdate')) | 621 update=not opts.get('noupdate')) |
624 | 622 |
1764 | 1762 |
1765 See pull for valid source format details. | 1763 See pull for valid source format details. |
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] |
1775 common, incoming, rheads = repo.findcommonincoming(other, heads=revs, | 1771 common, incoming, rheads = repo.findcommonincoming(other, heads=revs, |
1776 force=opts["force"]) | 1772 force=opts["force"]) |
1832 If no directory is given, the current directory is used. | 1828 If no directory is given, the current directory is used. |
1833 | 1829 |
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 |
1842 | 1837 |
1843 Print all files under Mercurial control whose names match the | 1838 Print all files under Mercurial control whose names match the |
2082 See pull for valid destination format details. | 2077 See pull for valid destination format details. |
2083 """ | 2078 """ |
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: |
2095 ui.status(_("no changes found\n")) | 2089 ui.status(_("no changes found\n")) |
2096 return 1 | 2090 return 1 |
2197 | 2191 |
2198 If SOURCE is omitted, the 'default' path will be used. | 2192 If SOURCE is omitted, the 'default' path will be used. |
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: |
2208 revs = [other.lookup(rev) for rev in revs] | 2200 revs = [other.lookup(rev) for rev in revs] |
2209 except error.CapabilityError: | 2201 except error.CapabilityError: |
2235 URLs. If DESTINATION is omitted, a default path will be used. | 2227 URLs. If DESTINATION is omitted, a default path will be used. |
2236 See 'hg help urls' for more information. | 2228 See 'hg help urls' for more information. |
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] |
2246 r = repo.push(other, opts.get('force'), revs=revs) | 2236 r = repo.push(other, opts.get('force'), revs=revs) |
2247 return r == 0 | 2237 return r == 0 |