当前位置: 首页>>代码示例>>Python>>正文


Python ui.ui函数代码示例

本文整理汇总了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]
开发者ID:velorientc,项目名称:git_test7,代码行数:29,代码来源:thgrepo.py

示例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)
开发者ID:jasonmc,项目名称:hg-fast-export,代码行数:7,代码来源:hg2git.py

示例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())
开发者ID:szechyjs,项目名称:dotfiles,代码行数:28,代码来源:kiln.py

示例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)
开发者ID:Catherine1,项目名称:reviewboard,代码行数:25,代码来源:hg.py

示例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]
开发者ID:gilshwartz,项目名称:tortoisehg-caja,代码行数:27,代码来源:thgrepo.py

示例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))
开发者ID:diasks2,项目名称:pontoon,代码行数:28,代码来源:vcs.py

示例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
开发者ID:cmsc435sikuli,项目名称:shared,代码行数:31,代码来源:checkout.py

示例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])
开发者ID:alfredodeza,项目名称:pacha,代码行数:7,代码来源:hg.py

示例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)
开发者ID:summonsang,项目名称:scm2pgsql,代码行数:7,代码来源:hg2git.py

示例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)
开发者ID:smillaedler,项目名称:mozmill-automation,代码行数:8,代码来源:repository.py

示例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
开发者ID:bgruening,项目名称:galaxy-toolshed-hooks,代码行数:8,代码来源:toolshed_pre-commit_hook.py

示例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)
开发者ID:MikeLing,项目名称:mozmill-automation,代码行数:8,代码来源:repository.py

示例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)
开发者ID:lappsgrid-incubator,项目名称:Galaxy,代码行数:10,代码来源:hg_util.py

示例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)
开发者ID:Bharath95,项目名称:cbioportal,代码行数:11,代码来源:hotDeploy.py

示例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)
开发者ID:alfredodeza,项目名称:pacha,代码行数:12,代码来源:hg.py


注:本文中的mercurial.ui.ui函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。