Exemplo n.º 1
0
 def test_finish_release_keep(self):
     gitflow = GitFlow(self.repo)
     mgr = ReleaseBranchManager(gitflow)
     mgr.finish('1.0', keep=True)
     # release branch still exists
     self.assertIn('rel/1.0',
             [b.name for b in self.repo.branches])
Exemplo n.º 2
0
 def test_finish_release_tag_sign(self):
     gitflow = GitFlow(self.repo)
     mgr = ReleaseBranchManager(gitflow)
     taginfo = dict(
         message='Tagging version 1.0',
         signingkey='Dummy Key for Gitflow testing',
     )
     mgr.finish('1.0', tagging_info=taginfo)
     # tag message
     tag = self.repo.tags['v1.0'].tag
     self.assertIn('-----BEGIN PGP SIGNATURE-----', tag.message)
Exemplo n.º 3
0
 def test_finish_release_tag_sign(self):
     gitflow = GitFlow(self.repo)
     mgr = ReleaseBranchManager(gitflow)
     taginfo = dict(
         message = 'Tagging version 1.0',
         signingkey = 'Dummy Key for Gitflow testing',
         )
     mgr.finish('1.0', tagging_info=taginfo)
     # tag message
     tag = self.repo.tags['v1.0'].tag
     self.assertIn('-----BEGIN PGP SIGNATURE-----', tag.message)
Exemplo n.º 4
0
    def test_finish_release_push_keep(self):
        # Since remote is no bare repo, checkout some branch untouched
        # by this operation. :fixme: find better solution
        self.remote.heads['feat/even'].checkout()
        gitflow = GitFlow(self.repo).init()
        mgr = ReleaseBranchManager(gitflow)
        mgr.create('1.0')
        mgr.finish('1.0', push=True, keep=True)

        # release branch still exists local and remote
        self.assertIn('rel/1.0', [b.name for b in self.repo.branches])
        self.assertIn('rel/1.0', [b.name for b in self.remote.branches])
Exemplo n.º 5
0
    def test_finish_release_push_keep(self):
        # Since remote is no bare repo, checkout some branch untouched
        # by this operation. :fixme: find better solution
        self.remote.heads['feat/even'].checkout()
        gitflow = GitFlow(self.repo).init()
        mgr = ReleaseBranchManager(gitflow)
        mgr.create('1.0')
        mgr.finish('1.0', push=True, keep=True)

        # release branch still exists local and remote
        self.assertIn('rel/1.0',
                [b.name for b in self.repo.branches])
        self.assertIn('rel/1.0',
                [b.name for b in self.remote.branches])
Exemplo n.º 6
0
 def test_finish_release_tag(self):
     gitflow = GitFlow(self.repo)
     mgr = ReleaseBranchManager(gitflow)
     taginfo = dict(message='Tagging version 1.0')
     mgr.finish('1.0', tagging_info=taginfo)
     mc1 = gitflow.master().commit
     dc1 = gitflow.develop().commit
     # master is merged back to develop
     self.assertIn(mc1, dc1.parents)
     # tag exists
     self.assertIn('v1.0', self.repo.tags)
     self.assertEqual(self.repo.tags['v1.0'].commit, mc1)
     # tag message
     self.assertEqual(self.repo.tags['v1.0'].tag.message,
                      'Tagging version 1.0')
Exemplo n.º 7
0
    def test_finish_release_merge_conflict(self):
        gitflow = GitFlow(self.repo).init()
        fmgr = FeatureBranchManager(gitflow)
        fmgr.finish('even')
        fake_commit(self.repo, 'Overwrite version', filename='VERSION')

        mgr = ReleaseBranchManager(gitflow)
        self.assertRaises(MergeError, mgr.finish, '1.0')
        # resolve the conflict
        gitflow.git.rm('VERSION')
        gitflow.git.commit('-F.git/MERGE_MSG')
        # the release branch is still here
        self.assertIn('rel/1.0', [b.name for b in self.repo.branches])
        mgr.finish('1.0')
        # now the release branch is gone
        self.assertNotIn('rel/1.0', [b.name for b in self.repo.branches])
Exemplo n.º 8
0
    def test_finish_release_tag_sign_push(self):
        # Since remote is no bare repo, checkout some branch untouched
        # by this operation. :fixme: find better solution
        self.remote.heads['feat/even'].checkout()
        gitflow = GitFlow(self.repo).init()

        mgr = ReleaseBranchManager(gitflow)
        mgr.create('1.0')
        taginfo = dict(
            message = 'Tagging version 1.0',
            signingkey = 'Dummy Key for Gitflow testing',
            )
        mgr.finish('1.0', push=True, tagging_info=taginfo)
        # tag message
        tag = self.remote.tags['v1.0'].tag
        self.assertIn('-----BEGIN PGP SIGNATURE-----', tag.message)
Exemplo n.º 9
0
    def test_finish_release_tag_sign_push(self):
        # Since remote is no bare repo, checkout some branch untouched
        # by this operation. :fixme: find better solution
        self.remote.heads['feat/even'].checkout()
        gitflow = GitFlow(self.repo).init()

        mgr = ReleaseBranchManager(gitflow)
        mgr.create('1.0')
        taginfo = dict(
            message='Tagging version 1.0',
            signingkey='Dummy Key for Gitflow testing',
        )
        mgr.finish('1.0', push=True, tagging_info=taginfo)
        # tag message
        tag = self.remote.tags['v1.0'].tag
        self.assertIn('-----BEGIN PGP SIGNATURE-----', tag.message)
Exemplo n.º 10
0
    def test_finish_release_merge_conflict_tag(self):
        """
        finish + tag with merge-conflicts on develop
        """
        version_filename = 'VERSION'
        new_version = '1.1\n'

        gitflow = GitFlow(self.repo).init()
        fmgr = FeatureBranchManager(gitflow)
        fmgr.finish('even')
        fake_commit(self.repo, 'Overwrite version',
                    filename=version_filename,
                    change=new_version)

        # verify that the tag does not yet exist
        # "v" comes form "versiontag" prefix in the gitflow config for the "release" fixture
        self.assertNotIn('v1.0', self.repo.tags)

        mgr = ReleaseBranchManager(gitflow)
        taginfo = dict(
            message='Tagging version 1.0',
        )
        self.assertRaises(MergeError,
                          mgr.finish, '1.0', tagging_info=taginfo)

        # verify that the tag exists, even though there was a failed merge
        self.assertIn('v1.0', self.repo.tags)

        # resolve the conflict
        # this is in favor of the change on develop
        write_file(filename=version_filename,
                   append=False,
                   change=new_version)
        gitflow.git.add(version_filename)
        gitflow.git.commit('-F.git/MERGE_MSG')
        # the release branch is still here
        self.assertIn('rel/1.0',
                      [b.name for b in self.repo.branches])
        # finish the release again
        # this should skip the tagging, since that part previously succeeded
        mgr.finish('1.0', tagging_info=taginfo)
        # now the release branch is gone
        self.assertNotIn('rel/1.0',
                         [b.name for b in self.repo.branches])

        # verify that the tag still exists
        self.assertIn('v1.0', self.repo.tags)
Exemplo n.º 11
0
 def test_finish_release_tag(self):
     gitflow = GitFlow(self.repo)
     mgr = ReleaseBranchManager(gitflow)
     taginfo = dict(
         message = 'Tagging version 1.0'
         )
     mgr.finish('1.0', tagging_info=taginfo)
     mc1 = gitflow.master().commit
     dc1 = gitflow.develop().commit
     # master is merged back to develop
     self.assertIn(mc1, dc1.parents)
     # tag exists
     self.assertIn('v1.0', self.repo.tags)
     self.assertEqual(self.repo.tags['v1.0'].commit, mc1)
     # tag message
     self.assertEqual(self.repo.tags['v1.0'].tag.message,
                      'Tagging version 1.0')
Exemplo n.º 12
0
    def test_finish_release_tag_push(self):
        # Since remote is no bare repo, checkout some branch untouched
        # by this operation. :fixme: find better solution
        self.remote.heads['feat/even'].checkout()
        gitflow = GitFlow(self.repo).init()

        mgr = ReleaseBranchManager(gitflow)
        mgr.create('1.0')
        taginfo = dict(message='Tagging version 1.0')
        mgr.finish('1.0', push=True, tagging_info=taginfo)
        mc1 = gitflow.master().commit
        # remote tag exists
        self.assertIn('v1.0', self.remote.tags)
        self.assertEqual(self.remote.tags['v1.0'].commit, mc1)
        # tag message
        self.assertEqual(self.remote.tags['v1.0'].tag.message,
                         'Tagging version 1.0')
Exemplo n.º 13
0
    def test_finish_release_merge_conflict(self):
        gitflow = GitFlow(self.repo).init()
        fmgr = FeatureBranchManager(gitflow)
        fmgr.finish('even')
        fake_commit(self.repo, 'Overwrite version', filename='VERSION')

        mgr = ReleaseBranchManager(gitflow)
        self.assertRaises(MergeError,
                          mgr.finish, '1.0')
        # resolve the conflict
        gitflow.git.rm('VERSION')
        gitflow.git.commit('-F.git/MERGE_MSG')
        # the release branch is still here
        self.assertIn('rel/1.0',
                [b.name for b in self.repo.branches])
        mgr.finish('1.0')
        # now the release branch is gone
        self.assertNotIn('rel/1.0',
                [b.name for b in self.repo.branches])
Exemplo n.º 14
0
    def test_finish_release_tag_push(self):
        # Since remote is no bare repo, checkout some branch untouched
        # by this operation. :fixme: find better solution
        self.remote.heads['feat/even'].checkout()
        gitflow = GitFlow(self.repo).init()

        mgr = ReleaseBranchManager(gitflow)
        mgr.create('1.0')
        taginfo = dict(
            message = 'Tagging version 1.0'
            )
        mgr.finish('1.0', push=True, tagging_info=taginfo)
        mc1 = gitflow.master().commit
        # remote tag exists
        self.assertIn('v1.0', self.remote.tags)
        self.assertEqual(self.remote.tags['v1.0'].commit, mc1)
        # tag message
        self.assertEqual(self.remote.tags['v1.0'].tag.message,
                         'Tagging version 1.0')
Exemplo n.º 15
0
    def test_finish_release_merge_conflict_tag(self):
        """
        finish + tag with merge-conflicts on develop
        """
        version_filename = 'VERSION'
        new_version = '1.1\n'

        gitflow = GitFlow(self.repo).init()
        fmgr = FeatureBranchManager(gitflow)
        fmgr.finish('even')
        fake_commit(self.repo,
                    'Overwrite version',
                    filename=version_filename,
                    change=new_version)

        # verify that the tag does not yet exist
        # "v" comes form "versiontag" prefix in the gitflow config for the "release" fixture
        self.assertNotIn('v1.0', self.repo.tags)

        mgr = ReleaseBranchManager(gitflow)
        taginfo = dict(message='Tagging version 1.0', )
        self.assertRaises(MergeError, mgr.finish, '1.0', tagging_info=taginfo)

        # verify that the tag exists, even though there was a failed merge
        self.assertIn('v1.0', self.repo.tags)

        # resolve the conflict
        # this is in favor of the change on develop
        write_file(filename=version_filename, append=False, change=new_version)
        gitflow.git.add(version_filename)
        gitflow.git.commit('-F.git/MERGE_MSG')
        # the release branch is still here
        self.assertIn('rel/1.0', [b.name for b in self.repo.branches])
        # finish the release again
        # this should skip the tagging, since that part previously succeeded
        mgr.finish('1.0', tagging_info=taginfo)
        # now the release branch is gone
        self.assertNotIn('rel/1.0', [b.name for b in self.repo.branches])

        # verify that the tag still exists
        self.assertIn('v1.0', self.repo.tags)
Exemplo n.º 16
0
    def test_finish_release(self):
        gitflow = GitFlow(self.repo)
        mgr = ReleaseBranchManager(gitflow)

        mc0 = gitflow.master().commit
        dc0 = gitflow.develop().commit
        mgr.finish('1.0')
        mc1 = gitflow.master().commit
        dc1 = gitflow.develop().commit

        # Release finishes advance both master and develop
        self.assertNotEqual(mc0, mc1)
        self.assertNotEqual(dc0, dc1)
        # master is merged back to develop
        self.assertIn(mc1, dc1.parents)

        # Finishing removes the release branch
        self.assertNotIn('rel/1.0', [b.name for b in self.repo.branches])

        # Merge commit message
        self.assertEquals('Finished release 1.0.\n', dc1.message)
        self.assertEquals('Finished release 1.0.\n', mc1.message)
Exemplo n.º 17
0
    def test_finish_release_push(self):
        remote =  GitFlow(self.remote).init()
        # Since remote is no bare repo, checkout some branch untouched
        # by this operation. :fixme: find better solution
        self.remote.heads['feat/even'].checkout()
        gitflow = GitFlow(self.repo).init()

        rmc0 = remote.master().commit
        rdc0 = remote.develop().commit
        mc0 = gitflow.master().commit
        dc0 = gitflow.develop().commit

        mgr = ReleaseBranchManager(gitflow)
        mgr.create('1.0')
        mgr.finish('1.0', push=True)
        rmc1 = remote.master().commit
        rdc1 = remote.develop().commit
        mc1 = gitflow.master().commit
        dc1 = gitflow.develop().commit

        # Release finishes advances master and develop both local and remote
        self.assertNotEqual(rmc0, rmc1)
        self.assertNotEqual(rdc0, rdc1)
        self.assertNotEqual(mc0, mc1)
        self.assertNotEqual(dc0, dc1)

        # local and remote heads must be the same again
        self.assertEqual(rmc1, mc1)
        self.assertEqual(rdc1, dc1)

        # Finishing removes the local and the remote release branch
        self.assertNotIn('rel/1.0',
                [b.name for b in self.repo.branches])
        self.assertNotIn('rel/1.0',
                [b.name for b in self.remote.branches])


        # Merge commit message
        self.assertEquals('Finished release 1.0.\n', rdc1.message)
Exemplo n.º 18
0
    def test_finish_release(self):
        gitflow = GitFlow(self.repo)
        mgr = ReleaseBranchManager(gitflow)

        mc0 = gitflow.master().commit
        dc0 = gitflow.develop().commit
        mgr.finish('1.0')
        mc1 = gitflow.master().commit
        dc1 = gitflow.develop().commit

        # Release finishes advance both master and develop
        self.assertNotEqual(mc0, mc1)
        self.assertNotEqual(dc0, dc1)
        # master is merged back to develop
        self.assertIn(mc1, dc1.parents)

        # Finishing removes the release branch
        self.assertNotIn('rel/1.0',
                [b.name for b in self.repo.branches])

        # Merge commit message
        self.assertEquals('Finished release 1.0.\n', dc1.message)
        self.assertEquals('Finished release 1.0.\n', mc1.message)
Exemplo n.º 19
0
 def test_create_new_release_for_existing_tag_raises_error(self):
     gitflow = GitFlow(self.repo)
     mgr = ReleaseBranchManager(gitflow)
     mgr.finish('1.0', tagging_info={'message':'Tagging 1.0'})
     self.assertRaises(TagExistsError,
                       mgr.create, '1.0')
Exemplo n.º 20
0
 def test_create_new_release_for_existing_tag_raises_error(self):
     gitflow = GitFlow(self.repo)
     mgr = ReleaseBranchManager(gitflow)
     mgr.finish('1.0', tagging_info={'message': 'Tagging 1.0'})
     self.assertRaises(TagExistsError, mgr.create, '1.0')