summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/flake8/main/git.py6
-rw-r--r--src/flake8/main/mercurial.py20
2 files changed, 25 insertions, 1 deletions
diff --git a/src/flake8/main/git.py b/src/flake8/main/git.py
index 3cda3c5..ad55100 100644
--- a/src/flake8/main/git.py
+++ b/src/flake8/main/git.py
@@ -68,6 +68,8 @@ def install():
pre-commit python script in the hooks sub-directory if one does not
already exist.
+ It will also print a message to stdout about how to configure the hook.
+
:returns:
True if successful, False if the git directory doesn't exist.
:rtype:
@@ -105,6 +107,10 @@ def install():
# so that git can actually execute it as a hook.
pre_commit_permissions = stat.S_IRWXU | stat.S_IRGRP | stat.S_IROTH
os.chmod(pre_commit_file, pre_commit_permissions)
+
+ print('git pre-commit hook installed, for configuration options see')
+ print('http://flake8.pycqa.org/en/latest/user/using-hooks.html')
+
return True
diff --git a/src/flake8/main/mercurial.py b/src/flake8/main/mercurial.py
index a46f676..c0f5d3e 100644
--- a/src/flake8/main/mercurial.py
+++ b/src/flake8/main/mercurial.py
@@ -46,7 +46,22 @@ def hook(ui, repo, **kwargs):
def install():
- """Ensure that the mercurial hooks are installed."""
+ """Ensure that the mercurial hooks are installed.
+
+ This searches for the ``.hg/hgrc`` configuration file and will add commit
+ and qrefresh hooks to it, if they do not already exist.
+
+ It will also print a message to stdout about how to configure the hook.
+
+ :returns:
+ True if successful, False if the ``.hg/hgrc`` file doesn't exist.
+ :rtype:
+ bool
+ :raises:
+ flake8.exceptions.MercurialCommitHookAlreadyExists
+ flake8.exceptions.MercurialQRefreshHookAlreadyExists
+
+ """
hgrc = find_hgrc(create_if_missing=True)
if hgrc is None:
return False
@@ -80,6 +95,9 @@ def install():
with open(hgrc, 'w') as fd:
hgconfig.write(fd)
+ print('mercurial hooks installed, for configuration options see')
+ print('http://flake8.pycqa.org/en/latest/user/using-hooks.html')
+
return True