This is an automated email from the ASF dual-hosted git repository.
abeizn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new e32c58219 4961 add author info in pull request commit (#4985)
e32c58219 is described below
commit e32c58219f2dd47fdabc178d9cd3da4e98bc3033
Author: Camille Teruel <[email protected]>
AuthorDate: Sun Apr 23 13:39:23 2023 +0200
4961 add author info in pull request commit (#4985)
* fix: PullRequest base and head repo ids must be domain ids
* style: Use snake_cased attributes
* feat: Use same PR state values as Github plugin
* refactor: Simplify extractors and clean up models
* refactor: Remove unused db.py
* feat: Autoextraction via JSON-pointer
* refactor: Add field source to models to remove extract methods
* fix: Add commit author info to PullRequestCommit
* fix: update azure author field
* fix: update azure author field
---------
Co-authored-by: Camille Teruel <[email protected]>
Co-authored-by: abeizn <[email protected]>
---
backend/python/plugins/azuredevops/azuredevops/models.py | 3 +++
.../plugins/azuredevops/azuredevops/streams/pull_request_commits.py | 3 +++
backend/python/plugins/azuredevops/tests/streams_test.py | 3 +++
backend/python/pydevlake/pydevlake/domain_layer/code.py | 3 +++
4 files changed, 12 insertions(+)
diff --git a/backend/python/plugins/azuredevops/azuredevops/models.py
b/backend/python/plugins/azuredevops/azuredevops/models.py
index b194f0cf5..35fc0e614 100644
--- a/backend/python/plugins/azuredevops/azuredevops/models.py
+++ b/backend/python/plugins/azuredevops/azuredevops/models.py
@@ -70,6 +70,9 @@ class GitPullRequest(ToolModel, table=True):
class GitPullRequestCommit(ToolModel, table=True):
commit_id: str = Field(primary_key=True)
pull_request_id: str
+ author_name: str = Field(source='/author/name')
+ author_email: str = Field(source='/author/email')
+ author_date: datetime.datetime = Field(source='/author/date')
class Build(ToolModel, table=True):
diff --git
a/backend/python/plugins/azuredevops/azuredevops/streams/pull_request_commits.py
b/backend/python/plugins/azuredevops/azuredevops/streams/pull_request_commits.py
index 14007b36d..bb4211866 100644
---
a/backend/python/plugins/azuredevops/azuredevops/streams/pull_request_commits.py
+++
b/backend/python/plugins/azuredevops/azuredevops/streams/pull_request_commits.py
@@ -39,4 +39,7 @@ class GitPullRequestCommits(Substream):
yield code.PullRequestCommit(
commit_sha=commit.commit_id,
pull_request_id=commit.pull_request_id,
+ commit_author_name=commit.author_name,
+ commit_author_email=commit.author_email,
+ commit_authored_date=commit.author_date
)
diff --git a/backend/python/plugins/azuredevops/tests/streams_test.py
b/backend/python/plugins/azuredevops/tests/streams_test.py
index 9d95960e5..f7624afbe 100644
--- a/backend/python/plugins/azuredevops/tests/streams_test.py
+++ b/backend/python/plugins/azuredevops/tests/streams_test.py
@@ -318,6 +318,9 @@ def test_pull_request_commits_stream():
expected = code.PullRequestCommit(
commit_sha='85ede91717145a1e6e2bdab4cab689ac8f2fa3a2',
pull_request_id="azuredevops:gitpullrequest:1:12345",
+ commit_author_name='John Doe',
+ commit_authored_date='2023-02-07T04:49:28Z',
+ commit_author_email='[email protected]'
)
assert_stream_convert(AzureDevOpsPlugin, 'gitpullrequestcommits', raw,
expected)
diff --git a/backend/python/pydevlake/pydevlake/domain_layer/code.py
b/backend/python/pydevlake/pydevlake/domain_layer/code.py
index aa8f1909b..d8da795a4 100644
--- a/backend/python/pydevlake/pydevlake/domain_layer/code.py
+++ b/backend/python/pydevlake/pydevlake/domain_layer/code.py
@@ -56,6 +56,9 @@ class PullRequestCommit(NoPKModel, table=True):
__tablename__ = 'pull_request_commits'
commit_sha: str = Field(primary_key=True)
pull_request_id: str = Field(primary_key=True)
+ commit_author_name: str
+ commit_author_email: str
+ commit_authored_date: datetime
class PullRequestComment(DomainModel, table=True):