stdio = $stdio; $this->revision = $revision; } /** * Render a response object. */ function render($output_body=true) { $this->outputHeaders(); if ($output_body) { $certs = $this->stdio->exec(array('certs', $this->revision)); $stanzas = IDF_Scm_Monotone_BasicIO::parse($certs); // use the revision's date (if there is one) as timestamp // for all file entries $timestamp = time(); foreach ($stanzas as $stanza) { $next_is_date = false; foreach ($stanza as $line) { if ($line['key'] == 'name' && $line['values'][0] == 'date') { $next_is_date = true; continue; } if ($next_is_date && $line['key'] == 'value') { $timestamp = strtotime($line['values'][0]); break; } } } $manifest = $this->stdio->exec(array('get_manifest_of', $this->revision)); $stanzas = IDF_Scm_Monotone_BasicIO::parse($manifest); $zip = new ZipStream(); foreach ($stanzas as $stanza) { if ($stanza[0]['key'] != 'file') continue; $content = $this->stdio->exec(array('get_file', $stanza[1]['hash'])); $zip->add_file( $stanza[0]['values'][0], $content, array('time' => $timestamp) ); } $zip->finish(); } } }