Page MenuHomePhabricator

Undo does not detect "the revision was already undone", instead displaying "can be undone" with an empty diff
Closed, ResolvedPublic

Description

After looking at the only edit made by an IP on Portuguese Wikipedia
([[pt:Special:Contributions/200.207.233.191]])
and going to the diff of his edit[1] and clicking on "undo", which points to page [2], MediaWiki displayed the text of [[MediaWiki:undo-success]] but the diff was empty, I mean, there was no changes made.

Could you check why it didn't revert to the original version of the article? (or, alternatively, if it is not able to revert, why didn't show [[MediaWiki:undo-failure]] instead?)

PS: For now, I didn't remove the content, so that you can check what is wrong.

[1] https://secure.wikimedia.org/wikipedia/pt/w/index.php?title=Lens_%28Fran%E7a%29&diff=prev&oldid=21742940&uselang=en
[2] https://secure.wikimedia.org/wikipedia/pt/w/index.php?title=Lens_%28Fran%C3%A7a%29&action=edit&undoafter=20854041&undo=21742940&uselang=en


Version: unspecified
Severity: normal

Details

Reference
bz29762

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:32 PM
bzimport set Reference to bz29762.

Undo works much like edit conflict resolution: it acts as if you had opened an edit window at the revision of the IP's edit and pasted in the previous revision's content, and then tries to merge the resulting change with all of the changes that were made to the page after the IP's edit. If it succeeds then the undo is deemed successful, while if there would be an edit conflict then it says the undo was unsuccessful.

What appears to have happened there is that a following edit[1] moved the IP's text from the end of the page to somewhere above the interwiki links. So when it takes your undo revision of "remove the text from the end of the article" combined with that bot's revision of "remove the text from the end of the article, insert the text somewhere else in the article, and insert an interwiki link", the merge succeeds because the "remove the text from the end of the article" bits in both of those edits are recognized as doing the same thing.

This situation should probably be detected with a message along the lines of "The edit appears to have already been undone" instead of displaying an empty diff.

I note that the result you state you expected, that the article was restored to the version before the IP's edit, is probably *not* what you would actually have wanted. Judging by the timestamp on the original bug report, that would have reverted many additional edits.[2]

[1]: https://pt.wikipedia.org/w/index.php?title=Lens_%28Pas-de-Calais%29&diff=22824326&oldid=21742940
[2]: https://pt.wikipedia.org/w/index.php?title=Lens_%28Pas-de-Calais%29&diff=26449837&oldid=20854041

Change 100211 had a related patch set uploaded by Anomie:
Detect already-undone edits for undo

https://gerrit.wikimedia.org/r/100211

Change 100211 merged by jenkins-bot:
Detect already-undone edits for undo

https://gerrit.wikimedia.org/r/100211

This should be deployed to WMF wikis with 1.23wmf13, see https://www.mediawiki.org/wiki/MediaWiki_1.23/Roadmap for the schedule.