Esempio n. 1
0
def hook(gitdir):
    """
    Creates a pre-commit hook that runs Jig in normal mode.

    The hook will be configured to run using the version of Python that was
    used to install jig.

    Returns the full path to the newly created post-commit hook.

    :raises jig.exc.NotGitRepo: if the directory given is not a Git repository.
    """
    if not is_git_repo(gitdir):
        raise NotGitRepo('{0} is not a Git repository.'.format(gitdir))

    pc_filename = realpath(join(gitdir, '.git', 'hooks', 'pre-commit'))

    script_kwargs = {
        'python_executable': sys.executable,
        'jig_dir': JIG_DIR,
        'git_python_dir': GIT_PYTHON_DIR,
        'gitdb_dir': GITDB_DIR,
        'smmap_dir': SMMAP_DIR
    }

    return _create_pre_commit(pc_filename, RUN_JIG_SCRIPT, script_kwargs)
Esempio n. 2
0
def hook(gitdir):
    """
    Creates a pre-commit hook that runs Jig in normal mode.

    The hook will be configured to run using the version of Python that was
    used to install jig.

    Returns the full path to the newly created post-commit hook.

    :raises jig.exc.NotGitRepo: if the directory given is not a Git repository.
    """
    if not is_git_repo(gitdir):
        raise NotGitRepo('{0} is not a Git repository.'.format(
            gitdir))

    pc_filename = realpath(join(gitdir, '.git', 'hooks', 'pre-commit'))

    script_kwargs = {
        'python_executable': sys.executable,
        'jig_dir': JIG_DIR,
        'git_python_dir': GIT_PYTHON_DIR,
        'gitdb_dir': GITDB_DIR,
        'smmap_dir': SMMAP_DIR}

    return _create_pre_commit(pc_filename, RUN_JIG_SCRIPT, script_kwargs)
Esempio n. 3
0
    def wrapper(gitrepo, *args, **kwargs):
        # Is it a Git repo?
        if not is_git_repo(gitrepo):
            raise NotGitRepo('Trying to initialize a directory that is '
                             'not a Git repository.')

        return func(gitrepo, *args, **kwargs)
Esempio n. 4
0
File: tools.py Progetto: dmore/jig
    def wrapper(gitrepo, *args, **kwargs):
        # Is it a Git repo?
        if not is_git_repo(gitrepo):
            raise NotGitRepo(
                'Trying to initialize a directory that is '
                'not a Git repository.')

        return func(gitrepo, *args, **kwargs)
Esempio n. 5
0
    def test_local_directory_clone(self):
        """
        Clones a local file-based Git repository.
        """
        to_dir = join(self.workingdir, 'a')

        clone(self.gitrepodir, to_dir)

        self.assertTrue(is_git_repo(to_dir))
Esempio n. 6
0
    def test_local_directory_clone(self):
        """
        Clones a local file-based Git repository.
        """
        to_dir = join(self.workingdir, 'a')

        clone(self.gitrepodir, to_dir)

        self.assertTrue(is_git_repo(to_dir))