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


Python repository.GitRepository类代码示例

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


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

示例1: test_specify_upstream

 def test_specify_upstream(self, srcrpm):
     """Test --upstream command line option."""
     eq_(GBS(argv=["gbs", "import", "--upstream-branch=upstream",
                   srcrpm]), None)
     repo = GitRepository("./ail")
     eq_(repo.get_local_branches(), ['master', 'pristine-tar', 'upstream'])
     eq_(repo.get_tags(), ['upstream/0.2.29', 'vendor/0.2.29-2.3'])
开发者ID:01org,项目名称:gbs,代码行数:7,代码来源:test_import.py

示例2: test_set_author_name_email

 def test_set_author_name_email(self, srcrpm):
     """Test --author-name and --author-email command line options."""
     eq_(GBS(argv=["gbs", "import", "--author-name=test",
                   "[email protected]",
                   srcrpm]), None)
     repo = GitRepository("./app-core")
     eq_(repo.get_local_branches(), ['master', 'pristine-tar', 'upstream'])
     eq_(repo.get_tags(), ['upstream/1.2', 'vendor/1.2-19.3'])
开发者ID:01org,项目名称:gbs,代码行数:8,代码来源:test_import.py

示例3: test_import_spec

 def test_import_spec(self, srcdir):
     """Test importing from spec."""
     eq_(GBS(argv=["gbs", "import",
                   os.path.join(srcdir, 'bluez.spec')]), None)
     repo = GitRepository("./bluez")
     eq_(repo.get_local_branches(), ['master', 'pristine-tar', 'upstream'])
     # No packging tag as patch-import fails
     eq_(repo.get_tags(), ['upstream/4.87'])
     eq_(len(repo.get_commits(until='master')), 2)
开发者ID:01org,项目名称:gbs,代码行数:9,代码来源:test_import.py

示例4: test_import_in_submodule

 def test_import_in_submodule(self, repo):
     """
     Test that importing works if repo is a git submodule (#674015)
     """
     parent_repo = GitRepository.create('../parent')
     parent_repo.add_submodule(repo.path)
     parent_repo.update_submodules(init=True, recursive=True)
     submodule = GitRepository(os.path.join(parent_repo.path,
                                            'hello-debhelper'))
     ok_(submodule.path.endswith, 'parent/hello-debhelper')
     os.chdir(submodule.path)
     orig = self._orig('2.8')
     submodule.create_branch('upstream', 'origin/upstream')
     ok_(import_orig(['arg0', '--no-interactive', orig]) == 0)
开发者ID:marquiz,项目名称:git-buildpackage-rpm,代码行数:14,代码来源:test_import_orig.py

示例5: setup_module

def setup_module():
    """One setup for all tests."""

    ENV["cwd"] = os.getcwd()
    tmp = tempfile.mkdtemp(prefix="test-gbs-changelog-")
    shutil.copy(".gbs.conf", tmp)
    os.chdir(tmp)
    ENV["dir"] = tmp

    # Create git repo
    repo = GitRepository.create(".")
    author = repo.get_author_info()
    ENV["repo"] = repo
    ENV["name"] = author.name
    ENV["email"] = author.email

    # Make 3 commits
    for num in (1, 2, 3):
        with open("file", "w") as fobj:
            fobj.write("content %d" % num)
        time.sleep(1)  # Sleep to make commit timestamps differ
        repo.add_files(repo.path, untracked=True)
        repo.commit_files(files="file", msg="change %d" % num)

    ENV["date"] = datetime.datetime.now().strftime("%a %b %d %Y")
    commits = sorted(repo.get_commits(options=["--pretty=format:%at %H"]), reverse=True)

    ENV["commits"] = [item.split()[-1] for item in commits]
开发者ID:01org,项目名称:gbs,代码行数:28,代码来源:test_changelog.py

示例6: test_guess_spec_repo

    def test_guess_spec_repo(self):
        """Test guess_spec_repo() and spec_from_repo() functions"""
        # Create dummy repository with some commits
        repo = GitRepository.create(self.tmpdir)
        with open(os.path.join(repo.path, "foo.txt"), "w") as fobj:
            fobj.write("bar\n")
        repo.add_files("foo.txt")
        repo.commit_all("Add dummy file")
        os.mkdir(os.path.join(repo.path, "packaging"))
        shutil.copy(os.path.join(SPEC_DIR, "gbp-test.spec"), os.path.join(repo.path, "packaging"))
        repo.add_files("packaging/gbp-test.spec")
        repo.commit_all("Add spec file")

        # Spec not found
        with assert_raises(NoSpecError):
            guess_spec_repo(repo, "HEAD~1", recursive=True)
        with assert_raises(NoSpecError):
            guess_spec_repo(repo, "HEAD", recursive=False)
        # Spec found
        spec = guess_spec_repo(repo, "HEAD", "packaging", recursive=False)
        spec = guess_spec_repo(repo, "HEAD", recursive=True)
        eq_(spec.specfile, "gbp-test.spec")
        eq_(spec.specdir, "packaging")
        eq_(spec.specpath, "packaging/gbp-test.spec")

        # Test spec_from_repo()
        with assert_raises(NoSpecError):
            spec_from_repo(repo, "HEAD~1", "packaging/gbp-test.spec")
        spec = spec_from_repo(repo, "HEAD", "packaging/gbp-test.spec")
        eq_(spec.specfile, "gbp-test.spec")
开发者ID:seacoastboy,项目名称:git-buildpackage,代码行数:30,代码来源:20_test_rpm.py

示例7: create_orig_repo

    def create_orig_repo(cls, name):
        """Create test repo"""
        repo_path = os.path.join(cls.workdir, name)
        repo = GitRepository.create(repo_path)

        # First, commit sources only and create branch 'sources'
        sources = [src for src in os.listdir(TEST_DATA_DIR)
                       if not src in ['packaging', 'debian']]
        repo.add_files(sources, work_tree=TEST_DATA_DIR)
        repo.commit_staged('Initial version')
        # Make one new commit
        cls.update_repository_file(repo, 'foo.txt', 'new data\n')
        repo.create_branch('source')

        # Create branch with rpm packaging only
        repo.add_files('packaging', work_tree=TEST_DATA_DIR)
        repo.commit_staged('Add rpm packaging files')
        repo.create_branch('rpm')

        # Master has both debian and rpm packaging
        repo.add_files('debian', work_tree=TEST_DATA_DIR)
        repo.commit_staged('Add debian packaging files')

        # Create branch with deb packaging only
        repo.create_branch('deb', 'source')
        repo.set_branch('deb')
        repo.add_files('debian', work_tree=TEST_DATA_DIR)
        repo.commit_staged('Add deb packaging files')

        repo.set_branch('master')
        repo.force_head('master', hard=True)
        return repo
开发者ID:ronan22,项目名称:obs-service-git-buildpackage,代码行数:32,代码来源:__init__.py

示例8: test_guess_spec_repo

    def test_guess_spec_repo(self):
        """Test guess_spec_repo() and spec_from_repo() functions"""
        # Create dummy repository with some commits
        repo = GitRepository.create(self.tmpdir)
        with open(os.path.join(repo.path, 'foo.txt'), 'w') as fobj:
            fobj.write('bar\n')
        repo.add_files('foo.txt')
        repo.commit_all('Add dummy file')
        os.mkdir(os.path.join(repo.path, 'packaging'))
        shutil.copy(os.path.join(SPEC_DIR, 'gbp-test.spec'),
                    os.path.join(repo.path, 'packaging'))
        repo.add_files('packaging/gbp-test.spec')
        repo.commit_all('Add spec file')

        # Spec not found
        with assert_raises(NoSpecError):
            guess_spec_repo(repo, 'HEAD~1', recursive=True)
        with assert_raises(NoSpecError):
            guess_spec_repo(repo, 'HEAD', recursive=False)
        # Spec found
        spec = guess_spec_repo(repo, 'HEAD', 'packaging', recursive=False)
        spec = guess_spec_repo(repo, 'HEAD', recursive=True)
        eq_(spec.specfile, 'gbp-test.spec')
        eq_(spec.specdir, 'packaging')
        eq_(spec.specpath, 'packaging/gbp-test.spec')

        # Test spec_from_repo()
        with assert_raises(NoSpecError):
            spec_from_repo(repo, 'HEAD~1', 'packaging/gbp-test.spec')
        spec = spec_from_repo(repo, 'HEAD', 'packaging/gbp-test.spec')
        eq_(spec.specfile, 'gbp-test.spec')
开发者ID:andrewlukoshko,项目名称:git-buildpackage,代码行数:31,代码来源:20_test_rpm.py

示例9: test_initial_import_fail_create_upstream_tag

    def test_initial_import_fail_create_upstream_tag(self, RepoMock):
        repo = GitRepository.create(self.pkg)
        os.chdir(self.pkg)
        orig = self._orig('2.6')
        ok_(import_orig(['arg0', '--no-interactive', orig]) == 1)

        self._check_repo_state(repo, None, [], tags=[])
开发者ID:ottok,项目名称:git-buildpackage,代码行数:7,代码来源:test_import_orig.py

示例10: test_initial_import

 def test_initial_import(self):
     """Test that importing into an empty repo works"""
     repo = GitRepository.create(self.pkg)
     os.chdir(self.pkg)
     orig = self._orig('2.6')
     ok_(import_orig(['arg0', '--no-interactive', '--pristine-tar', orig]) == 0)
     self._check_repo_state(repo, 'master', self.def_branches,
                            tags=['upstream/2.6'])
开发者ID:marquiz,项目名称:git-buildpackage-rpm,代码行数:8,代码来源:test_import_orig.py

示例11: test_running_from_git_tree

 def test_running_from_git_tree(self, srcrpm):
     """Test running gbs import from git tree."""
     # Create empty git repo
     repo = GitRepository.create("./repo_dir")
     os.chdir(repo.path)
     eq_(GBS(argv=["gbs", "import", srcrpm]), None)
     eq_(repo.get_local_branches(), ['master', 'pristine-tar', 'upstream'])
     eq_(repo.get_tags(), ['upstream/0.2.29', 'vendor/0.2.29-2.5'])
开发者ID:01org,项目名称:gbs,代码行数:8,代码来源:test_import.py

示例12: test_download

 def test_download(self):
     """Test that importing via download works"""
     repo = GitRepository.create(self.pkg)
     os.chdir(self.pkg)
     orig = self._download_url('2.6')
     ok_(import_orig(['arg0', '--no-interactive', '--pristine-tar', orig]) == 0)
     self._check_repo_state(repo, 'master', self.def_branches,
                            tags=['upstream/2.6'])
开发者ID:marquiz,项目名称:git-buildpackage-rpm,代码行数:8,代码来源:test_import_orig.py

示例13: test_initial_import_fail_create_debian_branch

    def test_initial_import_fail_create_debian_branch(self):
        repo = GitRepository.create(self.pkg)
        os.chdir(self.pkg)
        orig = self._orig('2.6')

        with patch('gbp.git.repository.GitRepository.create_branch',
                   side_effect=GitRepositoryError('this is a create branch error mock')):
            ok_(import_orig(['arg0', '--no-interactive', '--pristine-tar', orig]) == 1)

        self._check_repo_state(repo, None, [], tags=[])
开发者ID:ottok,项目名称:git-buildpackage,代码行数:10,代码来源:test_import_orig.py

示例14: test_update

    def test_update(self):
        repo = GitRepository.create(self.pkg)
        os.chdir(self.pkg)

        dsc = self._dsc('2.6-2')
        ok_(import_dsc(['arg0', '--pristine-tar', dsc]) == 0)
        self._check_repo_state(repo, 'master', ['master', 'upstream', 'pristine-tar'])

        self._orig('2.8')
        self._check_repo_state(repo, 'master', ['master', 'upstream', 'pristine-tar'],
                               tags=['debian/2.6-2', 'upstream/2.6'])
开发者ID:ottok,项目名称:git-buildpackage,代码行数:11,代码来源:test_import_orig.py

示例15: test_initial_import_fail_create_upstream_tag

    def test_initial_import_fail_create_upstream_tag(self, RepoMock):
        """
        Test that we can rollback from a failure to create the upstream
        tag on initial import
        """
        repo = GitRepository.create(self.pkg)
        os.chdir(repo.path)
        orig = self._orig('2.6')
        ok_(import_orig(['arg0', '--no-interactive', orig]) == 1)

        self._check_repo_state(repo, None, [], tags=[])
开发者ID:marquiz,项目名称:git-buildpackage-rpm,代码行数:11,代码来源:test_import_orig.py


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