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


Python GitRepository.create方法代码示例

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


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

示例1: test_invalid_config_file

# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import create [as 别名]
 def test_invalid_config_file(self):
     """Test invalid config file"""
     # Create dummy invalid config file and run pq-rpm
     GitRepository.create('.')
     with open('.gbp.conf', 'w') as conffd:
         conffd.write('foobar\n')
     eq_(mock_pq(['foo']), 1)
     self._check_log(0, 'gbp:error: Invalid config file: File contains no '
                        'section headers.')
开发者ID:kelleyk,项目名称:git-buildpackage,代码行数:11,代码来源:test_pq_rpm.py

示例2: test_import_to_existing

# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import create [as 别名]
    def test_import_to_existing(self):
        """Test importing to an existing repo"""
        srpm = os.path.join(DATA_DIR, 'gbp-test-1.0-1.src.rpm')

        # Create new repo
        repo = GitRepository.create('myrepo')
        os.chdir('myrepo')
        shutil.copy2('.git/HEAD', 'foobar')
        repo.add_files('.')
        repo.commit_all('First commit')

        # Test importing to non-clean repo
        shutil.copy2('.git/HEAD', 'foobaz')
        eq_(mock_import(['--create-missing', srpm]), 1)
        self._check_log(0, 'gbp:error: Repository has uncommitted changes')
        self._clear_log()
        os.unlink('foobaz')

        # The first import should fail because upstream branch is missing
        eq_(mock_import([srpm]), 1)
        self._check_log(-1, 'Also check the --create-missing-branches')
        eq_(mock_import(['--no-pristine-tar', '--create-missing', srpm]), 0)
        self._check_repo_state(repo, 'master', ['master', 'upstream'])
        # Four commits: our initial, upstream and packaging files
        eq_(len(repo.get_commits()), 3)

        # The import should fail because missing packaging-branch
        srpm = os.path.join(DATA_DIR, 'gbp-test-1.1-1.src.rpm')
        eq_(mock_import(['--packaging-branch=foo', srpm]), 1)
        self._check_log(-1, 'Also check the --create-missing-branches')
开发者ID:c0ns0le,项目名称:git-buildpackage-rpm,代码行数:32,代码来源:test_import_srpm.py

示例3: setup_class

# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import create [as 别名]
 def setup_class(cls):
     """Initializations only made once per test run"""
     super(RpmRepoTestBase, cls).setup_class()
     cls.manifest = RepoManifest(os.path.join(RPM_TEST_DATA_DIR,
                                              'test-repo-manifest.xml'))
     cls.orig_repos = {}
     for prj, brs in cls.manifest.projects_iter():
         repo = GitRepository.create(os.path.join(cls._tmproot,
                                     '%s.repo' % prj))
         try:
             repo.add_remote_repo('origin', RPM_TEST_DATA_DIR, fetch=True)
         except GitRepositoryError:
             # Workaround for older git working on submodules initialized
             # with newer git
             gitfile = os.path.join(RPM_TEST_DATA_DIR, '.git')
             if os.path.isfile(gitfile):
                 with open(gitfile) as fobj:
                     link = fobj.readline().replace('gitdir:', '').strip()
                 link_dir = os.path.join(RPM_TEST_DATA_DIR, link)
                 repo.remove_remote_repo('origin')
                 repo.add_remote_repo('origin', link_dir, fetch=True)
             else:
                 raise
         # Fetch all remote refs of the orig repo, too
         repo.fetch('origin', tags=True,
                    refspec='refs/remotes/*:refs/upstream/*')
         for branch, rev in brs.iteritems():
             repo.create_branch(branch, rev)
         repo.force_head('master', hard=True)
         cls.orig_repos[prj] = repo
开发者ID:pombreda,项目名称:git-buildpackage-rpm,代码行数:32,代码来源:__init__.py

示例4: test_invalid_args

# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import create [as 别名]
    def test_invalid_args(self):
        """See that pq-rpm fails gracefully when called with invalid args"""
        GitRepository.create('.')
        # Test empty args
        eq_(mock_pq([]), 1)
        self._check_log(0, 'gbp:error: No action given.')
        self._clear_log()

        # Test invalid command
        eq_(mock_pq(['mycommand']), 1)
        self._check_log(0, "gbp:error: Unknown action 'mycommand'")
        self._clear_log()

        # Test invalid cmdline options
        with assert_raises(SystemExit):
            mock_pq(['--invalid-arg=123'])
开发者ID:kelleyk,项目名称:git-buildpackage,代码行数:18,代码来源:test_pq_rpm.py

示例5: test_basic_import_to_bare_repo

# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import create [as 别名]
 def test_basic_import_to_bare_repo(self):
     """Test importing of srpm to a bare git repository"""
     srpm = os.path.join(DATA_DIR, 'gbp-test-1.0-1.src.rpm')
     # Create new repo
     repo = GitRepository.create('myrepo', bare=True)
     os.chdir('myrepo')
     eq_(mock_import([srpm]), 0)
     self._check_repo_state(repo, 'master', ['master', 'upstream'])
     # Patch import to bare repos not supported -> only 2 commits
     eq_(len(repo.get_commits(until='master')), 2)
开发者ID:c0ns0le,项目名称:git-buildpackage-rpm,代码行数:12,代码来源:test_import_srpm.py

示例6: test_invalid_config_file

# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import create [as 别名]
 def test_invalid_config_file(self):
     """Test invalid config file"""
     # Create and commit dummy invalid config file
     repo = GitRepository.create('.')
     with open('.gbp.conf', 'w') as conffd:
         conffd.write('foobar\n')
     repo.add_files('.gbp.conf')
     repo.commit_all('Add conf')
     eq_(mock_gbp([]), 1)
     self._check_log(0, 'gbp:error: File contains no section headers.')
开发者ID:barak,项目名称:git-buildpackage,代码行数:12,代码来源:test_buildpackage_rpm.py

示例7: import_debian_tarball

# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import create [as 别名]
 def import_debian_tarball(cls, debian=DEFAULT_OVERLAY, opts=None):
     """Import a 3.0 (quilt) debian dir for overlay mode"""
     repo = GitRepository.create(os.path.split('/')[-1].split('_')[0])
     UnpackTarArchive(debian, repo.path)()
     repo.add_files('.')
     repo.commit_files('.', msg="debian dir")
     expected_branches = ['master']
     ComponentTestBase._check_repo_state(repo, 'master', expected_branches)
     eq_(len(repo.get_commits()), 1)
     os.chdir(repo.path)
     return repo
开发者ID:agx,项目名称:git-buildpackage,代码行数:13,代码来源:fixtures.py

示例8: test_invalid_args

# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import create [as 别名]
 def test_invalid_args(self):
     """Check graceful exit when called with invalid args"""
     GitRepository.create('.')
     with assert_raises(SystemExit):
         mock_gbp(['--git-invalid-arg'])
开发者ID:agx,项目名称:git-buildpackage,代码行数:7,代码来源:test_buildpackage_rpm.py

示例9: test_invalid_args

# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import create [as 别名]
    def test_invalid_args(self):
        """See that gbp-rpm-ch fails gracefully when called with invalid args"""
        GitRepository.create('.')

        with assert_raises(SystemExit):
            mock_ch(['--invalid-opt'])
开发者ID:teselkin,项目名称:git-buildpackage,代码行数:8,代码来源:test_rpm_ch.py

示例10: setUp

# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import create [as 别名]
 def setUp(self):
     ComponentTestBase.setUp(self)
     self.target = GitRepository.create('target', bare=True)
开发者ID:agx,项目名称:git-buildpackage,代码行数:5,代码来源:test_push.py


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