File tree 1 file changed +49
-0
lines changed
1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Copyright (C) 2016-present the ayncpg authors and contributors
2
+ # <see AUTHORS file>
3
+ #
4
+ # This module is part of asyncpg and is released under
5
+ # the Apache 2.0 License: http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+
8
+ import json
9
+ import requests
10
+ import re
11
+ import sys
12
+
13
+
14
+ BASE_URL = 'https://api.github.com/repos/magicstack/asyncpg/compare'
15
+
16
+
17
+ def main ():
18
+ if len (sys .argv ) < 2 :
19
+ print ('pass a sha1 hash as a first argument' )
20
+ sys .exit (1 )
21
+
22
+ from_hash = sys .argv [1 ]
23
+
24
+ r = requests .get (f'{ BASE_URL } /{ from_hash } ...master' )
25
+ data = json .loads (r .text )
26
+
27
+ for commit in data ['commits' ]:
28
+ message = commit ['commit' ]['message' ]
29
+ first_line = message .partition ('\n \n ' )[0 ]
30
+ gh_username = commit ['author' ]['login' ]
31
+ sha = commit ["sha" ][:8 ]
32
+
33
+ m = re .search (r'\#(?P<num>\d+)\b' , message )
34
+ if m :
35
+ issue_num = m .group ('num' )
36
+ else :
37
+ issue_num = None
38
+
39
+ print (f'* { first_line } ' )
40
+ print (f' (by @{ gh_username } in { sha } ' , end = '' )
41
+ if issue_num :
42
+ print (f' for #{ issue_num } )' )
43
+ else :
44
+ print (')' )
45
+ print ()
46
+
47
+
48
+ if __name__ == '__main__' :
49
+ main ()
You can’t perform that action at this time.
0 commit comments