/** * @param string Path to repository * @param int Number of revision (0 = no limit) * @return array Key are revision number example: * array( * 1 => array("author" => "duponc_j", "msg" => "Test", date=> 1265413), * 2 => array("revision" => "crivis_s", "msg" => "Test2", date=>4565654) * ) * * Date are unix timestamp */ public static function log($repository, $limit = 0, $start = 0, $end = 0) { $repository = USVN_SVNUtils::getRepositoryPath($repository); if ($limit) { $limit = escapeshellarg($limit); $limit = "--limit {$limit}"; } else { $limit = ""; } if ($start) { $revision = "-r {$start}"; if ($end) { $revision .= ":{$end}"; } } else { $revision = ""; } $message = USVN_ConsoleUtils::runCmdCaptureMessageUnsafe(USVN_SVNUtils::svnCommand("log --xml {$revision} {$limit} {$repository}"), $return); if ($return) { throw new USVN_Exception(T_("Can't get subversion repository logs: %s"), $message); } return USVN_SVNLog::parseOutput($message); }
/** * @param string Path to repository * @param int Number of revisiom (0 = no limit) * @return array Key are revision number example: * array( * 1 => array("author" => "duponc_j", "msg" => "Test", date=> 1265413), * 2 => array("revision" => "crivis_s", "msg" => "Test2", date=>4565654) * ) * * Date are unix timestamp */ public function log($limit = 0, $start = 0, $end = 0) { return USVN_SVNLog::log($this->_repository, $limit, $start, $end); }
public function test_nolimit() { $res = USVN_SVNLog::log('tests/tmp/svn directory', 0); $this->assertEquals(count($res), 3); $rev3 = $res[3]; $rev1 = $res[1]; $this->assertEquals('USVN', $rev1['author']); $this->assertEquals('tutu', $rev3['author']); $this->assertEquals('Test2', $rev3['msg']); $this->assertEquals('1984', date('Y', $rev3['date'])); $this->assertEquals('12', date('m', $rev3['date'])); $this->assertEquals('03', date('d', $rev3['date'])); $this->assertEquals('01', date('H', $rev3['date'])); $this->assertEquals('02', date('i', $rev3['date'])); $this->assertEquals('03', date('s', $rev3['date'])); }