本文整理汇总了Python中mercurial.ui.ui函数的典型用法代码示例。如果您正苦于以下问题:Python ui函数的具体用法?Python ui怎么用?Python ui使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ui函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: repository
def repository(_ui=None, path='', bundle=None):
'''Returns a subclassed Mercurial repository to which new
THG-specific methods have been added. The repository object
is obtained using mercurial.hg.repository()'''
if bundle:
if _ui is None:
_ui = uimod.ui()
repo = bundlerepo.bundlerepository(_ui, path, bundle)
repo.__class__ = _extendrepo(repo)
agent = RepoAgent(repo)
return agent.rawRepo()
if path not in _repocache:
if _ui is None:
_ui = uimod.ui()
try:
repo = hg.repository(_ui, path)
# get unfiltered repo in version safe manner
repo = getattr(repo, 'unfiltered', lambda: repo)()
repo.__class__ = _extendrepo(repo)
agent = RepoAgent(repo)
_repocache[path] = agent.rawRepo()
return agent.rawRepo()
except EnvironmentError:
raise error.RepoError('Cannot open repository at %s' % path)
if not os.path.exists(os.path.join(path, '.hg/')):
del _repocache[path]
# this error must be in local encoding
raise error.RepoError('%s is not a valid repository' % path)
return _repocache[path]
示例2: setup_repo
def setup_repo(url):
try:
myui=ui.ui(interactive=False)
except TypeError:
myui=ui.ui()
myui.setconfig('ui', 'interactive', 'off')
return myui,hg.repository(myui,url)
示例3: _upgrade
def _upgrade(ui, repo):
ext_dir = os.path.dirname(os.path.abspath(__file__))
ui.debug(_('kiln: checking for extensions upgrade for %s\n') % ext_dir)
try:
r = localrepo.localrepository(hgui.ui(), ext_dir)
except RepoError:
commands.init(hgui.ui(), dest=ext_dir)
r = localrepo.localrepository(hgui.ui(), ext_dir)
r.ui.setconfig('kiln', 'autoupdate', False)
r.ui.pushbuffer()
try:
source = 'https://developers.kilnhg.com/Repo/Kiln/Group/Kiln-Extensions'
if commands.incoming(r.ui, r, bundle=None, force=False, source=source) != 0:
# no incoming changesets, or an error. Don't try to upgrade.
ui.debug('kiln: no extensions upgrade available\n')
return
ui.write(_('updating Kiln Extensions at %s... ') % ext_dir)
# pull and update return falsy values on success
if commands.pull(r.ui, r, source=source) or commands.update(r.ui, r, clean=True):
url = urljoin(repo.url()[:repo.url().lower().index('/repo')], 'Tools')
ui.write(_('unable to update\nvisit %s to download the newest extensions\n') % url)
else:
ui.write(_('complete\n'))
except Exception, e:
ui.debug(_('kiln: error updating extensions: %s\n') % e)
ui.debug(_('kiln: traceback: %s\n') % traceback.format_exc())
示例4: __init__
def __init__(self, repoPath, local_site):
from mercurial import hg, ui
from mercurial.__version__ import version
version = version.replace("+", ".")
version_parts = [int(x) for x in version.split(".")]
if version_parts[0] == 1 and version_parts[1] <= 2:
hg_ui = ui.ui(interactive=False)
else:
hg_ui = ui.ui()
hg_ui.setconfig('ui', 'interactive', 'off')
# Check whether ssh is configured for mercurial. Assume that any
# configured ssh is set up correctly for this repository.
hg_ssh = hg_ui.config('ui', 'ssh')
if not hg_ssh:
logging.debug('Using rbssh for mercurial')
hg_ui.setconfig('ui', 'ssh', 'rbssh --rb-local-site=%s'
% local_site)
else:
logging.debug('Found configured ssh for mercurial: %s' % hg_ssh)
self.repo = hg.repository(hg_ui, path=repoPath)
示例5: repository
def repository(_ui=None, path='', create=False, bundle=None):
'''Returns a subclassed Mercurial repository to which new
THG-specific methods have been added. The repository object
is obtained using mercurial.hg.repository()'''
if bundle:
if _ui is None:
_ui = uimod.ui()
repo = bundlerepo.bundlerepository(_ui, path, bundle)
repo.__class__ = _extendrepo(repo)
repo._pyqtobj = ThgRepoWrapper(repo)
return repo
if create or path not in _repocache:
if _ui is None:
_ui = uimod.ui()
try:
repo = hg.repository(_ui, path, create)
repo.__class__ = _extendrepo(repo)
repo._pyqtobj = ThgRepoWrapper(repo)
_repocache[path] = repo
return repo
except EnvironmentError:
raise error.RepoError('Cannot open repository at %s' % path)
if not os.path.exists(os.path.join(path, '.hg/')):
del _repocache[path]
# this error must be in local encoding
raise error.RepoError('%s is not a valid repository' % path)
return _repocache[path]
示例6: pull
def pull(self, source=None, target=None):
from mercurial import commands, hg, ui, error
log.debug("Clone or update HG repository.")
source = source or self.source
target = target or self.target
# Folders need to be manually created
if not os.path.exists(target):
os.makedirs(target)
# Doesn't work with unicode type
url = str(source)
path = str(target)
try:
repo = hg.repository(ui.ui(), path)
commands.pull(ui.ui(), repo, source=url)
commands.update(ui.ui(), repo)
log.debug("Mercurial: repository at " + url + " updated.")
except error.RepoError, e:
log.debug("Mercurial: " + str(e))
try:
commands.clone(ui.ui(), url, path)
log.debug("Mercurial: repository at " + url + " cloned.")
except Exception, e:
log.debug("Mercurial: " + str(e))
raise PullFromRepositoryException(unicode(e))
示例7: main
def main(argv):
# Find destination directory based on current file location
destdir = os.path.abspath(os.path.join(
os.path.dirname(__file__), '..', '..'))
# Read the configuration file for the shared repository to get the pull path
repo = hg.repository(
ui.ui(), os.path.join(os.path.dirname(__file__), '..'))
sharedpath = repo.ui.config('paths', 'default', None)
if sharedpath is None:
raise Exception('no default path in the shared directory!')
unstable = sharedpath.endswith('-unstable')
path = os.path.dirname(sharedpath)
print 'using %s as remote repository path' % path
for module in reduce(lambda x, y: x + y.split(','), argv, []):
if module.endswith('-unstable'):
module = module[:-len('-unstable')]
if not os.path.exists(os.path.join(destdir, module)):
# Attempt to clone the repository to the destination
if module == "GUIRipper-Plugin-JFC" or module == "GUIRipper-Core" or module == "GUITARModel-Plugin-JFC" or module == "GUITARModel-Core" or module == "GUIReplayer-Plugin-JFC" or module == "GUIReplayer-Core":
call("git clone git://github.com/cmsc435sikuli/" + module + ".git " + destdir + "/" + module, shell=True)
else:
url = '%s/%s%s' % (path, module, '-unstable' if unstable else '')
print 'checking out %s to %s' % (url, destdir)
commands.clone(ui.ui(), url, os.path.join(destdir, module))
else:
# Repository already exists, skip
print '%s already exists (skipping)' % module
示例8: hg_push_update
def hg_push_update(repo):
u = ui.ui()
repo = hg.repository(u, repo)
repo.ui.pushbuffer()
commands.update(ui.ui(), repo)
hg_log.debug("updating repo: %s" % repo)
hg_log.debug(repo.ui.popbuffer().split('\n')[0])
示例9: setup_repo
def setup_repo(url):
try:
myui = ui.ui(interactive=False)
except TypeError:
myui = ui.ui()
myui.setconfig("ui", "interactive", "off")
return myui, hg.repository(myui, url)
示例10: clone
def clone(self, destination=None):
""" Clone the repository to the local disk. """
if destination is not None:
self.destination = destination
hg.clone(ui.ui(), dict(), self.url, self.destination, True)
self._repository = hg.repository(ui.ui(), self.destination)
示例11: get_latest_repo_rev
def get_latest_repo_rev( url ):
"""
look up the latest mercurial tip revision
"""
hexfunc = ui.ui().debugflag and hex or short
repo = hg.repository( ui.ui(), url )
tip = hexfunc( repo.lookup( 'tip' ) )
return tip
示例12: update
def update(self, branch=None):
""" Update the local repository for recent changes. """
if branch is None:
branch = self.branch
print "*** Updating to branch '%s'" % branch
commands.pull(ui.ui(), self._repository, self.url)
commands.update(ui.ui(), self._repository, None, branch, True)
示例13: get_repo_for_repository
def get_repo_for_repository(app, repository=None, repo_path=None):
# Import from mercurial here to let Galaxy start under Python 3
from mercurial import (
hg,
ui
)
if repository is not None:
return hg.repository(ui.ui(), repository.repo_path(app))
if repo_path is not None:
return hg.repository(ui.ui(), repo_path)
示例14: update_repos
def update_repos(rev):
try:
print >> OUTPUT_FILE, 'accessing repository: %s' % PORTAL_HOME
repos = hg.repository(ui.ui(), PORTAL_HOME)
print >> OUTPUT_FILE, 'updating to revision: %s' % rev
commands.update(ui.ui(), repos, rev=rev, check=True)
except Exception, e:
print >> ERROR_FILE, "Error: %s" % e
print >> ERROR_FILE, "Aborting."
sys.exit(1)
示例15: hg_add
def hg_add(self, single=None):
"""Adds all files to Mercurial when the --watch options is passed
This only happens one time. All consequent files are not auto added
to the watch list."""
repo = hg.repository(ui.ui(), self.path)
if single is None:
commands.add(ui.ui(), repo=repo)
hg_log.debug('added files to repo %s' % self.path)
else:
commands.add(ui.ui(), repo, single)
hg_log.debug('added files to repo %s' % self.path)