This proposal describes a method of treating MediaWiki edits as patches. It's got very limited scope, would be difficult to implement, would be error-prone, and would probably cause damage to data until it was completely bug-free. Still, it's worth documenting, so here it is.

Rationale

edit

Edit conflicts are infrequent but annoying occurrences when editing MediaWiki pages. Most annoying is when two edits are actually not in conflict at all -- they are completely compatible, but just happen to be on the same page at the same time.

In addition, if the differences are great, or the page is large, or the user is new, they'll sometimes abandon their changes rather than figure out the differences and fix the conflict. This means valuable information is not being contributed.

This proposal would reduce the messages and hand-editing that users have to do when they suffer a recoverable edit conflict. It treats each edit by a user as a en:patch to the page being edited. If one user gets their patch applied before the other, the next one can still be applied, as long as it doesn't truly conflict.

Design

edit

When an edit is saved for an article, the following steps are performed:

  1. If the page hasn't been saved since the user started editing, go ahead and just copy the new text in, as happens now.
  2. If it has been saved, calculate a en:diff of the text sent from the browser and the text as it was when the user started editing the page.
  3. Try to patch that diff to the current version of the text.
  4. If the patch succeeds, just continue regular processing.
  5. If the patch doesn't succeed, show the error to the user, and let them fix it manually (like conflicts are handled now).

Strong support from me. I've been thinking of this since I came here, but I've never got around to wording it into such a detailed proposal. Thank you. Just two things I would like to say:
  • We shouldn't use diff directly on the article text, because often very long paragraphs are a single "line". Perhaps it should be broken down into sentences or even individual words for the purposes of a diff. While we're at it, we can also improve the actual diff utility, which currently I find rather difficult to read.
    Our diff function is already word-based.
  • Whatever happens when the patch doesn't succeed (when there's a true conflict) needs more detailed consideration.
-- Timwi 03:10, 21 Dec 2003 (UTC)

Looking forward to your code. --Brion VIBBER 05:30, 21 Dec 2003 (UTC)


Will this allow reverts and rollbacks of individual edits that have not been patched over? That would make it much easier to fix sneaky vandalism and edits by banned users like Michael. Guanaco 04:00, 24 Jun 2004 (UTC)

Actually, this is just about edit conflicts, not dealing with old edits. Maybe there are some folks who are into gaming the edit conflict system already in place; I don't know how they'd do it, though. --Evan 06:25, 26 Jun 2004 (UTC)