|
From: <car...@us...> - 2025-02-22 04:28:05
|
Revision: 11157
http://sourceforge.net/p/phpwiki/code/11157
Author: carstenklapp
Date: 2025-02-22 04:28:03 +0000 (Sat, 22 Feb 2025)
Log Message:
-----------
Rollback some changes to LoadFileConflictPageEditor which broke saving merged edits. Fixed unset variable and clarified text in getConflictMessage.
Modified Paths:
--------------
trunk/lib/editpage.php
Modified: trunk/lib/editpage.php
===================================================================
--- trunk/lib/editpage.php 2025-02-21 01:50:21 UTC (rev 11156)
+++ trunk/lib/editpage.php 2025-02-22 04:28:03 UTC (rev 11157)
@@ -1297,6 +1297,9 @@
public function editPage($saveFailed = true)
{
$tokens = &$this->tokens;
+ if (!isset($tokens['EDITING_OLD_REVISION_MESSAGE'])) {
+ $tokens['EDITING_OLD_REVISION_MESSAGE'] = '';
+ }
if (!$this->canEdit()) {
if ($this->isInitialEdit()) {
@@ -1318,44 +1321,38 @@
// an array, or convert it as necesary.
$orig = $this->page->getRevision($this->_currentVersion);
$this_content = explode("\n", $this->_content);
- $orig_content = $orig->getContent();
$other_content = $this->current->getContent();
- // require_once 'lib/diff.php';
- // $diff2 = new Diff($other_content, $this_content);
- require_once 'lib/diff3.php';
- $diff2 = new diff3($orig_content, $this_content, $other_content);
- $output = $diff2->merged_output(_("Loaded version"), _("Existing version"));
- $this->_content = implode("\n", $output);
-
- // $context_lines = max(
- // 4,
- // count($other_content) + 1,
- // count($this_content) + 1
- // );
- // $fmt = new BlockDiffFormatter($context_lines);
- // $this->_content = $fmt->format($diff2);
+ require_once 'lib/diff.php';
+ $diff2 = new Diff($other_content, $this_content);
+ $context_lines = max(
+ 4,
+ count($other_content) + 1,
+ count($this_content) + 1
+ );
+ $fmt = new BlockDiffFormatter($context_lines);
+ $this->_content = $fmt->format($diff2);
// FIXME: integrate this into class BlockDiffFormatter
- // $this->_content = str_replace(
- // ">>>>>>>\n<<<<<<<\n",
- // " ~=======\n",
- // $this->_content
- // );
- // $this->_content = str_replace(
- // "<<<<<<<\n>>>>>>>\n",
- // " ~=======\n",
- // $this->_content
- // );
- // // reformat diff markers to prevent from being interpreted as markup
- // $this->_content = str_replace(
- // "<<<<<<<\n",
- // " ~<<<<<<<\n",
- // $this->_content
- // );
- // $this->_content = str_replace(
- // ">>>>>>>\n",
- // " ~>>>>>>>\n",
- // $this->_content
- // );
+ $this->_content = str_replace(
+ ">>>>>>>\n<<<<<<<\n",
+ " ~=======\n",
+ $this->_content
+ );
+ $this->_content = str_replace(
+ "<<<<<<<\n>>>>>>>\n",
+ " ~=======\n",
+ $this->_content
+ );
+ // reformat diff markers to prevent from being interpreted as markup
+ $this->_content = str_replace(
+ "\n<<<<<<<\n",
+ "\n ~<<<<<<<\n",
+ $this->_content
+ );
+ $this->_content = str_replace(
+ "\n>>>>>>>\n",
+ "\n ~>>>>>>>\n",
+ $this->_content
+ );
$this->_currentVersion = $this->current->getVersion();
$this->version = $this->_currentVersion;//fixme: is this correct? apples to EDITING_OLD_REVISION_MESSAGE also. $this->selected->getVersion()
@@ -1369,10 +1366,10 @@
$tokens['PREVIEW_CONTENT'] = $this->getPreview();
} // FIXME: convert to _MESSAGE?
- // FIXME: NOT_CURRENT_MESSAGE? ok trying
- if (($this->version > 0) && ($this->version < $this->_currentVersion)) {
- $tokens['EDITING_OLD_REVISION_MESSAGE'] = $this->getEditOldmsg();
- }
+ // // FIXME: NOT_CURRENT_MESSAGE? probably not needed in the context of restoring from pgsrc
+ // if (($this->version > 0) && ($this->version < $this->_currentVersion)) {
+ // $tokens['EDITING_OLD_REVISION_MESSAGE'] = $this->getEditOldmsg();
+ // }
$tokens = array_merge($tokens, $this->getFormElements());
// we need all GET params for loadfile overwrite
@@ -1436,9 +1433,10 @@
{
return HTML(HTML::p(
fmt(
- "Some of the changes could not automatically be combined. Please look for sections beginning with “%s”, and ending with “%s”. You will need to edit those sections by hand before you click Save.",
+ _("The version differences are sections marked by “%s”, “%s”, and “%s”. You will need to edit those sections by hand before you click Save."),
"<<<<<<<",
- "======="
+ "=======",
+ ">>>>>>>"
),
HTML::p(_("Please check it through before saving."))
));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|