##// END OF EJS Templates
tweaks to GitHub stats script...
Min RK -
Show More
@@ -95,9 +95,7 b" def sorted_by_field(issues, field='closed_at', reverse=False):"
95
95
96
96
97 def report(issues, show_urls=False):
97 def report(issues, show_urls=False):
98 """Summary report about a list of issues, printing number and title.
98 """Summary report about a list of issues, printing number and title."""
99 """
100 # titles may have unicode in them, so we must encode everything below
101 if show_urls:
99 if show_urls:
102 for i in issues:
100 for i in issues:
103 role = 'ghpull' if 'merged_at' in i else 'ghissue'
101 role = 'ghpull' if 'merged_at' in i else 'ghissue'
@@ -113,7 +111,8 b' def report(issues, show_urls=False):'
113
111
114 if __name__ == "__main__":
112 if __name__ == "__main__":
115 # deal with unicode
113 # deal with unicode
116 sys.stdout = codecs.getwriter('utf8')(sys.stdout)
114 if sys.version_info < (3,):
115 sys.stdout = codecs.getwriter('utf8')(sys.stdout)
117
116
118 # Whether to add reST urls for all issues in printout.
117 # Whether to add reST urls for all issues in printout.
119 show_urls = True
118 show_urls = True
@@ -131,6 +130,9 b' if __name__ == "__main__":'
131 parser.add_argument('--project', type=str, default="ipython/ipython",
130 parser.add_argument('--project', type=str, default="ipython/ipython",
132 help="The project to summarize."
131 help="The project to summarize."
133 )
132 )
133 parser.add_argument('--links', action='store_true', default=False,
134 help="Include links to all closed Issues and PRs in the output."
135 )
134
136
135 opts = parser.parse_args()
137 opts = parser.parse_args()
136 tag = opts.since_tag
138 tag = opts.since_tag
@@ -140,9 +142,9 b' if __name__ == "__main__":'
140 since = datetime.utcnow() - timedelta(days=opts.days)
142 since = datetime.utcnow() - timedelta(days=opts.days)
141 else:
143 else:
142 if not tag:
144 if not tag:
143 tag = check_output(['git', 'describe', '--abbrev=0']).strip()
145 tag = check_output(['git', 'describe', '--abbrev=0']).strip().decode('utf8')
144 cmd = ['git', 'log', '-1', '--format=%ai', tag]
146 cmd = ['git', 'log', '-1', '--format=%ai', tag]
145 tagday, tz = check_output(cmd).strip().rsplit(' ', 1)
147 tagday, tz = check_output(cmd).strip().decode('utf8').rsplit(' ', 1)
146 since = datetime.strptime(tagday, "%Y-%m-%d %H:%M:%S")
148 since = datetime.strptime(tagday, "%Y-%m-%d %H:%M:%S")
147 h = int(tz[1:3])
149 h = int(tz[1:3])
148 m = int(tz[3:])
150 m = int(tz[3:])
@@ -208,17 +210,23 b' if __name__ == "__main__":'
208 all_authors.extend([ u'* ' + a.split(' <')[0] for a in with_email ])
210 all_authors.extend([ u'* ' + a.split(' <')[0] for a in with_email ])
209 unique_authors = sorted(set(all_authors), key=lambda s: s.lower())
211 unique_authors = sorted(set(all_authors), key=lambda s: s.lower())
210
212
213 print("We closed %d issues and merged %d pull requests." % (n_pulls, n_issues))
214 if milestone:
215 print("The full list can be seen `on GitHub <https://github.com/%s/milestone/%s>`"
216 % (project, milestone)
217 )
218
219 print()
211 print("The following %i authors contributed %i commits." % (len(unique_authors), ncommits))
220 print("The following %i authors contributed %i commits." % (len(unique_authors), ncommits))
212 print()
221 print()
213 print('\n'.join(unique_authors))
222 print('\n'.join(unique_authors))
214
223
215 print()
224 if opts.links:
216 print("We closed %d issues and merged %d pull requests;\n"
225 print()
217 "this is the full list (generated with the script \n"
226 print("GitHub issues and pull requests:")
218 ":file:`tools/github_stats.py`):" % (n_pulls, n_issues))
227 print()
219 print()
228 print('Pull Requests (%d):\n' % n_pulls)
220 print('Pull Requests (%d):\n' % n_pulls)
229 report(pulls, show_urls)
221 report(pulls, show_urls)
230 print()
222 print()
231 print('Issues (%d):\n' % n_issues)
223 print('Issues (%d):\n' % n_issues)
232 report(issues, show_urls)
224 report(issues, show_urls)
General Comments 0
You need to be logged in to leave comments. Login now