def test_misc_options(self):
        """Test various options of git-import-srpm"""
        srpm = os.path.join(DATA_DIR, 'gbp-test2-2.0-0.src.rpm')

        eq_(mock_import(['--no-pristine-tar',
                    '--packaging-branch=pack',
                    '--upstream-branch=orig',
                    '--packaging-dir=packaging',
                    '--packaging-tag=ver_%(upstreamversion)s-rel_%(release)s',
                    '--upstream-tag=orig/%(upstreamversion)s',
                    '--author-is-committer',
                    srpm]), 0)
        # Check repository state
        repo = GitRepository('gbp-test2')
        files = {'Makefile', 'README', 'dummy.sh', 'packaging/bar.tar.gz',
                 'packaging/foo.txt', 'packaging/gbp-test2.spec',
                 'packaging/gbp-test2-alt.spec', 'packaging/my.patch',
                 'packaging/my2.patch', 'packaging/my3.patch'}
        self._check_repo_state(repo, 'pack', ['pack', 'orig'], files)
        eq_(len(repo.get_commits()), 2)
        # Check packaging dir
        eq_(len(repo.get_commits(paths='packaging')), 1)
        # Check tags
        tags = repo.get_tags()
        eq_(set(tags), set(['orig/2.0', 'ver_2.0-rel_0']))
        # Check git committer/author
        info = repo.get_commit_info('pack')
        eq_(info['author'].name, 'Markus Lehtonen')
        eq_(info['author'].email, '*****@*****.**')
        eq_(info['author'].name, info['committer'].name)
        eq_(info['author'].email, info['committer'].email)
    def test_misc_options(self):
        """Test various options of git-import-srpm"""
        srpm = os.path.join(DATA_DIR, 'gbp-test2-2.0-0.src.rpm')

        eq_(
            mock_import([
                '--no-patch-import', '--packaging-branch=pack',
                '--upstream-branch=orig', '--packaging-dir=packaging',
                '--packaging-tag=ver_%(upstreamversion)s-rel_%(release)s',
                '--upstream-tag=orig/%(upstreamversion)s',
                '--author-is-committer', srpm
            ]), 0)
        # Check repository state
        repo = GitRepository('gbp-test2')
        files = set([
            'Makefile', 'README', 'dummy.sh', 'packaging/bar.tar.gz',
            'packaging/foo.txt', 'packaging/gbp-test2.spec',
            'packaging/gbp-test2-alt.spec', 'packaging/my.patch',
            'packaging/my2.patch', 'packaging/my3.patch'
        ])
        self._check_repo_state(repo, 'pack', ['pack', 'orig'], files)
        eq_(len(repo.get_commits()), 2)
        # Check packaging dir
        eq_(len(repo.get_commits(paths='packaging')), 1)
        # Check tags
        tags = repo.get_tags()
        eq_(set(tags), set(['orig/2.0', 'ver_2.0-rel_0']))
        # Check git committer/author
        info = repo.get_commit_info('pack')
        eq_(info['author'].name, 'Markus Lehtonen')
        eq_(info['author'].email, '*****@*****.**')
        eq_(info['author'].name, info['committer'].name)
        eq_(info['author'].email, info['committer'].email)
Пример #3
0
    def test_misc_options(self):
        """Test various options of git-import-srpm"""
        srpm = os.path.join(DATA_DIR, 'gbp-test2-2.0-0.src.rpm')

        eq_(
            mock_import([
                '--no-pristine-tar', '--packaging-branch=pack',
                '--upstream-branch=orig', '--packaging-dir=packaging',
                '--packaging-tag=ver_%(upstreamversion)s-rel_%(release)s',
                '--upstream-tag=orig/%(upstreamversion)s',
                '--author-is-committer', srpm
            ]), 0)
        # Check repository state
        repo = GitRepository('gbp-test2')
        files = {
            'Makefile', 'README', 'dummy.sh', 'packaging/bar.tar.gz',
            'packaging/foo.txt', 'packaging/gbp-test2.spec',
            'packaging/gbp-test2-alt.spec', 'packaging/my.patch',
            'packaging/my2.patch', 'packaging/my3.patch'
        }
        self._check_repo_state(repo, 'pack', ['pack', 'orig'], files)
        eq_(len(repo.get_commits()), 2)
        # Check packaging dir
        eq_(len(repo.get_commits(paths='packaging')), 1)
        # Check tags
        tags = repo.get_tags()
        eq_(set(tags), set(['orig/2.0', 'ver_2.0-rel_0']))
        # Check git committer/author
        info = repo.get_commit_info('pack')
        eq_(info['author'].name, 'Markus Lehtonen')
        eq_(info['author'].email, '*****@*****.**')
        eq_(info['author'].name, info['committer'].name)
        eq_(info['author'].email, info['committer'].email)

        # Create a new commit by committing an empty tree
        commit = repo.commit_tree('4b825dc642cb6eb9a060e54bf8d69288fbee4904',
                                  msg="Empty commit",
                                  parents=[])
        repo.create_tag('foo/1.0', msg="New tag", commit=commit)
        # Just blindly import another package on top of this to test more options
        os.chdir('gbp-test2')
        srpm = os.path.join(DATA_DIR, 'gbp-test-1.0-1.src.rpm')
        eq_(
            mock_import([
                '--upstream-vcs-tag=foo/%(version)s', '--upstream-branch=orig',
                '--packaging-branch=pack', srpm
            ]), 0)
        parents = repo.get_commits(until='orig', num=1,
                                   options='--format=%P')[0].split()
        eq_(len(parents), 2)
        ok_(commit in parents)
        ok_(repo.rev_parse('orig/2.0^{}') in parents)
Пример #4
0
    def test_misc_options(self):
        """Test various options of git-import-srpm"""
        srpm = os.path.join(DATA_DIR, 'gbp-test2-2.0-0.src.rpm')

        eq_(mock_import(['--no-pristine-tar',
                         '--packaging-branch=pack',
                         '--upstream-branch=orig',
                         '--packaging-dir=packaging',
                         '--packaging-tag=ver_%(upstreamversion)s-rel_%(release)s',
                         '--upstream-tag=orig/%(upstreamversion)s',
                         '--author-is-committer',
                         srpm]), 0)
        # Check repository state
        repo = GitRepository('gbp-test2')
        files = {'Makefile', 'README', 'dummy.sh', 'packaging/bar.tar.gz',
                 'packaging/foo.txt', 'packaging/gbp-test2.spec',
                 'packaging/gbp-test2-alt.spec', 'packaging/my.patch',
                 'packaging/my2.patch', 'packaging/my3.patch'}
        self._check_repo_state(repo, 'pack', ['pack', 'orig'], files)
        eq_(len(repo.get_commits()), 2)
        # Check packaging dir
        eq_(len(repo.get_commits(paths='packaging')), 1)
        # Check tags
        tags = repo.get_tags()
        eq_(set(tags), set(['orig/2.0', 'ver_2.0-rel_0']))
        # Check git committer/author
        info = repo.get_commit_info('pack')
        eq_(info['author'].name, 'Markus Lehtonen')
        eq_(info['author'].email, '*****@*****.**')
        eq_(info['author'].name, info['committer'].name)
        eq_(info['author'].email, info['committer'].email)

        # Create a new commit by committing an empty tree
        commit = repo.commit_tree('4b825dc642cb6eb9a060e54bf8d69288fbee4904',
                                  msg="Empty commit", parents=[])
        repo.create_tag('foo/1.0', msg="New tag", commit=commit)
        # Just blindly import another package on top of this to test more options
        os.chdir('gbp-test2')
        srpm = os.path.join(DATA_DIR, 'gbp-test-1.0-1.src.rpm')
        eq_(mock_import(['--upstream-vcs-tag=foo/%(version)s',
                         '--upstream-branch=orig',
                         '--packaging-branch=pack',
                         srpm]), 0)
        parents = repo.get_commits(until='orig', num=1, options='--format=%P')[0].split()
        eq_(len(parents), 2)
        ok_(commit in parents)
        ok_(repo.rev_parse('orig/2.0^{}') in parents)
Пример #5
0
    def test_misc_options(self):
        """Test various options of git-import-srpm"""
        srpm = os.path.join(DATA_DIR, "gbp-test2-2.0-0.src.rpm")

        eq_(
            mock_import(
                [
                    "--no-pristine-tar",
                    "--packaging-branch=pack",
                    "--upstream-branch=orig",
                    "--packaging-dir=packaging",
                    "--packaging-tag=ver_%(upstreamversion)s-rel_%(release)s",
                    "--upstream-tag=orig/%(upstreamversion)s",
                    "--author-is-committer",
                    srpm,
                ]
            ),
            0,
        )
        # Check repository state
        repo = GitRepository("gbp-test2")
        files = {
            "Makefile",
            "README",
            "dummy.sh",
            "packaging/bar.tar.gz",
            "packaging/foo.txt",
            "packaging/gbp-test2.spec",
            "packaging/gbp-test2-alt.spec",
            "packaging/my.patch",
            "packaging/my2.patch",
            "packaging/my3.patch",
        }
        self._check_repo_state(repo, "pack", ["pack", "orig"], files)
        eq_(len(repo.get_commits()), 2)
        # Check packaging dir
        eq_(len(repo.get_commits(paths="packaging")), 1)
        # Check tags
        tags = repo.get_tags()
        eq_(set(tags), set(["orig/2.0", "ver_2.0-rel_0"]))
        # Check git committer/author
        info = repo.get_commit_info("pack")
        eq_(info["author"].name, "Markus Lehtonen")
        eq_(info["author"].email, "*****@*****.**")
        eq_(info["author"].name, info["committer"].name)
        eq_(info["author"].email, info["committer"].email)