-
-
Notifications
You must be signed in to change notification settings - Fork 936
Add commit co-authors support #1482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
146cbda
Add co_authors property to the Commit object, which parses the commit…
itsluketwist 3cb7ecf
Add malformed co-authors to the test, to check they aren't detected w…
itsluketwist c2fd97e
Update regex to extract the author string, and create the Actor using…
itsluketwist 09f8a1b
Use the same regex as the Actor class when determining co-authors.
itsluketwist 4c460a3
Ignore flake8 error.
itsluketwist 72cf71c
Allow failure of that one test on cygwin
Byron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,4 +48,5 @@ Contributors are: | |
-Hiroki Tokunaga <tokusan441 _at_ gmail.com> | ||
-Julien Mauroy <pro.julien.mauroy _at_ gmail.com> | ||
-Patrick Gerard | ||
-Luke Twist <[email protected]> | ||
Portions derived from other open source works and are clearly marked. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -509,3 +509,18 @@ def test_trailers(self): | |
assert KEY_1 not in commit.trailers.keys() | ||
assert KEY_2 in commit.trailers.keys() | ||
assert commit.trailers[KEY_2] == VALUE_2 | ||
|
||
def test_commit_co_authors(self): | ||
commit = copy.copy(self.rorepo.commit("4251bd5")) | ||
commit.message = """Commit message | ||
|
||
Co-authored-by: Test User 1 <[email protected]> | ||
Co-authored-by: test_user_2 <[email protected]> | ||
Co_authored_by: test_user_x <[email protected]> | ||
Co-authored-by: test_user_y <poorly formatted email @github.com> | ||
Co-authored-by: test_user_3 <[email protected]>""" | ||
assert commit.co_authors == [ | ||
Actor("Test User 1", "[email protected]"), | ||
Actor("test_user_2", "[email protected]"), | ||
Actor("test_user_3", "[email protected]"), | ||
] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify, can you explain where this regex is coming from? Earlier I tried to argue that the one used by
Actor
could be used here. It's much more open than this, but I can be swayed if there is a specification of theCo-authored-by:
field that limits it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, my bad! Regarding the name part, this is on me, I used a regex to match against the GitHub username specs, but this is just the account name, so a more generic one is necessary - switched to match the regex used in
Actor
(with the extraCo-authored-by:
text and start/end line checks).Also added a line to ignore the flake8 check - not used flake8 but I think this should be right.