public static function revision($path = '.') { $path = DirUtils::normalizeDir($path); $rev = -1; if (file_exists($path . '.hg')) { $rev = `hg tip --template "{rev}" -R {$path}`; if (preg_match("/(\\d+)/", $rev, $m)) { $rev = $m[1]; } } return $rev; }
public static function revision($path = '.') { $path = DirUtils::normalizeDir($path); $rev = -1; if (file_exists($path . '.svn/entries')) { $rev = `svnversion {$path} --no-newline`; if (preg_match("/(\\d+)[MS]+/", $rev, $m)) { $rev = $m[1]; } } return $rev; }
public static function revision($path = '.') { $path = DirUtils::normalizeDir($path); $rev = -1; if (file_exists($path . '.git')) { $wd = getcwd(); chdir($path); $rev = intval(`git rev-list HEAD --count`); chdir($wd); } return $rev; }