Skip to content

Instantly share code, notes, and snippets.

@jimhester
Created September 6, 2015 16:46
Show Gist options
  • Save jimhester/0f8ccb24c753cb0c0d05 to your computer and use it in GitHub Desktop.
Save jimhester/0f8ccb24c753cb0c0d05 to your computer and use it in GitHub Desktop.
library(xml2)
date <- "2015-04-17"
tmp <- tempfile()
system2("svn",
args = c("log",
"-r", sprintf("{%s}:HEAD", date),
"--xml",
"-v"),
stdout = tmp)
commits <- read_xml(tmp)
unlink(tmp)
# number of total commits
xml_length(commits)
# files touched for each commit
files <- lapply(as_list(xml_children(commits)),
function(x) xml_text(xml_find_all(x, ".//path[@kind='file']")))
# packages changed for each commit
packages <- lapply(files, function(x)
unique(gsub(x,
pattern = "/trunk/madman/Rpacks/([^/]+).*",
replacement = "\\1")))
# commits per package
table(unlist(packages))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment