Example #1
0
 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;
 }
Example #2
0
 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;
 }
Example #3
0
 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;
 }