This repository has been archived by the owner on May 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
72 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# gitpylib - a Python library for Git. | ||
# Copyright (c) 2013 Santiago Perez De Rosso. | ||
# Licensed under GNU GPL, version 2. | ||
|
||
"""Hook module for running Git hooks.""" | ||
|
||
|
||
import collections | ||
import os | ||
import subprocess | ||
|
||
import common | ||
|
||
|
||
def pre_commit(): | ||
"""Runs the pre-commit hook.""" | ||
return _hook_call('pre-commit') | ||
|
||
|
||
def _hook_call(hook_name): | ||
HookCall = collections.namedtuple('hook_call', ['ok', 'out', 'err']) | ||
hook_path = '{}/hooks/{}'.format(common.git_dir(), hook_name) | ||
if not os.path.exists(hook_path): | ||
return HookCall(True, '', '') | ||
p = subprocess.Popen( | ||
hook_path, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) | ||
out, err = p.communicate() | ||
return HookCall(p.returncode == 0, out, err) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,6 @@ | |
|
||
import subprocess | ||
|
||
import common | ||
|
||
|
||
def log(): | ||
subprocess.call('git log', shell=True) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters