Merge lp:~powersj/merge-o-matic/enable-team-stats into lp:merge-o-matic

Proposed by Joshua Powers
Status: Merged
Merged at revision: 297
Proposed branch: lp:~powersj/merge-o-matic/enable-team-stats
Merge into: lp:merge-o-matic
Diff against target: 94 lines (+29/-2)
3 files modified
cron.daily (+1/-0)
momlib.py (+14/-0)
stats.py (+14/-2)
To merge this branch: bzr merge lp:~powersj/merge-o-matic/enable-team-stats
Reviewer Review Type Date Requested Status
Brian Murray Approve
Review via email: mp+326959@code.launchpad.net

Description of the change

The stats produced from merge-o-matic are great, however getting details at the team level are not possible. This enables statistics at the team level for any team that wants.

To post a comment you must log in.
Revision history for this message
Brian Murray (brian-murray) wrote :

I've merged this and set it up the server, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'cron.daily'
--- cron.daily 2017-06-09 00:36:25 +0000
+++ cron.daily 2017-07-06 19:15:08 +0000
@@ -82,6 +82,7 @@
8282
83# Produce pretty reports83# Produce pretty reports
84./stats.py $QUIET84./stats.py $QUIET
85./stats.py $QUIET -t ubuntu-server
85./stats-graphs.py $QUIET86./stats-graphs.py $QUIET
86./merge-status.py $QUIET87./merge-status.py $QUIET
87./manual-status.py $QUIET88./manual-status.py $QUIET
8889
=== modified file 'momlib.py'
--- momlib.py 2017-04-21 12:24:01 +0000
+++ momlib.py 2017-07-06 19:15:08 +0000
@@ -226,6 +226,20 @@
226 else:226 else:
227 return ""227 return ""
228228
229def get_team_packages(team):
230 """Return list of packages owned by a team."""
231 if not team:
232 return []
233
234 mapping_file = "%s/code/package-team-mapping.json" % ROOT
235 if os.path.exists(mapping_file):
236 with open(mapping_file) as ptm_file:
237 for fteam, packages in json.load(ptm_file).items():
238 if team == fteam:
239 return packages
240
241 return []
242
229# --------------------------------------------------------------------------- #243# --------------------------------------------------------------------------- #
230# Location functions244# Location functions
231# --------------------------------------------------------------------------- #245# --------------------------------------------------------------------------- #
232246
=== modified file 'stats.py'
--- stats.py 2016-11-13 03:15:26 +0000
+++ stats.py 2017-07-06 19:15:08 +0000
@@ -28,6 +28,7 @@
28 get_base,28 get_base,
29 get_same_source,29 get_same_source,
30 get_sources,30 get_sources,
31 get_team_packages,
31 OUR_DIST,32 OUR_DIST,
32 OUR_DISTRO,33 OUR_DISTRO,
33 read_blacklist,34 read_blacklist,
@@ -59,6 +60,8 @@
59 parser.add_option("-c", "--component", type="string", metavar="COMPONENT",60 parser.add_option("-c", "--component", type="string", metavar="COMPONENT",
60 action="append",61 action="append",
61 help="Process only these destination components")62 help="Process only these destination components")
63 parser.add_option("-t", "--team", type="string", metavar="TEAM",
64 help="Process only packages owned by this team")
6265
63def main(options, args):66def main(options, args):
64 src_distro = options.source_distro67 src_distro = options.source_distro
@@ -67,6 +70,8 @@
67 our_distro = options.dest_distro70 our_distro = options.dest_distro
68 our_dist = options.dest_suite71 our_dist = options.dest_suite
6972
73 team = options.team
74 team_package_list = get_team_packages(team)
70 blacklist = read_blacklist()75 blacklist = read_blacklist()
7176
72 # For each package in the destination distribution, locate the latest in77 # For each package in the destination distribution, locate the latest in
@@ -91,6 +96,9 @@
91 continue96 continue
9297
93 package = our_source["Package"]98 package = our_source["Package"]
99 if team_package_list and package not in team_package_list:
100 continue
101
94 our_version = Version(our_source["Version"])102 our_version = Version(our_source["Version"])
95 logging.debug("%s: %s is %s", package, our_distro, our_version)103 logging.debug("%s: %s is %s", package, our_distro, our_version)
96104
@@ -131,11 +139,15 @@
131 logging.debug("%s: modified", package)139 logging.debug("%s: modified", package)
132 stats["modified"] += 1140 stats["modified"] += 1
133141
134 write_stats(our_component, stats)142 write_stats(our_component, stats, team)
135143
136def write_stats(component, stats):144def write_stats(component, stats, team):
137 """Write out the collected stats."""145 """Write out the collected stats."""
138 stats_file = "%s/stats.txt" % ROOT146 stats_file = "%s/stats.txt" % ROOT
147
148 if team:
149 stats_file = "%s/stats-%s.txt" % (ROOT, team)
150
139 with open(stats_file, "a") as stf:151 with open(stats_file, "a") as stf:
140 stamp = time.strftime("%Y-%m-%d %H:%M", time.gmtime())152 stamp = time.strftime("%Y-%m-%d %H:%M", time.gmtime())
141 text = " ".join("%s=%d" % (k, v) for k,v in stats.items())153 text = " ".join("%s=%d" % (k, v) for k,v in stats.items())

Subscribers

People subscribed via source and target branches

to status/vote changes: