Skip to content

Commit ce14759

Browse files
committed
Use simple git history query enhanced in Python
1 parent 9f9ae30 commit ce14759

6 files changed

+259
-330
lines changed

cypher/GitLog/List_git_files_directories.cypher

-29
This file was deleted.

cypher/GitLog/List_git_files_directories_with_commit_statistics.cypher

-66
This file was deleted.

cypher/GitLog/List_git_files_directories_with_commit_statistics_no_joined_directories.cypher

-49
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// List git files with commit statistics
2+
3+
MATCH (git_file:File&Git&!Repository)
4+
WHERE git_file.deletedAt IS NULL // filter out deleted files
5+
WITH percentileDisc(git_file.createdAtEpoch, 0.5) AS medianCreatedAtEpoch
6+
,percentileDisc(git_file.lastModificationAtEpoch, 0.5) AS medianLastModificationAtEpoch
7+
,collect(git_file) AS git_files
8+
UNWIND git_files AS git_file
9+
WITH *
10+
,datetime.fromepochMillis(coalesce(git_file.createdAtEpoch, medianCreatedAtEpoch)) AS fileCreatedAtTimestamp
11+
,datetime.fromepochMillis(coalesce(git_file.lastModificationAtEpoch, git_file.createdAtEpoch, medianLastModificationAtEpoch)) AS fileLastModificationAtTimestamp
12+
MATCH (git_repository:Git&Repository)-[:HAS_FILE]->(git_file)
13+
MATCH (git_commit:Git&Commit)-[:CONTAINS_CHANGE]->(git_change:Git&Change)-[]->(git_file)
14+
RETURN git_repository.name + '/' + git_file.relativePath AS filePath
15+
,split(git_commit.author, ' <')[0] AS author
16+
,count(DISTINCT git_commit.sha) AS commitCount
17+
,date(max(git_commit.date)) AS lastCommitDate
18+
,max(date(fileCreatedAtTimestamp)) AS lastCreationDate
19+
,max(date(fileLastModificationAtTimestamp)) AS lastModificationDate
20+
,duration.inDays(date(max(git_commit.date)), date()).days AS daysSinceLastCommit
21+
,duration.inDays(max(fileCreatedAtTimestamp), datetime()).days AS daysSinceLastCreation
22+
,duration.inDays(max(fileLastModificationAtTimestamp), datetime()).days AS daysSinceLastModification
23+
,max(git_commit.sha) AS maxCommitSha
24+
ORDER BY filePath ASCENDING, commitCount DESCENDING
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// Check if there is at least one Git:Commit pointing to a Git:Change containing a Git:File
1+
// Check if there is at least one Git:Commit pointing to a Git:Change containing a Git:File from a Git:Repository
22

33
MATCH (commit:Git:Commit)-[:CONTAINS_CHANGE]->(change:Git:Change)-->(file:Git:File)
4+
MATCH (repository:Git:Repository)-[:HAS_FILE]->(file)
45
RETURN commit.sha AS commitSha
56
LIMIT 1

0 commit comments

Comments
 (0)