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

Python commands.pull函数代码示例

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

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



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

示例1: download_patch

def download_patch(source, lastrev, patchbranch):
    from mercurial import hg, ui, localrepo, commands, bundlerepo
    UI = ui.ui()
    bundle = tempfile.mktemp(dir="/var/tmp")
    cwd = os.getcwd()
    os.chdir(base)
    try:
        repo0 = hg.repository(UI,base)
        repo0.ui.quiet=True
        repo0.ui.pushbuffer()
        commands.pull(repo0.ui, repo0, quiet=True)
        repo0.ui.popbuffer() # discard all pull output
        # find out what the head revision of the given branch is
        repo0.ui.pushbuffer()
        head = repo0.ui.popbuffer().strip()
        repo0.ui.pushbuffer()
        if commands.incoming(repo0.ui, repo0, source=source, branch=[patchbranch], bundle=bundle, force=False) != 0:
            raise ValueError, "Repository contains no changes"
        rhead = repo0.ui.popbuffer()
        if rhead:
            # output is a list of revisions, one per line. last line should be newest revision
            rhead = rhead.splitlines()[-1].split(':')[1]
        if rhead == lastrev:
            raise NotChanged
        repo=bundlerepo.bundlerepository(UI, ".", bundle)
        repo.ui.pushbuffer()
        old = 'max(ancestors(branch("%s"))-outgoing("%s"))' % (patchbranch, base)
        commands.diff(repo.ui, repo, rev=[old, patchbranch])
        result = repo.ui.popbuffer()
    finally:
        os.chdir(cwd)
        if os.path.exists(bundle):
            os.unlink(bundle)
    return result, rhead
开发者ID:AnishShah,项目名称:python-dev,代码行数:34,代码来源:create_patch.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: test_onerevision_noupdate

 def test_onerevision_noupdate(self):
     repo, repo_path = self._loadupdate('single_rev.svndump')
     state = repo.parents()
     self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed'})
     commands.pull(self.repo.ui, repo)
     self.assertEqual(state, repo.parents())
     self.assertTrue('tip' not in repo[None].tags())
开发者ID:fuzzball81,项目名称:dotfiles,代码行数:7,代码来源:test_pull.py


示例4: test_onerevision_doupdate

 def test_onerevision_doupdate(self):
     repo = self._load_fixture_and_fetch('single_rev.svndump')
     state = repo.parents()
     self._add_svn_rev({'trunk/alpha': 'Changed'})
     commands.pull(self.repo.ui, repo, update=True)
     self.failIfEqual(state, repo.parents())
     self.assertTrue('tip' in repo[None].tags())
开发者ID:bulwinkel,项目名称:dot-files,代码行数:7,代码来源:test_pull.py


示例5: test_skip_delete_restore

 def test_skip_delete_restore(self):
     repo, repo_path = self._loadupdate('delete_restore_trunk.svndump',
                                        rev=2)
     repo.ui.setconfig('hgsubversion', 'unsafeskip', '3 4')
     commands.pull(repo.ui, repo)
     tip = repo['tip'].rev()
     self.assertEqual(tip, 1)
     self.assertEquals(verify.verify(repo.ui, repo, rev=tip), 0)
开发者ID:fuzzball81,项目名称:dotfiles,代码行数:8,代码来源:test_pull.py


示例6: test_old_tag_map_rebuilds

 def test_old_tag_map_rebuilds(self):
     repo = self._load_fixture_and_fetch('tag_name_same_as_branch.svndump')
     tm = os.path.join(repo.path, 'svn', 'tagmap')
     open(tm, 'w').write('1\n')
     # force tags to load since it is lazily loaded when needed
     repo.svnmeta().tags
     commands.pull(repo.ui, repo)
     self.assertEqual(open(tm).read().splitlines()[0], '2')
开发者ID:fuzzball81,项目名称:dotfiles,代码行数:8,代码来源:test_tags.py


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


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


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


示例10: test_skip_basic

 def test_skip_basic(self):
     repo, repo_path = self._loadupdate('single_rev.svndump')
     self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed'})
     self.add_svn_rev(repo_path, {'trunk/beta': 'More changed'})
     self.add_svn_rev(repo_path, {'trunk/gamma': 'Even more changeder'})
     repo.ui.setconfig('hgsubversion', 'unsafeskip', '3 4')
     commands.pull(repo.ui, repo)
     tip = repo['tip'].rev()
     self.assertEqual(tip, 1)
     self.assertEquals(verify.verify(repo.ui, repo, rev=tip), 1)
开发者ID:fuzzball81,项目名称:dotfiles,代码行数:10,代码来源:test_pull.py


示例11: pull

 def pull(self, url):
     """
     Tries to pull changes from external location.
     """
     url = self._get_url(url)
     try:
         pull(self.baseui, self._repo, url)
     except Abort, err:
         # Propagate error but with vcs's type
         raise RepositoryError(str(err))
开发者ID:lukaszb,项目名称:vcs,代码行数:10,代码来源:hg.py


示例12: pop_queue

def pop_queue(request, queue_name):
    # test count with
    # curl -i http://localhost:8000/q/default/
    # curl -i http://localhost:8000/q/default/json/
    
    # print "GET queue_name is %s" % queue_name
    q = None
    # pre-emptive queue name checking...
    try:
        q = Queue.objects.get(name=queue_name)
    except Queue.DoesNotExist:
        return HttpResponseNotFound()
    #
    msg = q.message_set.pop()
    response_message='void'
    if msg:
        u = ui.ui()
        message = json_encode(msg.message)
        project = Project.projects.get(project_id__exact = message['local_parent_project'])
        repo = Repo.objects.get(directory_name__exact=message['directory_name'], local_parent_project__exact=project)
        
        if (queue_name == 'repoclone'):
            try:
                hg.clone(u, str(repo.default_path), repo.repo_directory, True)
                repo.created = True
            except:
                response_message = 'failed'
            try:
                m = Message.objects.get(id=msg.id, queue=q.id)
                m.delete()
                repo.save()
                project.save()
                response_message = 'success'
            except:
                response_message = 'failed'
        elif (queue_name == 'repoupdate'):
            location = hg.repository(u, repo.repo_directory)
            try:
                commands.pull(u, location, str(repo.default_path), rev=['tip'], force=True, update=True)
                repo.folder_size = 0
                for (path, dirs, files) in os.walk(repo.repo_directory):
                    for file in files:
                        filename = os.path.join(path, file)
                        repo.folder_size += os.path.getsize(filename)
                repo.save()
                m = Message.objects.get(id=msg.id, queue=q.id)
                m.delete()
                project.save()
                response_message = 'success'
            except:
                response_message = 'failed'
    if (response_message == 'failed'):
        return HttpResponseServerError()
    else:
        return HttpResponse(response_message)
开发者ID:iSscorpio,项目名称:hgfront,代码行数:55,代码来源:views.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: update

	def update(self):
		"""
		Pull updates from the upstream repository.

		If ``newest`` is set to False in the recipe or in the buildout
		configuration, no action is taken.
		"""
		if self.newest:
			self.logger.info("Pulling repository %s and updating %s" % (
				self.repository, self.directory
			))
			commands.pull(ui.ui(), hg.repository(ui.ui(), self.directory),
				self.repository, update=True)
开发者ID:TheProjecter,项目名称:tipfyrecipes,代码行数:13,代码来源:hg.py


示例15: test_onerevision_divergent

 def test_onerevision_divergent(self):
     repo = self._load_fixture_and_fetch('single_rev.svndump')
     self.commitchanges((('alpha', 'alpha', 'Changed another way'),))
     state = repo.parents()
     self._add_svn_rev({'trunk/alpha': 'Changed one way'})
     try:
         commands.pull(self.repo.ui, repo, update=True)
     except hgutil.Abort:
         # hg < 1.9 raised when crossing branches
         pass
     self.assertEqual(state, repo.parents())
     self.assertTrue('tip' not in repo[None].tags())
     self.assertEqual(len(repo.heads()), 2)
开发者ID:avuori,项目名称:dotfiles,代码行数:13,代码来源:test_pull.py


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


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


示例18: hg_pull

def hg_pull(source, revision, update, verbose):
    print 'update repo revision %s at %s' % (revision, source,)
    if has_mercurial:
        u = ui.ui()
        repo = hg.repository(u, '.')
        rev = [revision,] if revision else None
        commands.pull(u, repo, source = source, rev = rev, update = update, verbose = verbose)
    else:
        if revision:
            cmd = 'hg pull -u -r%s %s' % (revision, source)
        else:
            cmd = 'hg pull -u %s' % (source)
        print cmd
        os.system(cmd)
    print 'updated repo at %s' % (source,)
开发者ID:ZoomQuiet,项目名称:openbookplatform,代码行数:15,代码来源:hg_helpers.py


示例19: pull_cmd

    def pull_cmd(self, wire, source, bookmark=None, branch=None, revision=None,
                 hooks=True):
        repo = self._factory.repo(wire)
        baseui = self._factory._create_config(wire['config'], hooks=hooks)

        # Mercurial internally has a lot of logic that checks ONLY if
        # option is defined, we just pass those if they are defined then
        opts = {}
        if bookmark:
            opts['bookmark'] = bookmark
        if branch:
            opts['branch'] = branch
        if revision:
            opts['rev'] = revision

        commands.pull(baseui, repo, source, **opts)
开发者ID:rhodecode,项目名称:rhodecode-vcsserver,代码行数:16,代码来源:hg.py


示例20: override_pull

def override_pull(orig, ui, repo, source=None, **opts):
    if opts.get('rebase', False):
        repo._isrebasing = True
        try:
            if opts.get('update'):
                 del opts['update']
                 ui.debug('--update and --rebase are not compatible, ignoring '
                          'the update flag\n')
            del opts['rebase']
            cmdutil.bailifchanged(repo)
            revsprepull = len(repo)
            origpostincoming = commands.postincoming
            def _dummy(*args, **kwargs):
                pass
            commands.postincoming = _dummy
            repo.lfpullsource = source
            if not source:
                source = 'default'
            try:
                result = commands.pull(ui, repo, source, **opts)
            finally:
                commands.postincoming = origpostincoming
            revspostpull = len(repo)
            if revspostpull > revsprepull:
                result = result or rebase.rebase(ui, repo)
        finally:
            repo._isrebasing = False
    else:
        repo.lfpullsource = source
        if not source:
            source = 'default'
        result = orig(ui, repo, source, **opts)
    return result
开发者ID:mortonfox,项目名称:cr48,代码行数:33,代码来源:overrides.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python commands.update函数代码示例发布时间:2022-05-27
下一篇:
Python commands.log函数代码示例发布时间: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