aboutsummaryrefslogtreecommitdiffstats
path: root/build/diff_class.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2010-02-23 15:07:58 +0000
committerNils Adermann <naderman@naderman.de>2010-02-23 15:07:58 +0000
commit83cf74de2b509ea367d93ad3f9a3a43d24ed012b (patch)
treed403cc9bacc84fc2b9f783778c8e24df86bb5cbb /build/diff_class.php
parente8f01ff74b58d9d73ff3c32507d843b8b14d92e5 (diff)
downloadforums-83cf74de2b509ea367d93ad3f9a3a43d24ed012b.tar
forums-83cf74de2b509ea367d93ad3f9a3a43d24ed012b.tar.gz
forums-83cf74de2b509ea367d93ad3f9a3a43d24ed012b.tar.bz2
forums-83cf74de2b509ea367d93ad3f9a3a43d24ed012b.tar.xz
forums-83cf74de2b509ea367d93ad3f9a3a43d24ed012b.zip
Fixing the code changes from diff building script: When an edit was detected as replacing an empty line by diff it would get dropped from the code changes
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10522 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'build/diff_class.php')
-rw-r--r--build/diff_class.php62
1 files changed, 48 insertions, 14 deletions
diff --git a/build/diff_class.php b/build/diff_class.php
index 0d7c2dcd3a..4625ffde24 100644
--- a/build/diff_class.php
+++ b/build/diff_class.php
@@ -1181,7 +1181,19 @@ class BBCodeDiffFormatter extends DiffFormatter
$text = implode('', $order_array['find_c']);
if ($text === "\n" || $text === "\t" || $text === '')
{
- return true;
+ if (isset($order_array['first_find_c'][0]) &&
+ is_array($order_array['first_find_c'][0]) &&
+ trim(implode('', $order_array['first_find_c'][0])) != '' &&
+ isset($order_array['replace']))
+ {
+ $order_array['add'] = $order_array['replace'];
+ unset($order_array['replace']);
+ // this is actually an after add
+ }
+ else
+ {
+ return true;
+ }
}
}
@@ -1223,18 +1235,42 @@ class BBCodeDiffFormatter extends DiffFormatter
$text = implode('', $order_array['find_c']);
if ($text === "\n" || $text === "\t" || $text === '')
{
- continue;
+ // no real find, use first_find_c if possible!
+ //var_dump($order_array);
+ if (is_array($order_array['first_find_c'][0]))
+ {
+ $order_array['find_c'] = $order_array['first_find_c'][0];
+ }
+ else
+ {
+ if (isset($order_array['replace']) || isset($order_array['add']) || isset($order_array['delete']))
+ {
+ echo "skipped an edit!\n";
+ var_dump($order_array);
+ }
+ continue;
+ }
}
-
- if (strlen(implode('', $order_array['find_c'])) < 50 && is_array($order_array['first_find_c'][0]))
+ else
{
- $html .= "#\n#-----[ FIND ]---------------------------------------------\n# Around Line {$ybeg}\n";
- $html .= implode("", $order_array['first_find_c'][0]);
- $html .= "\n";
- $ybeg += sizeof($order_array['first_find_c'][0]);
+ if (strlen(implode('', $order_array['find_c'])) < 50 && is_array($order_array['first_find_c'][0]))
+ {
+ $html .= "#\n#-----[ FIND ]---------------------------------------------\n# Around Line {$ybeg}\n";
+ $html .= implode("", $order_array['first_find_c'][0]);
+ $html .= "\n";
+ $ybeg += sizeof($order_array['first_find_c'][0]);
+ }
}
}
+ // still here but nothing to do? what the heck?
+ if (!isset($order_array['replace']) && !isset($order_array['add']) && !isset($order_array['delete']))
+ {
+ echo "skipped an edit!\n";
+ var_dump($order_array);
+ continue;
+ }
+
if (sizeof($order_array['find_c']))
{
$html .= "#\n#-----[ FIND ]---------------------------------------------\n# Around Line {$ybeg}\n";
@@ -1309,7 +1345,7 @@ class BBCodeDiffFormatter extends DiffFormatter
{
if (isset($hunk['a']) && isset($hunk['d']))
{
- /* if (sizeof($hunk['a']) == 1 && sizeof($hunk['d']) == 1)
+ /**/ if (sizeof($hunk['a']) == 1 && sizeof($hunk['d']) == 1)
{
if (preg_match('/\* @version \$Id:.+\$$/', $hunk['a'][0]) && preg_match('/\* @version \$Id:.+\$$/', $hunk['d'][0]))
{
@@ -1318,7 +1354,7 @@ class BBCodeDiffFormatter extends DiffFormatter
$reorder = true;
continue;
}
- }*/
+ }/**/
// Compare the add and replace one...
$string_1 = rtrim(trim(implode('', $hunk['a'])));
@@ -1349,7 +1385,7 @@ class BBCodeDiffFormatter extends DiffFormatter
{
if (isset($hunk['a']) && isset($hunk['d']))
{
- /* if (sizeof($hunk['a']) == 1 && sizeof($hunk['d']) == 1)
+ /**/ if (sizeof($hunk['a']) == 1 && sizeof($hunk['d']) == 1)
{
if (preg_match('/\* @version \$Id:.+\$$/', $hunk['a'][0]) && preg_match('/\* @version \$Id:.+\$$/', $hunk['d'][0]))
{
@@ -1358,7 +1394,7 @@ class BBCodeDiffFormatter extends DiffFormatter
$reorder = true;
continue;
}
- }*/
+ }/**/
// Compare the add and replace one...
$string_1 = rtrim(trim(implode('', $hunk['a'])));
@@ -1673,5 +1709,3 @@ class MODXDiffFormatter extends BBCodeDiffFormatter
{
}
}
-
-?> \ No newline at end of file