comparison mercurial/cmdutil.py @ 11273:d1908cb95a82

remoteui: move from cmdutil to hg
author Matt Mackall <mpm@selenic.com>
date Tue, 01 Jun 2010 11:18:57 -0500
parents 1107888a1ad1
children 2698a95f3f1b
comparison
equal deleted inserted replaced
11272:e8a66a40474d 11273:d1908cb95a82
108 if limit <= 0: 108 if limit <= 0:
109 raise util.Abort(_('limit must be positive')) 109 raise util.Abort(_('limit must be positive'))
110 else: 110 else:
111 limit = None 111 limit = None
112 return limit 112 return limit
113
114 def remoteui(src, opts):
115 'build a remote ui from ui or repo and opts'
116 if hasattr(src, 'baseui'): # looks like a repository
117 dst = src.baseui.copy() # drop repo-specific config
118 src = src.ui # copy target options from repo
119 else: # assume it's a global ui object
120 dst = src.copy() # keep all global options
121
122 # copy ssh-specific options
123 for o in 'ssh', 'remotecmd':
124 v = opts.get(o) or src.config('ui', o)
125 if v:
126 dst.setconfig("ui", o, v)
127
128 # copy bundle-specific options
129 r = src.config('bundle', 'mainreporoot')
130 if r:
131 dst.setconfig('bundle', 'mainreporoot', r)
132
133 # copy auth and http_proxy section settings
134 for sect in ('auth', 'http_proxy'):
135 for key, val in src.configitems(sect):
136 dst.setconfig(sect, key, val)
137
138 return dst
139 113
140 def revpair(repo, revs): 114 def revpair(repo, revs):
141 '''return pair of nodes, given list of revisions. second item can 115 '''return pair of nodes, given list of revisions. second item can
142 be None, meaning use working dir.''' 116 be None, meaning use working dir.'''
143 117