コード例 #1
0
ファイル: hooking.py プロジェクト: robmadole/jig
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)
コード例 #2
0
ファイル: hooking.py プロジェクト: robmadole/jig
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)
コード例 #3
0
ファイル: tools.py プロジェクト: robmadole/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)
コード例 #4
0
ファイル: tools.py プロジェクト: 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)
コード例 #5
0
ファイル: test_remote.py プロジェクト: dmore/jig
    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))
コード例 #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))