From 4df827baaa92081c7dab8801d8ab67c7cda57cc7 Mon Sep 17 00:00:00 2001 From: Mike Holmes Date: Mon, 15 May 2017 14:06:16 -0400 Subject: git plots summary Signed-off-by: Mike Holmes --- .gitignore | 1 + R.Rproj | 13 ++++ Signed_off_heatmaps.R | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 184 insertions(+) create mode 100644 R.Rproj create mode 100644 Signed_off_heatmaps.R diff --git a/.gitignore b/.gitignore index a136337..15042d1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.pdf +.Rproj.user diff --git a/R.Rproj b/R.Rproj new file mode 100644 index 0000000..8e3c2eb --- /dev/null +++ b/R.Rproj @@ -0,0 +1,13 @@ +Version: 1.0 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX diff --git a/Signed_off_heatmaps.R b/Signed_off_heatmaps.R new file mode 100644 index 0000000..6e1c678 --- /dev/null +++ b/Signed_off_heatmaps.R @@ -0,0 +1,170 @@ +library(RCurl) +library(curl) +library(jsonlite) +library(gsubfn) +library(gplots) +library(RColorBrewer) +library(reshape) +library(plyr) + +#functions + + +get_tags <- function (id) { +#http://patches.linaro.org/api/1.0/teams/39/commit-tags/ + + baseurl <- "http://patches.linaro.org/api/1.0/" + type <- paste("teams/",id,"/commit-tags/?format=json&per_page=5000", sep = "") + + url <- paste(baseurl, type, sep = "") + cat (url,"\n") + + webpage <- curl (url, handle = h) + + #get data it into R + jira_tags_raw <- fromJSON(webpage,simplifyMatrix = TRUE, simplifyVector =TRUE, simplifyDataFrame = TRUE, flatten = TRUE) + m <- data.frame(tag=jira_tags_raw$tag, person=jira_tags_raw$person) + + return(m) +} + +get_signed <- function (df){ + return (length(grep("Signed-off", df$contribution$tag))) + } + +get_acked <- function (df){ + return (length(grep("Acked", df$contribution$tag))) +} + +get_reviewed <- function (df){ + return (length(grep("Reviewed", df$contribution$tag))) +} + +get_tested <- function (df){ + return (length(grep("Tested", df$contribution$tag))) +} + +get_reported <- function (df){ + return (length(grep("Reported", df$contribution$tag))) +} + + +get_projects <- function (df){ + return (df$contribution$project) +} + + +#from the website get the initiatives list for the four teams +id <- Sys.getenv(c("JIRA_USERNAME", "JIRA_PASSWORD")) + +if (id[1] == '') { + print ("export JIRA_USERNAME='john.doe@linaro.org'") + stop() +} +if (id[2] == '') { + print ("export JIRA_PASSWORD='my-super-secret-password'") + stop() +} + +user_password <- paste(id[1], id[2], sep=":") + + +h <- new_handle(failonerror = TRUE) +handle_setopt(h, verbose = 0) +handle_setopt(h, userpwd = user_password) +handle_setopt(h, httpauth = 1) + +report_name <- c("signed_off") + + + +baseurl <- "http://patches.linaro.org/api/1.0/" +type <- "teams/?format=json&per_page=5000" + +url <- paste(baseurl, type, sep = "") +cat (url,"\n") + +webpage <- curl (url, handle = h) + +#get data it into R +jira_raw <- fromJSON(webpage,simplifyMatrix = TRUE, simplifyVector =TRUE, simplifyDataFrame = TRUE, flatten = TRUE) +#list of every issue + +df <- data.frame(id=jira_raw$id, name=jira_raw$display_name, url=jira_raw$url) + +row.names(df) <- jira_raw$display_name +str(df) + +n <- sapply(df$id,get_tags) +str(n) + +df$contributions <- n + +#table(n[[]]$project) +#I am gere getting bits out + +#print (df) +list.contributions <- do.call("rbind",df$contributions) + +unique.tags <- (unique(list.contributions$tag)) +unique.persons <- (unique(list.contributions$person)) +unique.projects <- (unique(list.contributions$project)) + +print(unique.tags) +print(unique.persons) +print(unique.projects) + +df$signed <- apply(df,1, get_signed) +df$acked <- apply(df,1, get_acked) +df$reviewed <- apply(df,1, get_reviewed) +df$tested <- apply(df,1, get_tested) +df$reported<- apply(df,1, get_reported) + + +m <- as.matrix(df[,5:9]) + +pdf(file="Linaro_team_vs_git_signoff.pdf", title = "team vs. git stats") +op <- par(mar=c(15,4,4,2)) +colours <- c("lightblue", "mistyrose", "lightcyan","lavender", "cornsilk") +inverse.m <- t(m) +barplot(inverse.m, las=2, + main="non author contribution", + ylab = "number of patches", + col =colours, + legend.text=TRUE, + args.legend=list(x='topleft') + ) + + +barplot(df$signed, main="signed off", las=2, ylab = "number of patches", + names.arg = row.names(df), col = colours[1]) +barplot(df$acked, las=2, main="acked", ylab = "number of patches", + names.arg = row.names(df), col = colours[2]) +barplot(df$reviewed, las=2, main="reviewed", ylab = "number of patches", + names.arg = row.names(df), col = colours[3]) +barplot(df$tested, las=2, main="tested", ylab = "number of patches", + names.arg = row.names(df), col = colours[4]) +barplot(df$reported, las=2, main="reported", ylab = "number of patches", + names.arg = row.names(df), col = colours[5]) + +dev.off() + +cat ("-----------------------\n") +pdf(file="Linaro_team_vs_project.pdf", title = "team vs. git stats") + +#str(n) +nm <- matrix(ncol=length(unique.projects), nrow=length(rownames(df))) +colnames(nm) <- unique.projects +print(nm) + +str(list.contributions) + +for ( p in rownames(nm)) +{ + print(p) +} + +dev.off() + + + -- cgit v1.2.3