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


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.

bzimport added a project: MediaWiki-API.Via ConduitNov 22 2014, 2:54 AM
bzimport added a subscriber: Unknown Object (MLST).
bzimport set Reference to bz62698.
Petrb created this task.Via LegacyMar 15 2014, 4:43 PM
Umherirrender added a comment.Via ConduitMar 15 2014, 5:36 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.

Anomie added a comment.Via ConduitMar 17 2014, 4:04 PM

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 to Needs Code on the MediaWiki-API workboard.Via WebFeb 19 2015, 6:39 PM
mgrabovsky added a subscriber: mgrabovsky.Via WebMay 23 2015, 6:14 PM
Rillke added a subscriber: Rillke.Via WebJun 29 2015, 7:44 PM
Umherirrender removed a subscriber: Umherirrender.Via WebJul 5 2015, 7:25 PM
Ricordisamoa added a subscriber: Ricordisamoa.Via WebJul 26 2015, 7:57 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptVia HeraldJul 26 2015, 7:57 AM
Elitre added a subscriber: Elitre.Via WebNov 18 2015, 8:07 PM
Addshore added subscribers: Sj, bzimport.Via WebWed, Jan 27, 3:58 PM
Addshore edited the task description. (Show Details)
Addshore set Security to None.

Add Comment