Page MenuHomePhabricator

Add support for revision delete
Closed, ResolvedPublicFeature

Description

Even thought revision deletion has been available through API for a long time (see API:Revisiondelete which has been available since MW 1.23, circa 2014) it is still not supported in pywikibot. Support should be added for it.

Event Timeline

Xqt triaged this task as Medium priority.Mar 7 2021, 10:24 PM
Xqt changed the subtype of this task from "Task" to "Feature Request".

Note to self: on fawiki, deleterevision is not among the rights held by sysop bots and needs to be added.

Change 671399 had a related patch set uploaded (by Huji; owner: Huji):
[pywikibot/core@master] Add support for revision delete

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

@Xqt I ran into a problem with unit testing this for files. For page revisions, it is straightforward and the unit test I added already does the job. But for files, action=query&prop=revisions does not reflect changes to the file history. For instance when I revdel'ed the user for the oldest version of https://test.wikipedia.org/wiki/File:T276726.png and checked https://test.wikipedia.org/wiki/Special:ApiSandbox#action=query&format=json&prop=revisions&titles=File%3AT276726.png&rvlimit=15 it return info on the page revisions not the file revisions:

{
    "batchcomplete": "",
    "query": {
        "pages": {
            "119241": {
                "pageid": 119241,
                "ns": 6,
                "title": "File:T276726.png",
                "revisions": [
                    {
                        "revid": 469155,
                        "parentid": 469154,
                        "user": "Huji",
                        "timestamp": "2021-03-14T18:44:32Z",
                        "comment": "Huji uploaded a new version of [[File:T276726.png]]"
                    },
                    {
                        "revid": 469154,
                        "parentid": 469153,
                        "user": "Huji",
                        "timestamp": "2021-03-14T18:44:18Z",
                        "comment": "Huji uploaded a new version of [[File:T276726.png]]"
                    },
                    {
                        "revid": 469153,
                        "parentid": 0,
                        "user": "Huji",
                        "timestamp": "2021-03-14T18:43:57Z",
                        "comment": "For [[phab:T276726]]"
                    }
                ]
            }
        }
    }
}

Trying action=query&prop=deletedrevisions was not helpful either (again, that is about revisions that are completed deleted from the history using the old-fashioned "delete" feature, not the revisiondelete feature. As hard as I looked, I could not find an API query property that would show the file history. Do you know of one?

Change 671399 merged by jenkins-bot:
[pywikibot/core@master] Add support for revision delete

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