##// 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 97 def report(issues, show_urls=False):
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
98 """Summary report about a list of issues, printing number and title."""
101 99 if show_urls:
102 100 for i in issues:
103 101 role = 'ghpull' if 'merged_at' in i else 'ghissue'
@@ -113,7 +111,8 b' def report(issues, show_urls=False):'
113 111
114 112 if __name__ == "__main__":
115 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 117 # Whether to add reST urls for all issues in printout.
119 118 show_urls = True
@@ -131,6 +130,9 b' if __name__ == "__main__":'
131 130 parser.add_argument('--project', type=str, default="ipython/ipython",
132 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 137 opts = parser.parse_args()
136 138 tag = opts.since_tag
@@ -140,9 +142,9 b' if __name__ == "__main__":'
140 142 since = datetime.utcnow() - timedelta(days=opts.days)
141 143 else:
142 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 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 148 since = datetime.strptime(tagday, "%Y-%m-%d %H:%M:%S")
147 149 h = int(tz[1:3])
148 150 m = int(tz[3:])
@@ -208,17 +210,23 b' if __name__ == "__main__":'
208 210 all_authors.extend([ u'* ' + a.split(' <')[0] for a in with_email ])
209 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 220 print("The following %i authors contributed %i commits." % (len(unique_authors), ncommits))
212 221 print()
213 222 print('\n'.join(unique_authors))
214 223
215 print()
216 print("We closed %d issues and merged %d pull requests;\n"
217 "this is the full list (generated with the script \n"
218 ":file:`tools/github_stats.py`):" % (n_pulls, n_issues))
219 print()
220 print('Pull Requests (%d):\n' % n_pulls)
221 report(pulls, show_urls)
222 print()
223 print('Issues (%d):\n' % n_issues)
224 report(issues, show_urls)
224 if opts.links:
225 print()
226 print("GitHub issues and pull requests:")
227 print()
228 print('Pull Requests (%d):\n' % n_pulls)
229 report(pulls, show_urls)
230 print()
231 print('Issues (%d):\n' % n_issues)
232 report(issues, show_urls)
General Comments 0
You need to be logged in to leave comments. Login now