Skip to content

Commit 1fe955c

Browse files
committed
Add git history file overview treemap
1 parent 7221e44 commit 1fe955c

File tree

6 files changed

+426
-2
lines changed

6 files changed

+426
-2
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// List git file directories and the number of files they contain
2+
3+
MATCH (git_file:File&Git&!Repository)
4+
WITH *
5+
,git_file.relativePath AS gitFileName
6+
,reverse(split(reverse(git_file.relativePath),'/')[0]) AS gitFileNameWithoutPath
7+
,(git_file:Directory) AS isDirectory
8+
WITH *
9+
,rtrim(split(gitFileName, gitFileNameWithoutPath)[0], '/') AS gitDirectoryPath
10+
WITH gitDirectoryPath
11+
,coalesce(nullif(split(gitDirectoryPath, '/')[-2],''), 'root') AS directoryParentName
12+
,coalesce(nullif(split(gitDirectoryPath, '/')[-1],''), 'root') AS directoryName
13+
,size(split(gitDirectoryPath, '/')) AS pathLength
14+
,count(DISTINCT gitFileName) AS fileCount
15+
// Debugging
16+
// ,collect(git_file)[0..4] AS gitFileExamples
17+
// ,collect(gitFileName) AS gitFileNameExamples
18+
// ,collect(gitFileNameWithoutPath) AS gitFileNameWithoutPathExamples
19+
WHERE fileCount > 1
20+
RETURN gitDirectoryPath
21+
,directoryParentName
22+
,directoryName
23+
,pathLength
24+
,fileCount
25+
// Debugging
26+
// ,gitFileExamples
27+
// ,gitFileNameExamples
28+
// ,gitFileNameWithoutPathExamples
29+
ORDER BY gitDirectoryPath ASC
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// List git file directories and the number of files they contain
2+
3+
MATCH (git_file:File&Git&!Repository)
4+
OPTIONAL MATCH (git_commit:Git&Commit)-[:CONTAINS_CHANGE]->(git_change:Git&Change)-[]->(git_file)
5+
OPTIONAL MATCH (git_repository:Git&Repository)-[:HAS_FILE]->(git_file)
6+
WITH *
7+
,git_file.relativePath AS gitFileName
8+
,reverse(split(reverse(git_file.relativePath),'/')[0]) AS gitFileNameWithoutPath
9+
WITH *
10+
,rtrim(split(gitFileName, gitFileNameWithoutPath)[0], '/') AS gitDirectoryPath
11+
WITH git_repository.name AS gitRepositoryName
12+
,gitDirectoryPath
13+
,coalesce(nullif(split(gitDirectoryPath, '/')[-2],''), 'root') AS directoryParentName
14+
,coalesce(nullif(split(gitDirectoryPath, '/')[-1],''), 'root') AS directoryName
15+
,size(split(gitDirectoryPath, '/')) AS pathLength
16+
,count(DISTINCT gitFileName) AS fileCount
17+
,count(distinct git_commit.sha) AS commitCount
18+
,count(distinct git_commit.author) AS authorCount
19+
// Debugging
20+
// ,collect(distinct git_commit.sha)[0..9] AS gitCommitExamples
21+
// ,collect(distinct git_commit.author)[0..9] AS gitCommitAuthorExamples
22+
// ,collect(git_file)[0..4] AS gitFileExamples
23+
// ,collect(gitFileName) AS gitFileNameExamples
24+
// ,collect(gitFileNameWithoutPath) AS gitFileNameWithoutPathExamples
25+
WHERE fileCount > 1 // Filter out single files and directories with only one file
26+
RETURN gitRepositoryName
27+
,gitDirectoryPath
28+
,directoryParentName
29+
,directoryName
30+
,pathLength
31+
,fileCount
32+
,commitCount
33+
,authorCount
34+
// Debugging
35+
// ,gitFileExamples
36+
// ,gitFileNameExamples
37+
// ,gitFileNameWithoutPathExamples
38+
ORDER BY gitDirectoryPath ASC
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Check if there is at least one Git:Commit pointing to a Git:Change containing a Git:File
2+
3+
MATCH (commit:Git:Commit)-[:CONTAINS_CHANGE]->(change:Git:Change)-->(file:Git:File)
4+
RETURN commit.sha AS commitSha
5+
LIMIT 1

0 commit comments

Comments
 (0)