Implement [skip-revcheck] to exclude a commit from consideration. Closes GH-21

This commit is contained in:
Nilgün Belma Bugüner
2021-09-02 02:55:57 +03:00
parent c92fd4b435
commit daf0c803c2
2 changed files with 15 additions and 4 deletions

View File

@ -50,7 +50,7 @@ function get_outdated_files($idx, $lang, $filter = null, $value = null)
{
$sql = "SELECT a.status, a.name AS file, a.maintainer, c.revision AS en_rev, a.revision AS trans_rev, b.path AS dir
FROM translated a, dirs b, enfiles c
WHERE a.lang = '$lang'
WHERE a.lang = '$lang' AND c.skip = 0
AND c.name = a.name AND b.id = a.id AND b.id = c.id
AND (a.syncStatus = 'TranslatedOld'
OR a.syncStatus = 'TranslatedWip')";
@ -216,7 +216,7 @@ function get_translators($idx, $lang)
function get_stats($idx, $lang, $status) {
$sql = "SELECT COUNT(a.name) AS total, SUM(b.size) AS size
FROM translated a, enfiles b
WHERE a.lang = '$lang' AND a.id = b.id AND a.name = b.name AND ";
WHERE a.lang = '$lang' AND a.id = b.id AND a.name = b.name AND b.skip = 0 AND ";
if ($status == 'wip') {
$sql .= "a.syncStatus = 'TranslatedWip'";
} elseif ($status == 'notrans') {

View File

@ -95,6 +95,7 @@ CREATE TABLE enfiles (
name TEXT,
revision TEXT,
size INT,
skip INT,
UNIQUE(id, name)
);
@ -432,11 +433,13 @@ function captureGitValues( & $output )
$hash = null;
$date = null;
$utct = new DateTimeZone( "UTC" );
$skipThisCommit = 0;
while ( ( $line = fgets( $fp ) ) !== false )
{
if ( substr( $line , 0 , 7 ) == "commit " )
{
$hash = trim( substr( $line , 7 ) );
$skipThisCommit = 0;
continue;
}
if ( strpos( $line , 'Date:' ) === 0 )
@ -447,13 +450,20 @@ function captureGitValues( & $output )
if ( trim( $line ) == "" )
continue;
if ( substr( $line , 0 , 4 ) == ' ' )
continue;
{
if ( stristr( $line, '[skip-revcheck]' ) !== false )
{
$skipThisCommit = 1;
}
continue;
}
if ( strpos( $line , ': ' ) > 0 )
continue;
$filename = trim( $line );
if ( isset( $output[$filename] ) )
continue;
$output[$filename]['hash'] = $hash;
$output[$filename]['skip'] = $skipThisCommit;
}
pclose( $fp );
chdir( $cwd );
@ -484,11 +494,12 @@ foreach( $enFiles as $key => $en )
if ( isset( $gitData[ $filename ] ) )
{
$en->hash = $gitData[ $filename ]['hash'];
$en->skip = $gitData[ $filename ]['skip'];
}
else
print "Warn: No hash for en/$filename\n";
$SQL_BUFF .= "INSERT INTO enfiles VALUES ($id, '$en->name', '$en->hash', $size);\n";
$SQL_BUFF .= "INSERT INTO enfiles VALUES ($id, '$en->name', '$en->hash', $size, '$en->skip');\n";
foreach( $LANGS as $lang )
{