• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python commands.update函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mercurial.commands.update函数的典型用法代码示例。如果您正苦于以下问题:Python update函数的具体用法?Python update怎么用?Python update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了update函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_updatehgsub

    def test_updatehgsub(self):
        def checkdeps(ui, repo, rev, deps, nodeps):
            commands.update(ui, repo, node=str(rev))
            for d in deps:
                p = os.path.join(repo.root, d)
                self.assertTrue(os.path.isdir(p),
                                'missing: %[email protected]%r' % (d, repo[None].rev()))
            for d in nodeps:
                p = os.path.join(repo.root, d)
                self.assertTrue(not os.path.isdir(p),
                                'unexpected: %[email protected]%r' % (d, repo[None].rev()))

        if subrepo is None:
            return

        ui = self.ui()
        repo = self._load_fixture_and_fetch('externals.svndump',
                                            stupid=0, externals='subrepos')
        checkdeps(ui, repo, 0, ['deps/project1'], [])
        checkdeps(ui, repo, 1, ['deps/project1', 'deps/project2'], [])
        checkdeps(ui, repo, 2, ['subdir/deps/project1', 'subdir2/deps/project1',
                   'deps/project2'],
                  ['deps/project1'])
        checkdeps(ui, repo, 3, ['subdir/deps/project1', 'deps/project2'],
                  ['subdir2/deps/project1'])
        checkdeps(ui, repo, 4, ['subdir/deps/project1'], ['deps/project2'])

        # Test update --clean, used to crash
        repo.wwrite('subdir/deps/project1/a', 'foobar', '')
        commands.update(ui, repo, node='4', clean=True)
开发者ID:avuori,项目名称:dotfiles,代码行数:30,代码来源:test_externals.py


示例2: 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


示例3: 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


示例4: _createBranch

 def _createBranch(self, branch_name, message, from_branch = None):
     if not from_branch is None:
         #first update to from_branch
         commands.update(self.ui, self.repo, from_branch)
         
     commands.branch(self.ui, self.repo, branch_name)
     commands.commit(self.ui, self.repo, message = message)
开发者ID:djm,项目名称:dotfiles,代码行数:7,代码来源:hgflow.py


示例5: 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


示例6: update

 def update(self):
     self._send_callback(self.callback_on_action_notify,_('Updating repository %s') % self._remote_path)        
     try:
         self.cleanup()
         commands.pull(self.repo.ui, self.repo, rev=None, force=False, update=True)
         commands.update(self.repo.ui, self.repo, self.branch)
         self._process_files()
     except RepoError, e:
         raise BrowserException, e
开发者ID:dahool,项目名称:vertaal,代码行数:9,代码来源:hg.py


示例7: update

 def update(self, stdout=None):
     """
     Pull and update all changes from hg repository
     Note that this command destroy all local changes
     """
     u, r = self._hg(stdout)
     commands.pull(u, r)
     commands.update(u, r, clean=True)
     del u, r
开发者ID:fu2re,项目名称:jsondb,代码行数:9,代码来源:__init__.py


示例8: checkdeps

 def checkdeps(ui, repo, rev, deps, nodeps):
     commands.update(ui, repo, node=str(rev))
     for d in deps:
         p = os.path.join(repo.root, d)
         self.assertTrue(os.path.isdir(p),
                         'missing: %[email protected]%r' % (d, repo[None].rev()))
     for d in nodeps:
         p = os.path.join(repo.root, d)
         self.assertTrue(not os.path.isdir(p),
                         'unexpected: %[email protected]%r' % (d, repo[None].rev()))
开发者ID:avuori,项目名称:dotfiles,代码行数:10,代码来源:test_externals.py


示例9: hgflow_func_short

    def hgflow_func_short(self, cmd, name, args, opts):
        if not self._checkInited():
            return
        
        if self._hasUncommit():
            return

        prefix = self.featurePrefix
        if cmd == 'hotfix':
            prefix = self.hotfixPrefix
        elif cmd == 'release':
            prefix = self.releasePrefix
            
        target_branch = '%s%s' % (prefix, name)
        tag_name = opts['rev']

        if not self._findBranch(target_branch, name):
            if not (opts['finish'] or opts['close'] or opts['switch']):
                if tag_name:
                    self.outputln(_('Start a new `%s` branch `%s` based on reversion `%s`' % (cmd, name, tag_name)))
                    self._startBranch(target_branch, tag_name)
                else:
                    '''
                    find the suit based branch
                    '''
                    if cmd == 'hotfix':
                        self.outputln(_('Start a new `%s` branch `%s` based on PUBLISH branch' % (cmd, name)))
                        self._startBranch(target_branch, self.publishBranch)
                    elif cmd == 'release' or cmd == 'feature':
                        self.outputln(_('Start a new `%s` branch `%s` based on DEVELOP branch' % (cmd, name)))
                        self._startBranch(target_branch, self.developBranch)
        else:
            if opts['finish']:
                '''
                find the suit based branch
                check the branches is already closed
                '''
                if cmd == 'hotfix':
                    self.hgflow_func_hotfix_finish(target_branch, name, tag_name)
                elif cmd == 'release':
                    self.hgflow_func_release_finish(target_branch, name, tag_name)
                elif cmd == 'feature':
                    self.hgflow_func_feature_finish(target_branch, name)
                    
            elif opts['close']:
                return
            else:
                #switch
                current_branch = hgflow_current_branch(self, prefix)
                if current_branch == name:
                    self.outputln(_('Already in `%s` branch `%s`, nothing happens.' % (cmd, name)))
                else:
                    self.outputln(_('Switch to `%s` branch `%s`.' % (cmd, name)))
                    commands.update(self.ui, self.repo, target_branch)
开发者ID:djm,项目名称:dotfiles,代码行数:54,代码来源:hgflow.py


示例10: 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


示例11: merge_into

def merge_into(ui, repo, rev, **opts):
    node = repo.changectx(rev)
    curr = repo.changectx(".")
    commands.update(ui, repo, rev=node.rev())
    commands.merge(ui, repo, rev=curr.rev())
    ticket = get_ticket_id(curr)
    message = "refs #%(ticket)s merged %(target)s -> %(branch)s" % {
        "ticket": ticket,
        "target": curr.branch(),
        "branch": node.branch(),
        }
    commands.commit(ui, repo, message=message)
开发者ID:ikeikeikeike,项目名称:home,代码行数:12,代码来源:my_hgext.py


示例12: test_get_revision_before_date_time_stays_on_branch

    def test_get_revision_before_date_time_stays_on_branch(self):
        hgrepo = MercurialRepository(self.directory, init=True)
        dates = ('2011-01-01 01:01:01', '2011-03-03 03:03:03')
        self.create_test_changesets(hgrepo, 2, dates=dates)

        hgrepo.create_and_switch_to_branch('avoidbranch')
        self.create_test_changesets(hgrepo, 1, dates=('2011-02-02 02:02:02',))

        commands.update(hgrepo.get_ui(), hgrepo.get_repo(), rev='default')

        #should match commit on 2011-01-01, not 2011-02-02
        eq_('f957b16de26a4879c255762cee97797a64e28f28', hgrepo.get_revision_before_date(datetime(2011, 2, 2, 4, 4, 4)))
开发者ID:markdrago,项目名称:caboose,代码行数:12,代码来源:mercurial_repository_tests.py


示例13: handlePushes

def handlePushes(repo_id, submits, do_update=True):
    if not submits:
        return
    repo = Repository.objects.get(id=repo_id)
    revisions = reduce(lambda r,l: r+l,
                       [p.changesets for p in submits],
       [])
    ui = _ui()
    repopath = os.path.join(settings.REPOSITORY_BASE,
                            repo.name)
    configpath = os.path.join(repopath, '.hg', 'hgrc')
    if not os.path.isfile(configpath):
        if not os.path.isdir(os.path.dirname(repopath)):
            os.makedirs(os.path.dirname(repopath))
        clone(ui, str(repo.url), str(repopath),
              pull=False, uncompressed=False, rev=[],
              noupdate=False)
        cfg = open(configpath, 'a')
        cfg.write('default-push = ssh%s\n' % str(repo.url)[4:])
        cfg.close()
        ui.readconfig(configpath)
        hgrepo = repository(ui, repopath)
    else:
        ui.readconfig(configpath)
        hgrepo = repository(ui, repopath)
        cs = submits[-1].changesets[-1]
        try:
            hgrepo.changectx(cs)
        except RepoError:
            pull(ui, hgrepo, source = str(repo.url),
                 force=False, update=False,
                 rev=[])
            if do_update:
                update(ui, hgrepo)
    for data in submits:
        changesets = []
        for revision in data.changesets:
            try:
                cs = getChangeset(repo, hgrepo, revision)
                transaction.commit()
                changesets.append(cs)
            except Exception, e:
                transaction.rollback()
                raise
                print repo.name, e
        p = Push.objects.create(repository = repo,
                                push_id = data.id, user = data.user,
                                push_date =
                                datetime.utcfromtimestamp(data.date))
        p.changesets = changesets
        p.save()
        transaction.commit()
开发者ID:lauraxt,项目名称:elmo,代码行数:52,代码来源:utils.py


示例14: init_repo

    def init_repo(self):
        logger.debug("init")
        self._send_callback(self.callback_on_action_notify,_('Initializing repository %s') % self._remote_path)

        try:
            logger.debug("Checkout %s on %s" % (self._remote_path, self.location))

            remote_repo, repo = hg.clone(self.ui, self._remote_path, self.location)
            commands.update(repo.ui, repo, self.branch)
            self._process_files()
            logger.debug("end")
        except RepoError, e:
            raise BrowserException, e
开发者ID:dahool,项目名称:vertaal,代码行数:13,代码来源:hg.py


示例15: function

 def function(tree, ignore, opts):
     rev = opts['rev']
     if type(rev) is str:
         rev = rev
     elif rev:
         rev = rev[0]
     else:
         rev = None
     try:
         commands.update(ui, tree.getrepo(ui),
                         rev=rev, clean=opts['clean'], date=opts['date'])
     except Exception, err:
         ui.warn(_("skipped: %s\n") % err)
         tree.repo.transaction().__del__()
开发者ID:kiorky,项目名称:cryptelium-overlay,代码行数:14,代码来源:forest.py


示例16: pullAndMerge

 def pullAndMerge(self):
     """Run an hg pull and update.
     Overwrite all local changes by default.
     If anything goes wrong with the pull or update, clone instead.
     """
     try:
         self.chmod()
         commands.pull(self.ui, self.repo, source=self.url)
         self.chmod()
         commands.update(self.ui, self.repo, clean=True)
     except error.RepoError:
         if os.path.exists(REPO_DIR):
             shutil.rmtree(REPO_DIR)
             self.clone()
     return
开发者ID:r4vi,项目名称:open-ihm,代码行数:15,代码来源:frmupdateopenihm.py


示例17: checkout_hg

 def checkout_hg(self):
     return 'hg', 'st'
     # pull new version of project from perository
     if not self.repo_path:
         # may be need to find repo recursively from this dir to up, but it's only may be.
         self.repo_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..',))
     repo = hg.repository(
         ui.ui(),
         self.repo_path
     )
     url = dict(repo.ui.configitems('paths', 'default'))['default']
     commands.pull(ui.ui(), repo, url)
     # and update it
     commands.update(ui.ui(), repo)
     return
开发者ID:dismorfo,项目名称:NYU-Annotation-Service,代码行数:15,代码来源:update_service.py


示例18: _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


示例19: pull

def pull(orig, ui, repo, *args, **opts):
    """pull --rebase/--update are problematic without an explicit destination"""
    try:
        rebasemodule = extensions.find('rebase')
    except KeyError:
        rebasemodule = None

    rebase = opts.get('rebase')
    update = opts.get('update')
    isrebase = rebase or rebaseflag
    # Only use from the global rebasedest if _getrebasedest was called.  If the
    # user isn't using remotenames, then rebasedest isn't set.
    if rebaseflag:
        dest = rebasedest
    else:
        dest = opts.get('dest')

    if (isrebase or update) and not dest:
        dest = ui.config('tweakdefaults', 'defaultdest')

    if isrebase and update:
        mess = _('specify either rebase or update, not both')
        raise error.Abort(mess)

    if dest and not (isrebase or update):
        mess = _('only specify a destination if rebasing or updating')
        raise error.Abort(mess)

    if (isrebase or update) and not dest:
        if isrebase and bmactive(repo):
            mess = ui.config('tweakdefaults', 'bmnodestmsg')
            hint = ui.config('tweakdefaults', 'bmnodesthint')
        elif isrebase:
            mess = ui.config('tweakdefaults', 'nodestmsg')
            hint = ui.config('tweakdefaults', 'nodesthint')
        else: # update
            mess = _('you must specify a destination for the update')
            hint = _('use `hg pull --update --dest <destination>`')
        raise error.Abort(mess, hint=hint)

    if 'rebase' in opts:
        del opts['rebase']
        tool = opts.pop('tool', '')
    if 'update' in opts:
        del opts['update']
    if 'dest' in opts:
        del opts['dest']

    ret = orig(ui, repo, *args, **opts)

    # NB: we use rebase and not isrebase on the next line because
    # remotenames may have already handled the rebase.
    if dest and rebase:
        ret = ret or rebaseorfastforward(rebasemodule.rebase, ui, repo,
                                         dest=dest, tool=tool)
    if dest and update:
        ret = ret or commands.update(ui, repo, node=dest, check=True)

    return ret
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:59,代码来源:tweakdefaults.py


示例20: test_push_single_dir_branch

    def test_push_single_dir_branch(self):
        # Tests local branches pushing to a single dir repo. Creates a fork at
        # tip. The default branch adds a file called default, while branch foo
        # adds a file called foo, then tries to push the foo branch and default
        # branch in that order.
        repo = self._load_fixture_and_fetch('branch_from_tag.svndump',
                                            stupid=False,
                                            layout='single',
                                            subdir='')
        def file_callback(data):
            def cb(repo, memctx, path):
                if path == data:
                    return context.memfilectx(path=path,
                                              data=data,
                                              islink=False,
                                              isexec=False,
                                              copied=False)
                raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
            return cb

        def commit_to_branch(name, parent):
            repo.commitctx(context.memctx(repo,
                                          (parent, node.nullid),
                                          'automated test (%s)' % name,
                                          [name],
                                          file_callback(name),
                                          'an_author',
                                          '2009-10-19 18:49:30 -0500',
                                          {'branch': name,}))

        parent = repo['tip'].node()
        commit_to_branch('default', parent)
        commit_to_branch('foo', parent)
        hg.update(repo, repo['foo'].node())
        self.pushrevisions()
        repo = self.repo # repo is outdated after the rebase happens, refresh
        self.assertTrue('foo' in self.svnls(''))
        self.assertEqual(repo.branchtags().keys(), ['default'])
        # Have to cross to another branch head, so hg.update doesn't work
        commands.update(ui.ui(),
                        self.repo,
                        self.repo.branchheads('default')[1],
                        clean=True)
        self.pushrevisions()
        self.assertTrue('default' in self.svnls(''))
        self.assertEquals(len(self.repo.branchheads('default')), 1)
开发者ID:bulwinkel,项目名称:dot-files,代码行数:46,代码来源:test_single_dir_clone.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python config.config函数代码示例发布时间:2022-05-27
下一篇:
Python commands.pull函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap