Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f9921a1
DTO for revcheck data.
Oct 25, 2024
d72bb52
Preparation for revcheck data exporting.
Oct 26, 2024
72453ce
Backport loose and fixed [skip-revcheck] modes
Oct 26, 2024
600714c
Additional revcheck data.
Nov 1, 2024
221e0dc
Revcheck deduplication: clean up, header.
Nov 1, 2024
83fb651
Revcheck deduplication: translators, file summary.
Nov 1, 2024
3b62b38
Revcheck deduplication: old/wip files.
Nov 5, 2024
156b0b5
Move backport code and docs to a separate file.
Nov 5, 2024
4405435
Revcheck deduplication: backport couting behaviour.
Nov 5, 2024
31cf0db
Revcheck deduplication: more backport couting woes.
Nov 5, 2024
324f48c
Revcheck deduplication: notinen, revtag, unstranslated.
Nov 5, 2024
60b5f1e
Revcheck deduplication: ignore, regex, xml.
Nov 6, 2024
a0ddca6
Revcheck deduplication: adds/dels, clean up.
Nov 6, 2024
55bae33
Revcheck deduplicatoin: genrevdb.php.
Nov 7, 2024
1ab908c
Revcheck deduplicatoin: genrevdb.php.
Nov 7, 2024
a08561f
More backport and small fixes.
Nov 7, 2024
d254ced
Review changes/fixes.
Nov 7, 2024
117a61d
Better log messages.
Nov 7, 2024
3eb4ef5
Remove unrelated filter.
Nov 8, 2024
bf4f663
Merge branch 'php:master' into master
alfsb Nov 11, 2024
e1f8400
Changes revcheck to consider one or many hashes, instead of two.
Nov 11, 2024
0460e4b
Changes revcheck to consider one or many hashes, instead of two.
Nov 11, 2024
0d5b26a
Changes revcheck to consider one or many hashes, instead of two.
Nov 11, 2024
a58d5a2
Merge branch 'php:master' into FIXED_SKIP_REVCHECK
alfsb Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revcheck deduplication: old/wip files.
  • Loading branch information
André L F S Bacci committed Nov 5, 2024
commit 3b62b38d05777b236102fbfdb31137de40618fd3
200 changes: 103 additions & 97 deletions scripts/revcheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,18 @@

// Output

function print_html_all( $data )
function print_html_all( RevcheckData $data )
{
print_html_header( $data );
print_html_translators( $data );
//print_html_files( $enFiles , $trFiles , $lang );
print_html_oldwip( $data );
//print_html_notinen();
//print_html_misstags( $enFiles, $trFiles, $lang );
//print_html_untranslated( $enFiles );
//print_html_footer();
}

function print_html_header( $data )
function print_html_header( RevcheckData $data )
{
$lang = $data->lang;
$date = $data->date;
Expand Down Expand Up @@ -109,7 +109,7 @@ function print_html_header( $data )
HTML;
}

function print_html_menu($href)
function print_html_menu( string $href )
{
print <<<HTML
<a id="$href"/>
Expand All @@ -124,7 +124,7 @@ function print_html_menu($href)
HTML;
}

function print_html_translators( $data )
function print_html_translators( RevcheckData $data )
{
$translators = $data->translators;
if ( count( $translators ) == 0 )
Expand Down Expand Up @@ -152,20 +152,12 @@ function print_html_translators( $data )
</tr>
HTML;

$totalOk = 0;
$totalOld = 0;
$totalWip = 0;

foreach( $translators as $person )
{
// Unknown or untracked on translations.xml
if ( $person->name == "" && $person->email == "" && $person->vcs == "" )
continue;

$totalOk += $person->filesUpdate;
$totalOld += $person->filesOld;
$totalWip += $person->filesWip;

$personSum = $person->filesUpdate + $person->filesOld + $person->filesWip;

print <<<HTML
Expand Down Expand Up @@ -220,13 +212,107 @@ function print_html_translators( $data )
</tr>
HTML;
}
print <<<HTML

print <<<HTML
<tr>
<td><b>$label</b></td>
<td><b>$count</b></td>
<td><b>$perc</b></td>
<td><b>Files total</b></td>
<td><b>$filesTotal</b></td>
<td><b>100%</b></td>
</tr>
</table>
HTML;
}

function print_html_oldwip( RevcheckData $data )
{
print_html_menu("files");

$total = $data->fileSummary[ RevcheckStatus::TranslatedOld->value ];
$total += $data->fileSummary[ RevcheckStatus::TranslatedWip->value ];
$total += $data->fileSummary[ RevcheckStatus::RevTagProblem->value ];
if ( $total == 0 )
{
print "<p>Hooray! There is no files to update, nice work!</p>\n\n";
return;
}

print <<<HTML
<table>
<tr>
<th rowspan="2">Translated file</th>
<th rowspan="2">Changes</th>
<th colspan="2">Hash</th>
<th rowspan="2">Maintainer</th>
<th rowspan="2">Status</th>
<th rowspan="2">Days</th>
</tr>
<tr>
<th>en</th>
<th>{$data->lang}}</th>
</tr>\n
HTML;

$now = new DateTime( 'now' );
$path = null;
asort( $data->fileDetail );

foreach( $data->fileDetail as $key => $file )
{
switch ( $file->status )
{
case RevcheckStatus::TranslatedOld:
case RevcheckStatus::TranslatedWip:
case RevcheckStatus::RevTagProblem:
break;
default:
continue 2;
}

if ( $path !== $file->path )
{
$path = $file->path;
$path2 = $path == '' ? '/' : $path;
print " <tr><th colspan='7' class='c'>$path2</th></tr>";
}

$ma = $file->maintainer;
$st = $file->completion;
$ll = strtolower( $data->lang );
$kh = hash( 'sha256' , $key );
$d1 = "https://doc.php.net/revcheck.php?p=plain&amp;lang={$ll}&amp;hbp={$file->hashRvtg}&amp;f=$key";
$d2 = "https://doc.php.net/revcheck.php?p=plain&amp;lang={$ll}&amp;hbp={$file->hashRvtg}&amp;f=$key&amp;c=on";

$nm = "<a href='$d1'>{$file->name}</a> <a href='$d2'>[colored]</a>";
if ( $file->status == RevcheckStatus::RevTagProblem ) // $file->hashRvtg empty or invalid
$nm = $file->name;
$h1 = "<a href='https://github.com/php/doc-en/blob/{$file->hashLast}/$key'>{$file->hashLast}</a>";
$h2 = "<a href='https://github.com/php/doc-en/blob/{$file->hashRvtg}/$key'>{$file->hashRvtg}</a>";

if ( $file->adds > 0 || $file->dels > 0 )
$ch = "<span style='color: darkgreen;'>+{$file->adds}</span> <span style='color: firebrick;'>-{$file->dels}</span>";
else
$ch = "<span></span>";

$bgdays = '';
if ( $file->days > 90 )
$bgdays = 'bgorange';

print <<<HTML
<tr class="bggray">
<td>$nm</td>
<td class="c">$ch</td>
<td class="oc">
<button class="btn copy" data-clipboard-text="{$file->hashLast}">Copy</button> $h1
</td>
<td class="o">$h2</td>
<td class="c">$ma</td>
<td class="c">$st</td>
<td class="c {$bgdays}">{$file->days}</td>
</tr>\n
HTML;
}

print "</table><p/>\n\n";
}

function print_html_misstags( $enFiles, $trFiles, $lang )
Expand Down Expand Up @@ -330,86 +416,6 @@ function print_html_footer()
</html>
HTML;
}

function print_html_files( $enFiles , $trFiles , $lang )
{
print_html_menu("files");
print <<<HTML
<table>
<tr>
<th rowspan="2">Translated file</th>
<th rowspan="2">Changes</th>
<th colspan="2">Hash</th>
<th rowspan="2">Maintainer</th>
<th rowspan="2">Status</th>
<th rowspan="2">Days</th>
</tr>
<tr>
<th>en</th>
<th>$lang</th>
</tr>

HTML;

$now = new DateTime( 'now' );
$path = null;
asort($trFiles);
foreach( $trFiles as $key => $tr )
{
if ( $tr->syncStatus == FileStatusEnum::TranslatedOk )
continue;
if ( $tr->syncStatus == FileStatusEnum::RevTagProblem )
continue;
if ( $tr->syncStatus == FileStatusEnum::NotInEnTree )
continue;
$en = $enFiles[ $key ];
if ( $en->syncStatus == FileStatusEnum::Untranslated )
continue;

if ( $path !== $en->path )
{
$path = $en->path;
$path2 = $path == '' ? '/' : $path;
print " <tr><th colspan='7' class='c'>$path2</th></tr>";
}
$ll = strtolower( $lang );
$kh = hash( 'sha256' , $key );
$d1 = "https://doc.php.net/revcheck.php?p=plain&amp;lang={$ll}&amp;hbp={$tr->hash}&amp;f=$key&amp;c=on";
$d2 = "https://doc.php.net/revcheck.php?p=plain&amp;lang={$ll}&amp;hbp={$tr->hash}&amp;f=$key&amp;c=off";
$nm = "<a href='$d2'>{$en->name}</a> <a href='$d1'>[colored]</a>";
if ( $en->syncStatus == FileStatusEnum::RevTagProblem )
$nm = $en->name;
$h1 = "<a href='https://github.com/php/doc-en/blob/{$en->hash}/$key'>{$en->hash}</a>";
$h2 = "<a href='https://github.com/php/doc-en/blob/{$tr->hash}/$key'>{$tr->hash}</a>";

$bgdays = '';
if ($en->days != null && $en->days > 90)
$bgdays = 'bgorange';

if ($en->adds != null)
$ch = "<span style='color: darkgreen;'>+{$en->adds}</span> <span style='color: firebrick;'>-{$en->dels}</span>";
else
$ch = "<span style='color: firebrick;'>no data</span>";

$ma = $tr->maintainer;
$st = $tr->completion;
print <<<HTML
<tr class="bggray">
<td>$nm</td>
<td class="c">$ch</td>
<td class="oc">
<button class="btn copy" data-clipboard-text="{$en->hash}">Copy</button> $h1
</td>
<td class="o">$h2</td>
<td class="c">$ma</td>
<td class="c">$st</td>
<td class="c {$bgdays}">{$en->days}</td>
</tr>
HTML;
}
print "</table><p/>\n";
}

function print_html_notinen()
{
global $oldfiles, $notinen_count;
Expand Down
9 changes: 7 additions & 2 deletions scripts/translation/lib/RevcheckData.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,14 @@ class RevcheckDataFile
public string $name;
public int $size;
public int $days;
public int $adds = 0;
public int $dels = 0;

public RevcheckStatus $status;
public string $maintainer = "";
public string $completion = "";

public string $hashLast; // The most recent commit hash, skipped or not
public string $hashDiff; // The most recent, non [skip-revcheck] commit hash
public string $hashLast; // The most recent commit hash, skipped or not
public string $hashDiff; // The most recent, non [skip-revcheck] commit hash
public string $hashRvtg = ""; // Revtag hash, if any
}
4 changes: 4 additions & 0 deletions scripts/translation/lib/RevcheckRun.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ private function addData( RevcheckFileInfo $info , RevtagInfo|null $revtag = nul

if ( $revtag != null )
{
$file->hashRvtg = $revtag->revision;
$file->maintainer = $revtag->maintainer;
$file->completion = $revtag->status;

$translator = $this->revData->getTranslator( $revtag->maintainer );

switch( $info->status )
Expand Down