Mercurial > public > mercurial-scm > hg
diff mercurial/cmdutil.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 | 08e1baf924ca |
children | d2899a856f9f |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Sun Apr 26 16:50:43 2009 -0500 +++ b/mercurial/cmdutil.py Sun Apr 26 16:50:43 2009 -0500 @@ -98,12 +98,25 @@ limit = sys.maxint return limit -def setremoteconfig(ui, opts): - "copy remote options to ui tree" - if opts.get('ssh'): - ui.setconfig("ui", "ssh", opts['ssh']) - if opts.get('remotecmd'): - ui.setconfig("ui", "remotecmd", opts['remotecmd']) +def remoteui(src, opts): + 'build a remote ui from ui or repo and opts' + if hasattr(src, 'ui'): # looks like a repository + dst = src.ui.parentui # drop repo-specific config + src = src.ui # copy target options from repo + else: # assume it's a ui object + dst = src # keep all global options + + # copy ssh-specific options + for o in 'ssh', 'remotecmd': + v = opts.get(o) or src.config('ui', o) + if v: + dst.setconfig("ui", o, v) + # copy bundle-specific options + r = src.config('bundle', 'mainreporoot') + if r: + dst.setconfig('bundle', 'mainreporoot', r) + + return dst def revpair(repo, revs): '''return pair of nodes, given list of revisions. second item can