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


Python client.LocalGitClient类代码示例

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


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

示例1: test_fetch_empty

 def test_fetch_empty(self):
     c = LocalGitClient()
     s = open_repo('a.git')
     out = BytesIO()
     walker = {}
     c.fetch_pack(s.path, lambda heads: [], graph_walker=walker,
         pack_data=out.write)
     self.assertEquals("PACK\x00\x00\x00\x02\x00\x00\x00\x00\x02\x9d\x08"
         "\x82;\xd8\xa8\xea\xb5\x10\xadj\xc7\\\x82<\xfd>\xd3\x1e", out.getvalue())
开发者ID:imclab,项目名称:dulwich,代码行数:9,代码来源:test_client.py

示例2: test_fetch_pack_none

 def test_fetch_pack_none(self):
     c = LocalGitClient()
     s = open_repo('a.git')
     out = BytesIO()
     walker = MemoryRepo().get_graph_walker()
     c.fetch_pack(s.path,
         lambda heads: ["a90fa2d900a17e99b433217e988c4eb4a2e9a097"],
         graph_walker=walker, pack_data=out.write)
     # Hardcoding is not ideal, but we'll fix that some other day..
     self.assertTrue(out.getvalue().startswith('PACK\x00\x00\x00\x02\x00\x00\x00\x07'))
开发者ID:imclab,项目名称:dulwich,代码行数:10,代码来源:test_client.py

示例3: test_fetch_pack_none

 def test_fetch_pack_none(self):
     c = LocalGitClient()
     s = open_repo('a.git')
     out = StringIO()
     walker = MemoryRepo().get_graph_walker()
     c.fetch_pack(s.path,
         lambda heads: ["a90fa2d900a17e99b433217e988c4eb4a2e9a097"],
         graph_walker=walker, pack_data=out.write)
     # Hardcoding is not ideal, but we'll fix that some other day..
     self.assertEquals(out.getvalue(), 'PACK\x00\x00\x00\x02\x00\x00\x00\x07\x90\x0cx\x9c\xa5\xccM\n\xc20\[email protected]\xe1}N1\xfb\x82$v\xe2$ \xa2[/\xe0z\xd2\x19\xb1\x85\xa4\xd0\x8e\x14o\xef\xcf\x15|\xcbo\xf1lQ\x05\x92\xcc\x9e\x842\xc5\x1c\xf5\x1eB\x8f\x181\x97$>\x85\x9c\x14\xd3\x10b\[email protected]\xc7O{\xcc\x0b\\\xb9\xea\n7]\xad\xbc\xe08m\x9dh\x19\xb9\x9d\xa7\xafo?\xde5\xb5\x13\[email protected]\x14\xfd>C\xe7?\xb9a\xaeu4\xd3\x7f\x1e\xee"\x02\x0c\xdc\x04\x8a{\x03\x1a4:\\\x9a\x0ex\x9c\xa5\xccM\n\xc3 \[email protected]\xe1\xbd\xa7p\x1f(j\x1cG\xa1\x94v\xdb\x0bt=:#M II,\xa1\xb7\xef\xcf\x15\xfa\x96\xdf\xe2\xb5UD\xd7\xca\x1e\xd9C\[email protected]\xb1\x06\xc0\xe0\x93\x15+\x9c\x13J_%P\x04#X\xd5\x83V\x99\x9bv\x84\x8e\x93K!\xb9\xe2-G\x00_\x0c\xd6\xd0\x1b\x8b\x80\x99l\xa4\x00\x9c\xac\xa2g\xbb/\xab\xbe\xd2$\x9b\xbe\xc9\xd6\xf2K\x1f\xc7\xbdc\xc9\x03\xcd\xe7\xf1\xeb\xfb\x8f\x0f\xb3\xb4\x93\xb6\x16="\x18\x8f\xba3\x9fTY\xa6ihM\xfey\xa8\x0b\xb3.\xea\rM\xb6F\x9c\xaa\x03x\x9c340031QHd\xf0\xfb\xcc\xbd\xffQ\x8a\xe1\xb29\x16\n\x97\x975\xdf\x0f\xb9\xd6\xf1\xe9\x8d!D2\x89\xc1_/US\xc1j\xd9\x15\xef\xa8o\x8f5u\x9ak\xde.`\xfe\t\x00\x97P\x18#7x\x9cK\xcb\xccIUH\xe4\x02\x00\n#\x02,7x\x9cK\xcb\xccIUH\xe2\x02\x00\n%\x02-\xa7\x05x\x9c340031QHd\xf0\xfb\xcc\xbd\xffQ\x8a\xe1\xb29\x16\n\x97\x975\xdf\x0f\xb9\xd6\xf1\xe9\x8d!D2\x89\xc1_/US\xc1j\xd9\x15\xef\xa8o\x8f5u\x9ak\xde.`\xfe\t\x95LfX4\xed\xc2\xeeD\xc1\x8eS\xbbU3%?g\x1ff\x14?\xb3\x80\x15\x00\xec0#h7x\x9cK\xcb\xccIUH\xe6\x02\x00\n\'\x02.\x8d7\x98\xae\xef7L\x95\x18\x94\x80X\xf1Q\xfb\xdc\xd9\xcf\xe7\xc3')
开发者ID:hloeung,项目名称:dulwich,代码行数:10,代码来源:test_client.py

示例4: fetch

    def fetch(self, wire, url, apply_refs=True, refs=None):
        if url != 'default' and '://' not in url:
            client = LocalGitClient(url)
        else:
            url_obj = hg_url(url)
            o = self._build_opener(url)
            url, _ = url_obj.authinfo()
            client = HttpGitClient(base_url=url, opener=o)
        repo = self._factory.repo(wire)

        determine_wants = repo.object_store.determine_wants_all
        if refs:
            def determine_wants_requested(references):
                return [references[r] for r in references if r in refs]
            determine_wants = determine_wants_requested

        try:
            remote_refs = client.fetch(
                path=url, target=repo, determine_wants=determine_wants)
        except NotGitRepository:
            log.warning(
                'Trying to fetch from "%s" failed, not a Git repository.', url)
            raise exceptions.AbortException()

        # mikhail: client.fetch() returns all the remote refs, but fetches only
        # refs filtered by `determine_wants` function. We need to filter result
        # as well
        if refs:
            remote_refs = {k: remote_refs[k] for k in remote_refs if k in refs}

        if apply_refs:
            # TODO: johbo: Needs proper test coverage with a git repository
            # that contains a tag object, so that we would end up with
            # a peeled ref at this point.
            PEELED_REF_MARKER = '^{}'
            for k in remote_refs:
                if k.endswith(PEELED_REF_MARKER):
                    log.info("Skipping peeled reference %s", k)
                    continue
                repo[k] = remote_refs[k]

            if refs:
                # mikhail: explicitly set the head to the last ref.
                repo['HEAD'] = remote_refs[refs[-1]]

            # TODO: mikhail: should we return remote_refs here to be
            # consistent?
        else:
            return remote_refs
开发者ID:rhodecode,项目名称:rhodecode-vcsserver,代码行数:49,代码来源:git.py

示例5: test_fetch_empty

 def test_fetch_empty(self):
     c = LocalGitClient()
     s = open_repo('a.git')
     self.addCleanup(tear_down_repo, s)
     out = BytesIO()
     walker = {}
     ret = c.fetch_pack(s.path, lambda heads: [], graph_walker=walker,
         pack_data=out.write)
     self.assertEqual({
         b'HEAD': b'a90fa2d900a17e99b433217e988c4eb4a2e9a097',
         b'refs/heads/master': b'a90fa2d900a17e99b433217e988c4eb4a2e9a097',
         b'refs/tags/mytag': b'28237f4dc30d0d462658d6b937b08a0f0b6ef55a',
         b'refs/tags/mytag-packed': b'b0931cadc54336e78a1d980420e3268903b57a50'
         }, ret)
     self.assertEqual(b"PACK\x00\x00\x00\x02\x00\x00\x00\x00\x02\x9d\x08"
         b"\x82;\xd8\xa8\xea\xb5\x10\xadj\xc7\\\x82<\xfd>\xd3\x1e", out.getvalue())
开发者ID:mjmaenpaa,项目名称:dulwich,代码行数:16,代码来源:test_client.py

示例6: test_fetch_pack_none

 def test_fetch_pack_none(self):
     c = LocalGitClient()
     s = open_repo('a.git')
     self.addCleanup(tear_down_repo, s)
     out = BytesIO()
     walker = MemoryRepo().get_graph_walker()
     ret = c.fetch_pack(
         s.path,
         lambda heads: [b"a90fa2d900a17e99b433217e988c4eb4a2e9a097"],
         graph_walker=walker, pack_data=out.write)
     self.assertEqual({b'HEAD': b'refs/heads/master'}, ret.symrefs)
     self.assertEqual({
         b'HEAD': b'a90fa2d900a17e99b433217e988c4eb4a2e9a097',
         b'refs/heads/master': b'a90fa2d900a17e99b433217e988c4eb4a2e9a097',
         b'refs/tags/mytag': b'28237f4dc30d0d462658d6b937b08a0f0b6ef55a',
         b'refs/tags/mytag-packed':
         b'b0931cadc54336e78a1d980420e3268903b57a50'
         }, ret.refs)
     # Hardcoding is not ideal, but we'll fix that some other day..
     self.assertTrue(out.getvalue().startswith(
             b'PACK\x00\x00\x00\x02\x00\x00\x00\x07'))
开发者ID:atbradley,项目名称:dulwich,代码行数:21,代码来源:test_client.py

示例7: fetch_all

def fetch_all(source_repo, target_repo, remote_name=None):
    """Fetch branches and tags from a remote repository

    Unlike :code:`git fetch`, this will also update local branches to point at
    the same commit as their remote counterpart.

     Parameters
    ----------
    source_repo : dulwich.repo.Repo
    target_repo : dulwich.repo.Repo
    remote_name : str
    """
    if remote_name is None:
        remote_name = 'origin'

    refs = LocalGitClient().fetch(source_repo.path, target_repo)

    for key, value in refs.items():
        remote_key = key.replace(
            b'heads', b'remotes/%s' % bytes(remote_name, encoding='UTF-8'))
        target_repo.refs[remote_key] = value
        target_repo[key] = value
开发者ID:Empiria,项目名称:matador,代码行数:22,代码来源:git.py

示例8: test_fetch_into_empty

 def test_fetch_into_empty(self):
     c = LocalGitClient()
     t = MemoryRepo()
     s = open_repo('a.git')
     self.assertEquals(s.get_refs(), c.fetch(s.path, t))
开发者ID:imclab,项目名称:dulwich,代码行数:5,代码来源:test_client.py

示例9: test_fetch_into_empty

 def test_fetch_into_empty(self):
     c = LocalGitClient()
     t = MemoryRepo()
     s = open_repo('a.git')
     self.addCleanup(tear_down_repo, s)
     self.assertEqual(s.get_refs(), c.fetch(s.path, t).refs)
开发者ID:atbradley,项目名称:dulwich,代码行数:6,代码来源:test_client.py

示例10: test_get_url

    def test_get_url(self):
        path = "/tmp/repo.git"
        c = LocalGitClient()

        url = c.get_url(path)
        self.assertEqual('file:///tmp/repo.git', url)
开发者ID:atbradley,项目名称:dulwich,代码行数:6,代码来源:test_client.py


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