Example #1
0
    def process(self, argv):
        path = argv.path

        with self.out() as out:
            hook(path)
            initializer(path)

            out.append('Git repository has been initialized for use with Jig.')
            out.extend(AFTER_INIT)
Example #2
0
    def test_will_stop_if_pre_commit_exists(self):
        """
        Stop if .git/hooks/pre-commit exists
        """
        # Let's create a pre-commit hook, which we would use
        with open(self.pc_filename, 'w') as fh:
            fh.write('#!/bin/sh')

        with self.assertRaises(PreCommitExists):
            hook(self.gitrepodir)
Example #3
0
File: init.py Project: dmore/jig
    def process(self, argv):
        path = argv.path

        with self.out() as out:
            hook(path)
            initializer(path)

            out.append(
                'Git repository has been initialized for use with Jig.'
            )
            out.extend(AFTER_INIT)
Example #4
0
    def test_not_git_directory(self):
        """
        The directory given is not a repo.
        """
        badrepo = mkdtemp()

        try:
            with self.assertRaises(NotGitRepo):
                hook(badrepo)
        finally:
            rmdir(badrepo)
Example #5
0
    def test_successfully_hooks(self):
        """
        Creates the pre-commit hook.
        """
        pc_filename = hook(self.gitrepodir)

        self.assertEqual(self.pc_filename, pc_filename)
Example #6
0
    def test_hook_runs(self):
        """
        New hook will run.
        """
        pc_filename = hook(self.gitrepodir)

        retcode, output = self.runcmd(pc_filename)

        self.assertEqual(1, retcode)
        self.assertResults(
            result_with_hint(
                u'This repository has not been initialized.',
                GIT_REPO_NOT_INITIALIZED),
            output)