You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Take the already existing "CHANGED_TOGETHER_WITH" relationship between git files and apply it to resolved file nodes. Requires "Add_CHANGED_TOGETHER_WITH_relationships_to_git_files".
2
+
3
+
MATCH (firstGitFile:Git&File&!Repository)-[gitChange:CHANGED_TOGETHER_WITH]-(secondGitFile:Git&File&!Repository)
// Connect git files that where changed together frequently with "CHANGED_TOGETHER_WITH"
2
+
3
+
MATCH (global_git_commit:Git:Commit)
4
+
WITHcount(global_git_commit) ASglobalCommitCount
5
+
MATCH (git_commit:Git:Commit)-[:CONTAINS_CHANGE]->(git_change:Git:Change:Update)-[:UPDATES]->(git_file:Git:File)MATCH (git_repository:Git&Repository)-[:HAS_FILE]->(git_file)
6
+
WHEREgit_file.deletedAtISNULL
7
+
// Order files to assure, that pairs of distinct files are grouped together (fileA, fileB) without (fileB, fileA)
8
+
ORDER BYgit_commit.sha, git_file.relativePath
9
+
WITHglobalCommitCount
10
+
,git_commit.shaAScommitHash
11
+
,collect(DISTINCTgit_file) ASfilesInCommit
12
+
// Limit the file count to min. 2 (changed together) and
13
+
// max. 50 (reduce permutations, improve performance, filter out large refactorings that usually affect many files)
14
+
WHEREsize(filesInCommit) >=2
15
+
ANDsize(filesInCommit) <=50
16
+
// Collect distinct pairwise (..., 2, 2) combinations of all files in the list
// List git files that where changed together frequently
1
+
// List git files that where changed together frequently. Requires "Add_CHANGED_TOGETHER_WITH_relationships_to_git_files".
2
2
3
-
MATCH (global_git_commit:Git:Commit)
4
-
WITHcount(global_git_commit) ASglobalCommitCount
5
-
MATCH (git_commit:Git:Commit)-[:CONTAINS_CHANGE]->(git_change:Git:Change:Update)-[:UPDATES]->(git_file:Git:File)MATCH (git_repository:Git&Repository)-[:HAS_FILE]->(git_file)
6
-
MATCH (git_repository:Git&Repository)-[:HAS_FILE]->(git_file)
// List git files that where changed together frequently
2
+
3
+
MATCH (global_git_commit:Git:Commit)
4
+
WITHcount(global_git_commit) ASglobalCommitCount
5
+
MATCH (git_commit:Git:Commit)-[:CONTAINS_CHANGE]->(git_change:Git:Change:Update)-[:UPDATES]->(git_file:Git:File)MATCH (git_repository:Git&Repository)-[:HAS_FILE]->(git_file)
6
+
MATCH (git_repository:Git&Repository)-[:HAS_FILE]->(git_file)
0 commit comments