Page MenuHomePhabricator

Make it possible to specify what to do on edit conflict on action=edit
Open, NormalPublic


Currently mediawiki auto-merge edits on edit conflict. It would be more useful if it was possible to specify what should happen, for example there could be variable


automerge - would do what it does now
fail - would return an error in case there was any kind of edit conflict
overwrite - would ignore all edits of other people and would overwrite the page with new content

This is useful for things like antivandalism tools which need to deliver a message to users based on current content of their talkpage (the warning template level get adjusted based on templates currently present on the page). When two users post in same moment, the edit conflict get resolved by merging both messages, that have same level. Being able to fail on edit conflict would allow tool to redownload content of talk page and parse it again.

I believe that other bots / tools could use this as well when they edit the page based on current content of a page. Especially bots that are doing similar tasks.



Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 2:54 AM
bzimport added a project: MediaWiki-API.
bzimport set Reference to bz62698.
bzimport added a subscriber: Unknown Object (MLST).
Petrb created this task.Mar 15 2014, 4:43 PM

Just for info: auto merge is mostly provided by diff3, which must not be not part of all mediawiki installation, but exist for wmf wikis. So the documentation for auto-merge should be mention, that merge is only done, when the software is there and it is a trivial merge without merge conflicts.

Note that this would need changes to EditPage::internalAttemptSave, it can't easily be done only in ApiEditPage. One additional test in the 'if' at should do it. We could either turn the "$bot" parameter into a flag parameter or add a new local for no-merge to EditPage that ApiEditPage would set.

Ideally we'd do the following:

  • editconflictresolution=automerge as default. Requires starttimestamp and basetimestamp.
  • editconflictresolution=fail would be the new code. It also would require starttimestamp and basetimestamp, and would pass the no-merge flag to EditPage.
  • editconflictresolution=overwrite would be the same as what currently happens if you omit starttimestamp and basetimestamp. It would ignore starttimestamp and basetimestamp, and the docs would say something like "Using this mode is probably wrong, automerge should be used isntead.".

As for getting there from here (i.e. without breaking BC right away), we'd need to add a fourth case: rather than defaulting to automerge, editconflictresolution not given at all would do what the API does now and additionally include a warning if starttimestamp and basetimestamp weren't both specified.

Anomie moved this task from Unsorted to Needs Code on the MediaWiki-API board.Feb 19 2015, 6:39 PM
Rillke added a subscriber: Rillke.Jun 29 2015, 7:44 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 26 2015, 7:57 AM
Elitre added a subscriber: Elitre.Nov 18 2015, 8:07 PM
Addshore updated the task description. (Show Details)
Addshore set Security to None.
Addshore added subscribers: Sj, bzimport.