Follow-up to:
#120955: Integrate Diff into Core

Steps

  1. Compare DiffEngine.php with PhpWiki's original diff*.php files. Document all differences.
  2. Compare and merge DiffEngine.php with improvements in MediaWiki's DairikiDiff.php.
  3. Commit combined improvements.

Postponed until feature freeze. No reason to work on that before.

Comments

Alan D.’s picture

The only change of significance that I could see with the core Diff classes is below. I only compared the classes from the introduction of the file in 4.7. This was added between 7.x-2.x and 7.x-3.x and was done to introduce a way to count lines across multiple calls to the DiffFormatter class

class DiffFormatter {
// This was incorrectly defined in DrupalDiffFormatter...
+  var $line_stats = array(
+      'counter' => array('x' => 0, 'y' => 0),
+      'offset' => array('x' => 0, 'y' => 0),
+  );

  function format($diff) {
.....
+
+    if (!empty($xi)) {
+      $this->line_stats['counter']['x'] += $xi;
+    }
+    if (!empty($yi)) {
+      $this->line_stats['counter']['y'] += $yi;
+    }
+
     return $end;
   }
}

As far as I could tell, all other changes were done in relation to coding standards, minor notices such as non-initialised variables, etc.

Alan D.’s picture

Flagged #1826156: Move to Text_Diff library as a duplicate from the Diff module queue.

Links to http://dev.horde.org/api/master/lib/Text_Diff/

Alan D.’s picture

Issue summary: View changes

Updated issue summary.

mgifford’s picture

Issue summary: View changes
Status: Postponed » Active

We're at Beta1 so assume this is a good time.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

kiamlaluno’s picture

The link given in the OP (https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a=history;f=i...) returns a not found string. Does anybody know the correct link?

Alan D.’s picture

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

kiamlaluno’s picture

Instead of integrating code that should then be still maintained, why don't we integrate classes that can be loaded with Composer? Even if there would be the need to write a class that extend the new class(es), the code to maintain would be less than actually is.

neclimdul’s picture

Assigned: sun » Unassigned

sounds like a fine 9 plan but the classes are an 8 interface we'll have to continue to maintain.

kiamlaluno’s picture

I was thinking more of changing just the class doing the job. There would be a proxy class that calls the appropriate methods of that class, so the interface to the world would not change.

neclimdul’s picture

as I remember the implementation is pretty granular and most of the classes are data objects so I'm not sure how realistic that would be.

neclimdul’s picture

Of note, there is sort of already another diff library in vendor. Sebastian has a diff library phpunit uses so it gets pulled in through our dev deps. I think we looked at it when moving stuff to libraries but it was different enough the upgrade process was going to be complicated and time was spent else where. If your interested it might be a good place to start though.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.