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


Python commands.update函数代码示例

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


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


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