aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/diff/diff.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2009-09-20 16:20:20 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2009-09-20 16:20:20 +0000
commit97be42d31c50efb248086c7147e6e768154404a4 (patch)
tree548276cd331e306af386e4bc17382b09326c73b7 /phpBB/includes/diff/diff.php
parent7a244e1d2bd62f87d678c754b0890fb7ac379673 (diff)
downloadforums-97be42d31c50efb248086c7147e6e768154404a4.tar
forums-97be42d31c50efb248086c7147e6e768154404a4.tar.gz
forums-97be42d31c50efb248086c7147e6e768154404a4.tar.bz2
forums-97be42d31c50efb248086c7147e6e768154404a4.tar.xz
forums-97be42d31c50efb248086c7147e6e768154404a4.zip
improve code to detect and solve conflicts for code removed from one version to another.
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10168 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/diff/diff.php')
-rw-r--r--phpBB/includes/diff/diff.php24
1 files changed, 16 insertions, 8 deletions
diff --git a/phpBB/includes/diff/diff.php b/phpBB/includes/diff/diff.php
index 6bda3df43e..60af574b78 100644
--- a/phpBB/includes/diff/diff.php
+++ b/phpBB/includes/diff/diff.php
@@ -997,30 +997,38 @@ class diff3_op
// CASE THREE: Removed lines (orig has the to-remove line(s), but final1 has additional lines which does not need to be removed). Just remove orig from final1 and then use final1 as final2/merge
if (!sizeof($this->final2) && sizeof($this->orig) && sizeof($this->final1) && $this->orig !== $this->final1)
{
+ $result = $this->_compare_conflict_seq('orig', 'final1');
+
+ if (!$result['merge_found'])
+ {
+ return;
+ }
+
// First of all, try to find the code in orig in final1. ;)
$compare_seq = sizeof($this->orig);
- $begin = -1;
- $j = $end = 0;
+ $begin = $end = -1;
+ $j = 0;
- foreach ($this->final1 as $i => $line)
+ for ($i = 0, $size = sizeof($this->final1); $i < $size; $i++)
{
+ $line = $this->final1[$i];
+
if (trim($line) === trim($this->orig[$j]))
{
+ // Mark begin
if ($begin === -1)
{
$begin = $i;
}
+ // End is always $i, the last found line
+ $end = $i;
+
if (isset($this->orig[$j+1]))
{
$j++;
}
}
-
- if ($begin !== -1)
- {
- $end++;
- }
}
if ($begin !== -1 && $begin + ($compare_seq - 1) == $end)