; docformat = 'rst' function mg_repo::getTimeOfDayHistogram, n_bins compile_opt strictarr h = lonarr(n_bins) foreach e, self.log_entries do begin e->getProperty, date=date caldat, date, month, day, year, hour, minute, second t = (hour + minute / 60.0D + second / 60.0D / 60.0D) / 24.0D h[t * n_bins]++ endforeach return, h end pro mg_repo::printEntries compile_opt strictarr foreach e, self.log_entries do begin print, e endforeach end pro mg_repo::getLog compile_opt strictarr cmd = string(self.url, '(%"svn log %s")') spawn, cmd, output, error_output line = string(bytarr(72) + (byte('-'))[0]) lines = strmatch(output, line) lines_ind = where(lines, nlines) if (nlines gt 0L) then begin for l = 0L, nlines - 2L do begin entry_lines = output[lines_ind[l] + 1L:lines_ind[l + 1L] - 1L] entry = MG_RepoLogEntry(entry_lines) self.log_entries->add, entry, 0L endfor endif end ;= Property access methods pro mg_repo::getProperty, url=url compile_opt strictarr if (arg_present(url)) then url = self.url end pro mg_repo::setProperty, url=url compile_opt strictarr if (n_elements(url) gt 0) then self.url = url end ;= Lifecycle methods pro mg_repo::cleanup compile_opt strictarr obj_destroy, self.log_entries end function mg_repo::init, _extra=e compile_opt strictarr self.log_entries = list() self->setProperty, _extra=e return, 1 end pro mg_repo__define compile_opt strictarr define = { MG_Repo, $ url:'',$ log_entries: obj_new() $ } end ; main-level example program repo = MG_Repo(url='http://svn.idldev.com/idllib') repo->getLog nbins = 4L * 24L xticknames = lindgen(25) mod 12 xticknames[[0, 12, 24]] = 12 vis_window, xsize=7, ysize=2, /free, /inches vis_histplot, findgen(nbins) / (nbins / 24L), repo->getTimeOfDayHistogram(nbins), $ xticks=24L, xtickname=strtrim(xticknames, 2), $ xstyle=1, thick=2, $ yminor=5, yrange=[0., 40.], $ /fill, axis_color='ffffff'x, color='00ffff'x, $ title='Commits by time of day', xtitle='Time of day', ytitle='# of commits' end