Skip to content

Commit 12e830e

Browse files
committed
Fixed bug for git latest commit info
1 parent b77f217 commit 12e830e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

apis/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ def handle(app):
742742
if authors is None:
743743
timestamp_len = 10
744744
commits_info = fetch_project_commits(
745-
app.giturl, int(app.meta_version[:timestamp_len]))
745+
app.giturl, int(app.meta_version[:timestamp_len]), int(app.latest_meta_version[:timestamp_len]))
746746
if commits_info is not None:
747747
uniq_authors, total_commits = commits_info
748748
else:

git/client.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@
1313
TIMEFORMAT_ISO8601 = '%Y-%m-%dT%H:%M:%S%z'
1414

1515

16-
def fetch_project_commits(giturl, from_timestamp):
16+
def fetch_project_commits(giturl, from_timestamp, until_timestamp=None):
1717
scheme, host, namespace, project = parse_giturl(giturl)
1818
if scheme is None:
1919
return
2020
git_type = host.split('.')[0]
2121
git_api = SUPPORT_GIT_TYPE.get(git_type, None)
2222
if git_api is None:
2323
return
24-
since = time.strftime(TIMEFORMAT_ISO8601, time.gmtime(from_timestamp+1))
25-
return git_api.fetch_project_commits(scheme, host, namespace, project, since)
24+
since = time.strftime(TIMEFORMAT_ISO8601, time.gmtime(from_timestamp + 1))
25+
until = None
26+
if until_timestamp is not None:
27+
until = time.strftime(TIMEFORMAT_ISO8601, time.gmtime(until_timestamp))
28+
return git_api.fetch_project_commits(scheme, host, namespace, project, since, until)

0 commit comments

Comments
 (0)