Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
ProMod3
Manage
Activity
Members
Plan
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schwede
ProMod3
Commits
ba03508f
Commit
ba03508f
authored
10 years ago
by
Bienchen
Browse files
Options
Downloads
Patches
Plain Diff
Extended pre-commit hook
parent
299804d9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
extras/pre_commit/pm3_csc/git.py
+9
-1
9 additions, 1 deletion
extras/pre_commit/pm3_csc/git.py
extras/pre_commit/pre-commit
+2
-1
2 additions, 1 deletion
extras/pre_commit/pre-commit
with
11 additions
and
2 deletions
extras/pre_commit/pm3_csc/git.py
+
9
−
1
View file @
ba03508f
...
...
@@ -133,7 +133,7 @@ def _GetFileType(filepath):
"'
_GetFileType
'
. Output of
'
file %s
'
was
'
%s
'"
%
(
filepath
,
fout
),
12
)
def
GetModifiedFiles
(
exclude
):
def
GetModifiedFiles
(
exclude
,
committed_only
=
True
):
"""
Get the list of modified files in a commit. Files are sorted into a
dictionary of lists according to file type. If a file of unknown type is
...
...
@@ -144,6 +144,9 @@ def GetModifiedFiles(exclude):
be excluded from being checked.
:type exclude: :class:`list` of :class:`str`
:param committed_only: Only return files marked for comit.
:type committed_only: :class:`bool`
:returns: :class:`dict` of :class:`list` of :class:`str`, with file types
as keys and file names as items in the lists.
"""
...
...
@@ -183,6 +186,11 @@ def GetModifiedFiles(exclude):
if
status_line
[
0
]
==
'
??
'
:
# file is not tracked by repo, ignore
continue
if
committed_only
:
if
line
[
0
]
==
'
'
:
# Files marked for commit should have 'M'/ 'A' in the first
# column. If its left empty, skip
continue
tfp
=
os
.
path
.
join
(
cdup
,
status_line
[
-
1
])
skip
=
False
for
ex_re
in
re_excludes
:
...
...
This diff is collapsed.
Click to expand it.
extras/pre_commit/pre-commit
+
2
−
1
View file @
ba03508f
...
...
@@ -20,7 +20,8 @@ WHITESPACECHECK_EXCLUDES = [r'.*\.pdf', r'.*\.pdb']
## files like documentation as HTML files.
EXCLUDE_COMPLETELY
=
[
r
'
^doc/html/.*\.html
'
,
r
'
^doc/html/.*\.js
'
,
r
'
^doc/html/.*\.inv
'
,
r
'
^doc/html/.*\.txt
'
]
PYCODECHECK_EXCLUDES
=
[
'
extras/pre_commit/pre-commit
'
,
'
doc/cmake.py
'
]
PYCODECHECK_EXCLUDES
=
[
'
extras/pre_commit/pre-commit
'
,
'
doc/cmake.py
'
,
'
core/pymod/__init__.py.in
'
]
ALLOW_LONG_LINES
=
[
'
extras/pre_commit/pm3_csc/filecheck/pylint-unittest-rc
'
,
'
extras/pre_commit/pm3_csc/filecheck/pylintrc
'
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment