comparison mercurial/hg.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 94b7b3a1ae1b
children 24eeca1f2791
comparison
equal deleted inserted replaced
11272:e8a66a40474d 11273:d1908cb95a82
398 return mergemod.update(repo, node, False, True, choose)[3] > 0 398 return mergemod.update(repo, node, False, True, choose)[3] > 0
399 399
400 def verify(repo): 400 def verify(repo):
401 """verify the consistency of a repository""" 401 """verify the consistency of a repository"""
402 return verifymod.verify(repo) 402 return verifymod.verify(repo)
403
404 def remoteui(src, opts):
405 'build a remote ui from ui or repo and opts'
406 if hasattr(src, 'baseui'): # looks like a repository
407 dst = src.baseui.copy() # drop repo-specific config
408 src = src.ui # copy target options from repo
409 else: # assume it's a global ui object
410 dst = src.copy() # keep all global options
411
412 # copy ssh-specific options
413 for o in 'ssh', 'remotecmd':
414 v = opts.get(o) or src.config('ui', o)
415 if v:
416 dst.setconfig("ui", o, v)
417
418 # copy bundle-specific options
419 r = src.config('bundle', 'mainreporoot')
420 if r:
421 dst.setconfig('bundle', 'mainreporoot', r)
422
423 # copy auth and http_proxy section settings
424 for sect in ('auth', 'http_proxy'):
425 for key, val in src.configitems(sect):
426 dst.setconfig(sect, key, val)
427
428 return dst