Skip to content

Commit 98d9ce4

Browse files
committed
Classify git commits
1 parent 2970f30 commit 98d9ce4

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Classify git commits and set properties like isMergeCommit, isAutomationCommit (=isBotCommit or isMavenCommit).
2+
3+
MATCH (git_commit:Git:Commit)
4+
WITH git_commit,
5+
COUNT { (git_commit)-[:HAS_PARENT]->(:Git:Commit) } AS parentCount
6+
WITH git_commit,
7+
parentCount >= 2 AS isMergeCommit,
8+
git_commit.author CONTAINS '[bot]' AS isBotAuthor,
9+
git_commit.message STARTS WITH '[maven' AS isMavenCommit
10+
WITH git_commit,
11+
isMergeCommit,
12+
isBotAuthor,
13+
isMavenCommit,
14+
(isBotAuthor OR isMavenCommit) AS isAutomatedCommit
15+
SET git_commit.isMergeCommit = isMergeCommit,
16+
git_commit.isBotAuthor = isBotAuthor,
17+
git_commit.isMavenCommit = isMavenCommit,
18+
git_commit.isAutomatedCommit = isAutomatedCommit,
19+
git_commit.isManualCommit = NOT isAutomatedCommit
20+
RETURN count(git_commit) AS classifiedCommits
21+
// For Debugging:
22+
// ,isMergeCommit
23+
// ,isBotAuthor
24+
// ,isMavenCommit
25+
// ,isAutomatedCommit

scripts/importGit.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,10 @@ commonPostGitImport() {
141141
postGitLogImport() {
142142
echo "importGit: Add numberOfGitCommits property to nodes with matching file names..."
143143
execute_cypher "${GIT_LOG_CYPHER_DIR}/Set_number_of_git_log_commits.cypher"
144-
144+
145+
echo "importGit: Classify git commits (e.g. isMergeCommit, isAutomatedCommit)..."
146+
execute_cypher "${GIT_LOG_CYPHER_DIR}/Set_commit_classification_properties.cypher"
147+
145148
commonPostGitImport
146149
}
147150

@@ -157,6 +160,9 @@ postGitPluginImport() {
157160
execute_cypher "${GIT_LOG_CYPHER_DIR}/Index_file_relative_path.cypher"
158161
execute_cypher "${GIT_LOG_CYPHER_DIR}/Index_absolute_file_name.cypher"
159162

163+
echo "importGit: Classify git commits (e.g. isMergeCommit, isAutomatedCommit)..."
164+
execute_cypher "${GIT_LOG_CYPHER_DIR}/Set_commit_classification_properties.cypher"
165+
160166
echo "importGit: Add numberOfGitCommits property to nodes with matching file names..."
161167
execute_cypher "${GIT_LOG_CYPHER_DIR}/Set_number_of_git_plugin_commits.cypher"
162168
echo "importGit: Add updateCommitCount property to file nodes and code nodes with matching file names..."

0 commit comments

Comments
 (0)