forked from zulip/python-zulip-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
integrations: Remove avatar from git commits showing author name inst…
…ead. Getting the logs run in cmd as in function `git_commit_range(oldrev, newrev)` so I had to prefix author name with -[AUTHOR], commit with -[COMMIT] and subject/title with -[SUBJECT] to be able to extract these info correctly. I also tried to stick with the format proposed in this issue zulip/zulip#3968 except for showing the author's name before each commit and without summary. Fixes: zulip#632
- Loading branch information
1 parent
641623e
commit d40a41a
Showing
3 changed files
with
36 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from typing import List | ||
|
||
EMPTY_SHA = "0000000000000000000000000000000000000000" | ||
COMMIT_ROW_TEMPLATE = '* {user_name} commited {commit_msg} ([{commit_short_sha}]({commit_url}))\n' | ||
|
||
def extract_commit_data(raw_commit: str) -> List[str]: | ||
author_start = len("-[AUTHOR]=") | ||
author_end = raw_commit.find("-[COMMIT]=") | ||
author = raw_commit[author_start:author_end] | ||
raw_commit = raw_commit[author_end:] | ||
|
||
commit_start = len("-[COMMIT]=") | ||
commit_end = raw_commit.find("-[SUBJECT]=") | ||
commit = raw_commit[commit_start:commit_end] | ||
raw_commit = raw_commit[commit_end:] | ||
|
||
subject_start = len("-[SUBJECT]=") | ||
subject = raw_commit[subject_start:] | ||
|
||
return [author, commit, subject] |
This file contains 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 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