Last modified: 2014-09-23 23:08:12 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T27598, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 25598 - Allowing merging when external diff3 is unavailable
Allowing merging when external diff3 is unavailable
Status: NEW
Product: MediaWiki
Classification: Unclassified
History/Diffs (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-10-20 11:09 UTC by Kef Schecter
Modified: 2014-09-23 23:08 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Patch to GlobalFunctions.php (1.16.0 version) to allow use of PEAR's Text_Diff_ThreeWay class (1.15 KB, patch)
2010-10-20 11:09 UTC, Kef Schecter
Details

Description Kef Schecter 2010-10-20 11:09:27 UTC
Created attachment 7742 [details]
Patch to GlobalFunctions.php (1.16.0 version) to allow use of PEAR's Text_Diff_ThreeWay class

Some hosts, especially shared hosts such as nearlyfreespeech.net, support MediaWiki, but do not support calling external programs such as diff3. The current behavior when diff3 is unavailable is to fall back on the old behavior of signaling a conflict edit whenever two people edit the same page, even if they edit completely different parts of the page using section edits. This can also happen with one user and multiple browser tabs -- I've been bitten this way, and it's a bit annoying. Hence, I've developed a proof-of-concept patch for using PEAR's Text_Diff_ThreeWay class when $wgDiff3 is empty. (The patch is for includes/GlobalFunctions.php in 1.16.0 sources, because that's the version I tested it on.)

There are some problems with the patch in its current incarnation.
* It uses PEAR, whereas, if I'm not mistaken, no other MediaWiki code uses PEAR. (However, there's still no dependency on PEAR if you do use an external diff3, and you can still fall back on the current behavior if PEAR is not available.)
* The code misuses the Text_Diff_ThreeWay class by reading one of its private variables (to check if there were any conflicts). There are no current practical workarounds that I can find.
* Very minor: The code could stop when it finds the first conflict, since that already invalidates the merge, but instead continues processing the entire text block. (I imagine the behavior with an external diff3 is similar, but hey, an optimization is an optimization.)
* The inputs need to be exploded (using PHP's explode() function) into multiple strings (one per line) and the output needs to be imploded into one string afterward, which is inefficient.

All of these can be resolved by adapting the library's source (which is LGPL) into MediaWiki itself and modifying it as necessary (though fixing the last may be nontrivial; I haven't checked), but I thought I'd rather float the idea here before trying it. (Also, if somebody wants to volunteer to do this for me, by all means... ;))
Comment 1 Sumana Harihareswara 2011-10-07 22:21:19 UTC
Kef, I'm so sorry it's taken so long for someone to look at your patch!  Does the annoying behavior (when diff3 is unavailable) still happen with MediaWiki 1.17.0?  And could you quickly check whether there are a lot of merge conflicts if you try it against MediaWiki trunk in Subversion?

Thank you for your patch and for contributing to MediaWiki.
Comment 2 Kef Schecter 2011-10-08 02:53:02 UTC
Actually, I've since found issues with the patch. Sometimes it prints a lot of warnings, like when two people edit the same section at the same time (or one person edits the same section twice at the same time using two tabs or windows), or when undoing edits.

In any case, I'm moving my wikis to a VPS, where such a patch is no longer necessary, so I don't have any interest in fixing or maintaining this patch anymore.
Comment 3 Bawolff (Brian Wolff) 2011-10-08 18:45:20 UTC
>Does the annoying behavior (when diff3 is unavailable) still happen with >MediaWiki

yes it does. (We give a warning during install if diff3 is not there.)
Comment 4 Sam Reed (reedy) 2011-11-20 13:11:52 UTC
Comment on attachment 7742 [details]
Patch to GlobalFunctions.php (1.16.0 version) to allow use of PEAR's Text_Diff_ThreeWay class

Marking as obsolete per the author

It might be useable as a base for someone to work on in future, but if it's got known issues, it's not a good thing to be adding as "supported" if it doesn't work correctly

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links