Created
September 30, 2014 13:26
-
-
Save pascalchevrel/8bd3a0dfa284ca349ddf to your computer and use it in GitHub Desktop.
Get Timestamp of svn commit for a file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getSVNCommitTimestamp($file) | |
{ | |
exec("svn info --xml ${file} 2>/dev/null", $output, $return_code); | |
if ($return_code) { | |
return false; | |
} | |
$file = new SimpleXMLElement(implode('', $output)); | |
$date = new DateTime($file->entry->commit->date); | |
return $date->getTimestamp(); | |
} | |
var_dump(getSVNCommitTimestamp('activism.txt')); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment