@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Ignore non-existing diffs in copied code detector script

Auditors: epriestley

vrana f362e578 e08b4cbb

+13 -11
+13 -11
scripts/differential/detect_copied_code.php
··· 29 29 for ($diff_id = $from; $diff_id <= $to; $diff_id++) { 30 30 echo "Processing $diff_id"; 31 31 $diff = id(new DifferentialDiff())->load($diff_id); 32 - $diff->attachChangesets($diff->loadChangesets()); 33 - $orig_copy = array(); 34 - foreach ($diff->getChangesets() as $i => $changeset) { 35 - $orig_copy[$i] = idx((array)$changeset->getMetadata(), 'copy:lines'); 36 - $changeset->attachHunks($changeset->loadHunks()); 37 - } 38 - $diff->detectCopiedCode(); 39 - foreach ($diff->getChangesets() as $i => $changeset) { 40 - if (idx($changeset->getMetadata(), 'copy:lines') || $orig_copy[$i]) { 41 - echo "."; 42 - $changeset->save(); 32 + if ($diff) { 33 + $diff->attachChangesets($diff->loadChangesets()); 34 + $orig_copy = array(); 35 + foreach ($diff->getChangesets() as $i => $changeset) { 36 + $orig_copy[$i] = idx((array)$changeset->getMetadata(), 'copy:lines'); 37 + $changeset->attachHunks($changeset->loadHunks()); 38 + } 39 + $diff->detectCopiedCode(); 40 + foreach ($diff->getChangesets() as $i => $changeset) { 41 + if (idx($changeset->getMetadata(), 'copy:lines') || $orig_copy[$i]) { 42 + echo "."; 43 + $changeset->save(); 44 + } 43 45 } 44 46 } 45 47 echo "\n";