checkmate5 4.0.67__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checkmate/__init__.py +21 -0
- checkmate/__main__.py +25 -0
- checkmate/contrib/__init__.py +21 -0
- checkmate/contrib/plugins/__init__.py +0 -0
- checkmate/contrib/plugins/all/gptanalyzer/__init__.py +0 -0
- checkmate/contrib/plugins/all/gptanalyzer/analyzer.py +99 -0
- checkmate/contrib/plugins/all/gptanalyzer/issues_data.py +6 -0
- checkmate/contrib/plugins/all/gptanalyzer/setup.py +13 -0
- checkmate/contrib/plugins/cve/__init__.py +0 -0
- checkmate/contrib/plugins/cve/text4shell/__init__.py +0 -0
- checkmate/contrib/plugins/cve/text4shell/analyzer.py +64 -0
- checkmate/contrib/plugins/cve/text4shell/issues_data.py +8 -0
- checkmate/contrib/plugins/cve/text4shell/setup.py +13 -0
- checkmate/contrib/plugins/git/__init__.py +0 -0
- checkmate/contrib/plugins/git/commands/__init__.py +6 -0
- checkmate/contrib/plugins/git/commands/analyze.py +364 -0
- checkmate/contrib/plugins/git/commands/base.py +16 -0
- checkmate/contrib/plugins/git/commands/diff.py +199 -0
- checkmate/contrib/plugins/git/commands/init.py +59 -0
- checkmate/contrib/plugins/git/commands/update_stats.py +41 -0
- checkmate/contrib/plugins/git/hooks/__init__.py +0 -0
- checkmate/contrib/plugins/git/hooks/project.py +19 -0
- checkmate/contrib/plugins/git/lib/__init__.py +1 -0
- checkmate/contrib/plugins/git/lib/repository.py +557 -0
- checkmate/contrib/plugins/git/lib/repository_pygit2.py +531 -0
- checkmate/contrib/plugins/git/models.py +178 -0
- checkmate/contrib/plugins/git/setup.py +27 -0
- checkmate/contrib/plugins/golang/__init__.py +0 -0
- checkmate/contrib/plugins/golang/gostaticcheck/__init__.py +0 -0
- checkmate/contrib/plugins/golang/gostaticcheck/analyzer.py +94 -0
- checkmate/contrib/plugins/golang/gostaticcheck/issues_data.py +1246 -0
- checkmate/contrib/plugins/golang/gostaticcheck/setup.py +13 -0
- checkmate/contrib/plugins/iac/__init__.py +0 -0
- checkmate/contrib/plugins/iac/kubescape/__init__.py +0 -0
- checkmate/contrib/plugins/iac/kubescape/analyzer.py +115 -0
- checkmate/contrib/plugins/iac/kubescape/issues_data.py +636 -0
- checkmate/contrib/plugins/iac/kubescape/setup.py +14 -0
- checkmate/contrib/plugins/iac/tfsec/__init__.py +0 -0
- checkmate/contrib/plugins/iac/tfsec/analyzer.py +92 -0
- checkmate/contrib/plugins/iac/tfsec/issues_data.py +1917 -0
- checkmate/contrib/plugins/iac/tfsec/setup.py +13 -0
- checkmate/contrib/plugins/java/__init__.py +0 -0
- checkmate/contrib/plugins/java/semgrepjava/__init__.py +0 -0
- checkmate/contrib/plugins/java/semgrepjava/analyzer.py +96 -0
- checkmate/contrib/plugins/java/semgrepjava/issues_data.py +5 -0
- checkmate/contrib/plugins/java/semgrepjava/setup.py +13 -0
- checkmate/contrib/plugins/javascript/__init__.py +0 -0
- checkmate/contrib/plugins/javascript/semgrepeslint/__init__.py +0 -0
- checkmate/contrib/plugins/javascript/semgrepeslint/analyzer.py +95 -0
- checkmate/contrib/plugins/javascript/semgrepeslint/issues_data.py +6 -0
- checkmate/contrib/plugins/javascript/semgrepeslint/setup.py +13 -0
- checkmate/contrib/plugins/perl/__init__.py +0 -0
- checkmate/contrib/plugins/perl/graudit/__init__.py +0 -0
- checkmate/contrib/plugins/perl/graudit/analyzer.py +70 -0
- checkmate/contrib/plugins/perl/graudit/issues_data.py +8 -0
- checkmate/contrib/plugins/perl/graudit/setup.py +13 -0
- checkmate/contrib/plugins/python/__init__.py +0 -0
- checkmate/contrib/plugins/python/bandit/__init__.py +0 -0
- checkmate/contrib/plugins/python/bandit/analyzer.py +74 -0
- checkmate/contrib/plugins/python/bandit/issues_data.py +426 -0
- checkmate/contrib/plugins/python/bandit/setup.py +13 -0
- checkmate/contrib/plugins/ruby/__init__.py +0 -0
- checkmate/contrib/plugins/ruby/brakeman/__init__.py +0 -0
- checkmate/contrib/plugins/ruby/brakeman/analyzer.py +96 -0
- checkmate/contrib/plugins/ruby/brakeman/issues_data.py +518 -0
- checkmate/contrib/plugins/ruby/brakeman/setup.py +13 -0
- checkmate/helpers/__init__.py +0 -0
- checkmate/helpers/facts.py +26 -0
- checkmate/helpers/hashing.py +68 -0
- checkmate/helpers/issue.py +101 -0
- checkmate/helpers/settings.py +14 -0
- checkmate/lib/__init__.py +1 -0
- checkmate/lib/analysis/__init__.py +3 -0
- checkmate/lib/analysis/base.py +103 -0
- checkmate/lib/code/__init__.py +3 -0
- checkmate/lib/code/environment.py +809 -0
- checkmate/lib/models.py +515 -0
- checkmate/lib/stats/__init__.py +1 -0
- checkmate/lib/stats/helpers.py +19 -0
- checkmate/lib/stats/mapreduce.py +29 -0
- checkmate/management/__init__.py +1 -0
- checkmate/management/commands/__init__.py +18 -0
- checkmate/management/commands/alembic.py +32 -0
- checkmate/management/commands/analyze.py +42 -0
- checkmate/management/commands/analyzers.py +1 -0
- checkmate/management/commands/base.py +66 -0
- checkmate/management/commands/compare.py +0 -0
- checkmate/management/commands/export.py +0 -0
- checkmate/management/commands/info.py +0 -0
- checkmate/management/commands/init.py +103 -0
- checkmate/management/commands/issues.py +478 -0
- checkmate/management/commands/props/__init__.py +1 -0
- checkmate/management/commands/props/delete.py +29 -0
- checkmate/management/commands/props/get.py +30 -0
- checkmate/management/commands/props/set.py +29 -0
- checkmate/management/commands/reset.py +53 -0
- checkmate/management/commands/shell.py +19 -0
- checkmate/management/commands/snapshots.py +22 -0
- checkmate/management/commands/stats.py +21 -0
- checkmate/management/commands/summary.py +19 -0
- checkmate/management/commands/sync.py +63 -0
- checkmate/management/commands/trend.py +1 -0
- checkmate/management/commands/watch.py +27 -0
- checkmate/management/decorators.py +1 -0
- checkmate/management/helpers.py +140 -0
- checkmate/scripts/__init__.py +18 -0
- checkmate/scripts/manage.py +121 -0
- checkmate/settings/__init__.py +2 -0
- checkmate/settings/base.py +127 -0
- checkmate/settings/defaults.py +133 -0
- checkmate5-4.0.67.dist-info/LICENSE.txt +4095 -0
- checkmate5-4.0.67.dist-info/METADATA +15 -0
- checkmate5-4.0.67.dist-info/RECORD +116 -0
- checkmate5-4.0.67.dist-info/WHEEL +5 -0
- checkmate5-4.0.67.dist-info/entry_points.txt +2 -0
- checkmate5-4.0.67.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from checkmate.management.commands.base import BaseCommand
|
|
2
|
+
from sqlalchemy.orm.exc import NoResultFound
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Command(BaseCommand):
|
|
6
|
+
|
|
7
|
+
def __init__(self, *args, **kwargs):
|
|
8
|
+
super(Command, self).__init__(*args, **kwargs)
|
|
9
|
+
if not hasattr(self, 'project'):
|
|
10
|
+
raise AttributeError("No project defined!")
|
|
11
|
+
if not hasattr(self.project, 'git'):
|
|
12
|
+
raise AttributeError("Not a git project!")
|
|
13
|
+
try:
|
|
14
|
+
self.project.git.eager
|
|
15
|
+
except self.project.git.DoesNotExist:
|
|
16
|
+
raise AttributeError("Repository not found!")
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from .base import Command as BaseCommand
|
|
5
|
+
from ..models import GitSnapshot, GitBranch
|
|
6
|
+
from checkmate.lib.code import CodeEnvironment
|
|
7
|
+
from checkmate.lib.models import Diff
|
|
8
|
+
from ..lib.repository import group_snapshots_by_date, get_first_date_for_group
|
|
9
|
+
|
|
10
|
+
import sys
|
|
11
|
+
import os
|
|
12
|
+
import random
|
|
13
|
+
import os.path
|
|
14
|
+
import json
|
|
15
|
+
import time
|
|
16
|
+
import logging
|
|
17
|
+
import calendar
|
|
18
|
+
import datetime
|
|
19
|
+
import textwrap
|
|
20
|
+
|
|
21
|
+
logger = logging.getLogger(__name__)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class Command(BaseCommand):
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
Generates diffs between snapshots of a given project.
|
|
28
|
+
|
|
29
|
+
You can specify a diff group (e.g. "sequential") and a key (e.g "last_analysis") which will
|
|
30
|
+
be used to filter the returned diffs.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
options = BaseCommand.options + [
|
|
34
|
+
{
|
|
35
|
+
'name': '--branch',
|
|
36
|
+
'action': 'store',
|
|
37
|
+
'dest': 'branch',
|
|
38
|
+
'type': str,
|
|
39
|
+
'default': 'master',
|
|
40
|
+
'help': 'The branch for which to generate the diffs.'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
'name': '--type',
|
|
44
|
+
'action': 'store',
|
|
45
|
+
'dest': 'type',
|
|
46
|
+
'type': str,
|
|
47
|
+
'default': '',
|
|
48
|
+
'help': 'The type of the diffs to generate.'
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
'name': '--offset',
|
|
52
|
+
'action': 'store',
|
|
53
|
+
'dest': 'offset',
|
|
54
|
+
'type': int,
|
|
55
|
+
'default': 0,
|
|
56
|
+
'help': 'The offset from the latest snapshot.'
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
'name': '--from',
|
|
60
|
+
'action': 'store',
|
|
61
|
+
'dest': 'from',
|
|
62
|
+
'type': str,
|
|
63
|
+
'default': '',
|
|
64
|
+
'help': 'The date for which to generate the diff.'
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
'name': '--key',
|
|
68
|
+
'action': 'store',
|
|
69
|
+
'dest': 'key',
|
|
70
|
+
'type': str,
|
|
71
|
+
'default': '',
|
|
72
|
+
'help': 'The key (e.g. sequential, monthly, weekly, daily).'
|
|
73
|
+
},
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
@classmethod
|
|
77
|
+
def serialize(cls, result, fmt='json'):
|
|
78
|
+
if fmt == 'text':
|
|
79
|
+
d = {
|
|
80
|
+
'sha_a': result.snapshot_a.git_snapshot.sha[:8],
|
|
81
|
+
'sha_b': result.snapshot_b.git_snapshot.sha[:8],
|
|
82
|
+
'date_a': result.snapshot_a.git_snapshot.committer_date,
|
|
83
|
+
'date_b': result.snapshot_b.git_snapshot.committer_date,
|
|
84
|
+
}
|
|
85
|
+
s = textwrap.dedent("""
|
|
86
|
+
Diff between commit {sha_a} ({date_a}) and {sha_b} ({date_b})
|
|
87
|
+
|
|
88
|
+
""".format(**d))
|
|
89
|
+
return s
|
|
90
|
+
elif fmt == 'json':
|
|
91
|
+
return json.dumps(self.backend.serialize(result), indent=2)
|
|
92
|
+
|
|
93
|
+
def run(self):
|
|
94
|
+
|
|
95
|
+
if not self.opts['branch']:
|
|
96
|
+
branch_name = self.project.git.get_default_branch()
|
|
97
|
+
else:
|
|
98
|
+
branch_name = self.opts['branch']
|
|
99
|
+
if branch_name is None:
|
|
100
|
+
raise eslf.CommandException("No default branch defined!")
|
|
101
|
+
try:
|
|
102
|
+
branch = self.backend.get(GitBranch,
|
|
103
|
+
{'project.pk': self.project.pk, 'name': branch_name})
|
|
104
|
+
diffs = []
|
|
105
|
+
except GitBranch.DoesNotExist:
|
|
106
|
+
raise self.CommandException("Cannot load branch %s" % branch_name)
|
|
107
|
+
|
|
108
|
+
if self.opts['type'] == 'last_analysis':
|
|
109
|
+
if not branch.get('last_analyzed_snapshot'):
|
|
110
|
+
raise self.CommandException(
|
|
111
|
+
"No data about last analyzed snapshot available for branch %s" % branch_name)
|
|
112
|
+
git_snapshot_a = branch.last_analyzed_snapshot.eager
|
|
113
|
+
if not 'head_snapshot' in branch:
|
|
114
|
+
raise self.CommandException(
|
|
115
|
+
"No data about head snapshot available for branch %s" % branch_name)
|
|
116
|
+
git_snapshot_b = branch.head_snapshot.eager
|
|
117
|
+
if git_snapshot_a['sha'] == git_snapshot_b['sha']:
|
|
118
|
+
raise self.CommandException("No changes since last analysis!")
|
|
119
|
+
elif self.opts['type'] in ('weekly', 'daily', 'monthly'):
|
|
120
|
+
if self.opts['from']:
|
|
121
|
+
if isinstance(self.opts['from'], str):
|
|
122
|
+
try:
|
|
123
|
+
from_date = datetime.datetime.strptime(
|
|
124
|
+
self.opts['from'], "%Y-%m-%d")
|
|
125
|
+
except ValueError:
|
|
126
|
+
raise self.CommandException(
|
|
127
|
+
"Invalid date format or value for `from` parameter (use YYYY-mm-dd)")
|
|
128
|
+
else:
|
|
129
|
+
try:
|
|
130
|
+
from_date = self.project.git.get_snapshots(branch=branch_name, limit=1)[0]\
|
|
131
|
+
.committer_date + datetime.timedelta(days=1)
|
|
132
|
+
except IndexError:
|
|
133
|
+
raise self.CommandException(
|
|
134
|
+
"No snapshots on branch %s" % branch_name)
|
|
135
|
+
|
|
136
|
+
dt = get_first_date_for_group(
|
|
137
|
+
from_date, self.opts['type'], 1+self.opts['offset'])
|
|
138
|
+
|
|
139
|
+
if self.opts['type'] == 'daily':
|
|
140
|
+
deltat = datetime.timedelta(days=1)
|
|
141
|
+
elif self.opts['type'] == 'weekly':
|
|
142
|
+
deltat = datetime.timedelta(days=7)
|
|
143
|
+
elif self.opts['type'] == 'monthly':
|
|
144
|
+
deltat = datetime.timedelta(
|
|
145
|
+
days=calendar.monthrange(dt.year, dt.month)[1])
|
|
146
|
+
|
|
147
|
+
snapshots = self.project.git.get_snapshots(branch=branch_name,
|
|
148
|
+
since=dt.ctime(),
|
|
149
|
+
until=(dt+deltat).ctime())
|
|
150
|
+
if not snapshots:
|
|
151
|
+
raise self.CommandException(
|
|
152
|
+
"No snapshots on branch %s" % branch_name)
|
|
153
|
+
grouped_snapshots = group_snapshots_by_date(
|
|
154
|
+
snapshots, self.opts['type'])
|
|
155
|
+
snapshots_list = list(grouped_snapshots.values())[0]
|
|
156
|
+
sha_a, sha_b = snapshots_list[0]['sha'], snapshots_list[-1]['sha']
|
|
157
|
+
try:
|
|
158
|
+
git_snapshot_a = self.backend.get(GitSnapshot, {'sha': sha_a,
|
|
159
|
+
'snapshot.project': self.project})
|
|
160
|
+
except GitSnapshot.DoesNotExist:
|
|
161
|
+
raise self.CommandException("Unknown snapshot: %s" % sha_a)
|
|
162
|
+
try:
|
|
163
|
+
git_snapshot_b = self.backend.get(GitSnapshot, {'sha': sha_b,
|
|
164
|
+
'snapshot.project': self.project})
|
|
165
|
+
except GitSnapshot.DoesNotExist:
|
|
166
|
+
raise self.CommandException("Unknown snapshot: %s" % sha_b)
|
|
167
|
+
|
|
168
|
+
else:
|
|
169
|
+
if len(self.extra_args) != 2:
|
|
170
|
+
raise self.CommandException(
|
|
171
|
+
"You need to specify exactly two commit SHAs to be diffed!")
|
|
172
|
+
sha_a, sha_b = self.extra_args
|
|
173
|
+
try:
|
|
174
|
+
git_snapshot_a = self.backend.get(GitSnapshot, {'sha': sha_a,
|
|
175
|
+
'snapshot.project': self.project})
|
|
176
|
+
except GitSnapshot.DoesNotExist:
|
|
177
|
+
raise self.CommandException("Unknown snapshot: %s" % sha_a)
|
|
178
|
+
try:
|
|
179
|
+
git_snapshot_b = self.backend.get(GitSnapshot, {'sha': sha_b,
|
|
180
|
+
'snapshot.project': self.project})
|
|
181
|
+
except GitSnapshot.DoesNotExist:
|
|
182
|
+
raise self.CommandException("Unknown snapshot: %s" % sha_b)
|
|
183
|
+
|
|
184
|
+
# We generate the diff, or fetch it from the database in case it already exists.
|
|
185
|
+
if 'settings' in self.opts:
|
|
186
|
+
settings = self.opts['settings']
|
|
187
|
+
else:
|
|
188
|
+
settings = self.project.get('settings', {})
|
|
189
|
+
try:
|
|
190
|
+
diff = self.backend.get(Diff, {'snapshot_a': git_snapshot_a.snapshot,
|
|
191
|
+
'snapshot_b': git_snapshot_b.snapshot})
|
|
192
|
+
except Diff.DoesNotExist:
|
|
193
|
+
code_environment = CodeEnvironment(
|
|
194
|
+
self.project, [], settings=settings)
|
|
195
|
+
|
|
196
|
+
diff, diff_file_revisions, diff_issue_occurrences = code_environment.diff_snapshots(
|
|
197
|
+
git_snapshot_a.snapshot, git_snapshot_b.snapshot, save=True)
|
|
198
|
+
|
|
199
|
+
return diff
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from checkmate.management.commands.init import Command as BaseCommand
|
|
5
|
+
from checkmate.management.helpers import (get_project_config,
|
|
6
|
+
get_project,
|
|
7
|
+
get_backend)
|
|
8
|
+
import sys
|
|
9
|
+
import os
|
|
10
|
+
import os.path
|
|
11
|
+
import json
|
|
12
|
+
import time
|
|
13
|
+
import uuid
|
|
14
|
+
import logging
|
|
15
|
+
|
|
16
|
+
from ..models import GitRepository
|
|
17
|
+
|
|
18
|
+
logger = logging.getLogger(__name__)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class Command(BaseCommand):
|
|
22
|
+
|
|
23
|
+
description = """
|
|
24
|
+
Initializes a new git checkmate project. Requires an initialized checkmate project.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
def find_git_repository(self, path):
|
|
28
|
+
"""
|
|
29
|
+
Tries to find a directory with a .git repository
|
|
30
|
+
"""
|
|
31
|
+
while path is not None:
|
|
32
|
+
git_path = os.path.join(path, '.git')
|
|
33
|
+
if os.path.exists(git_path) and os.path.isdir(git_path):
|
|
34
|
+
return path
|
|
35
|
+
path = os.path.dirname(path)
|
|
36
|
+
return None
|
|
37
|
+
|
|
38
|
+
def run(self):
|
|
39
|
+
|
|
40
|
+
project_path = self.opts['path'] or os.getcwd()
|
|
41
|
+
|
|
42
|
+
if self.opts.get('git_path'):
|
|
43
|
+
git_path = self.opts['git_path']
|
|
44
|
+
else:
|
|
45
|
+
git_path = self.find_git_repository(project_path)
|
|
46
|
+
|
|
47
|
+
if git_path is None:
|
|
48
|
+
logger.error("No git project found!")
|
|
49
|
+
return -1
|
|
50
|
+
|
|
51
|
+
try:
|
|
52
|
+
repo = self.backend.get(GitRepository, {'project': self.project})
|
|
53
|
+
except GitRepository.DoesNotExist:
|
|
54
|
+
repo = GitRepository({'project': self.project})
|
|
55
|
+
|
|
56
|
+
repo.path = project_path
|
|
57
|
+
|
|
58
|
+
with self.backend.transaction():
|
|
59
|
+
self.backend.save(repo)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import logging
|
|
5
|
+
from collections import defaultdict
|
|
6
|
+
|
|
7
|
+
from checkmate.management.commands.base import BaseCommand
|
|
8
|
+
from ..models import GitBranch
|
|
9
|
+
|
|
10
|
+
logger = logging.getLogger(__name__)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Command(BaseCommand):
|
|
14
|
+
|
|
15
|
+
def run(self):
|
|
16
|
+
|
|
17
|
+
branches = self.backend.filter(
|
|
18
|
+
GitBranch, {'project.pk': self.project.pk})
|
|
19
|
+
|
|
20
|
+
branches_by_name = dict([(branch.name, branch) for branch in branches])
|
|
21
|
+
|
|
22
|
+
if 'default_branch' in self.project and self.project.default_branch in branches_by_name:
|
|
23
|
+
master_branch = branches_by_name[self.project.default_branch]
|
|
24
|
+
elif 'origin/master' in branches_by_name:
|
|
25
|
+
master_branch = branches_by_name['origin/master']
|
|
26
|
+
else:
|
|
27
|
+
logger.warning(
|
|
28
|
+
"No default branch defined for project %s" % self.project.pk)
|
|
29
|
+
return -1
|
|
30
|
+
|
|
31
|
+
stats = {
|
|
32
|
+
'contributors': self.project.git.repository.get_contributors(),
|
|
33
|
+
'branch': master_branch.name
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
stats['n_commits'] = sum([contributor['n_commits']
|
|
37
|
+
for contributor in stats['contributors']])
|
|
38
|
+
|
|
39
|
+
self.project.stats = stats
|
|
40
|
+
with self.backend.transaction():
|
|
41
|
+
self.backend.save(self.project)
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from ..models import GitSnapshot, GitBranch
|
|
2
|
+
import logging
|
|
3
|
+
|
|
4
|
+
logger = logging.getLogger(__name__)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def before_project_save(settings, project):
|
|
8
|
+
pass
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def before_project_reset(settings, project):
|
|
12
|
+
backend = project.backend
|
|
13
|
+
branches = backend.filter(GitBranch, {'project': project})
|
|
14
|
+
logger.debug("Deleting %d branches" % len(branches))
|
|
15
|
+
branches.delete()
|
|
16
|
+
snapshots = backend.filter(GitSnapshot, {'snapshot.project': project})
|
|
17
|
+
logger.debug("Deleting %d snapshots" % len(snapshots))
|
|
18
|
+
snapshots.delete()
|
|
19
|
+
# do not call commit here, as this is done above
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|