Last modified: 2014-08-29 08:26:42 UTC
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 &editconflictresolution=[automerge|fail|overwrite] 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.
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 https://git.wikimedia.org/blob/mediawiki%2Fcore.git/97a4ad45/includes%2FEditPage.php#L1697 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.