comparison 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
comparison
equal deleted inserted replaced
8187:d2504744e7a5 8188:f3abe032fc89
96 if limit <= 0: raise util.Abort(_('limit must be positive')) 96 if limit <= 0: raise util.Abort(_('limit must be positive'))
97 else: 97 else:
98 limit = sys.maxint 98 limit = sys.maxint
99 return limit 99 return limit
100 100
101 def setremoteconfig(ui, opts): 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
110 be None, meaning use working dir.''' 123 be None, meaning use working dir.'''
111 124