jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[cleanup] cleanup Site.merge_history()

merge_history was added 1.27:
https://www.mediawiki.org/wiki/API:Mergehistory

- remove need_version decorator
- update documentation
- also update documentation of BasePage.merge_history

Bug: T306637
Change-Id: I67d68210a58ab8fd4dcace9d2bdb13a187c8d453
---
M pywikibot/page/_page.py
M pywikibot/site/_apisite.py
2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/pywikibot/page/_page.py b/pywikibot/page/_page.py
index ded889b..bd2283a 100644
--- a/pywikibot/page/_page.py
+++ b/pywikibot/page/_page.py
@@ -1782,20 +1782,20 @@
if isinstance(user, pywikibot.User) else cnt[user]
for user in contributors)

- def merge_history(self, dest, timestamp=None, reason=None) -> None:
- """
- Merge revisions from this page into another page.
+ def merge_history(self,
+ dest: 'BasePage',
+ timestamp: Optional[pywikibot.Timestamp] = None,
+ reason: Optional[str] = None) -> None:
+ """Merge revisions from this page into another page.

- See :py:obj:`APISite.merge_history` for details.
+ .. seealso:: :meth:`APISite.merge_history()
+ <pywikibot.site._apisite.APISite.merge_history>` for details.

:param dest: Destination page to which revisions will be merged
- :type dest: pywikibot.Page
:param timestamp: Revisions from this page dating up to this timestamp
will be merged into the destination page (if not given or False,
all revisions will be merged)
- :type timestamp: pywikibot.Timestamp
:param reason: Optional reason for the history merge
- :type reason: str
"""
self.site.merge_history(self, dest, timestamp, reason)

@@ -1809,7 +1809,7 @@
Move this page to a new title.

.. versionchanged:: 7.2
- The `movesubpages` parameter was added
+ The *movesubpages* parameter was added

:param newtitle: The new page title.
:param reason: The edit summary for the move.
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index f45b6c0..98639da 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -55,7 +55,7 @@
)
from pywikibot.login import LoginStatus as _LoginStatus
from pywikibot.site._basesite import BaseSite
-from pywikibot.site._decorators import need_right, need_version
+from pywikibot.site._decorators import need_right
from pywikibot.site._extensions import (
EchoMixin,
FlowMixin,
@@ -2056,7 +2056,6 @@
}

@need_right('mergehistory')
- @need_version('1.27.0-wmf.13')
def merge_history(
self,
source: 'pywikibot.page.BasePage',
@@ -2066,7 +2065,10 @@
) -> None:
"""Merge revisions from one page into another.

- .. seealso:: :api:`Mergehistory`
+ .. seealso::
+
+ - :api:`Mergehistory`
+ - :meth:`page.BasePage.merge_history` (should be preferred)

Revisions dating up to the given timestamp in the source will be
moved into the destination page history. History merge fails if
@@ -2079,6 +2081,10 @@
will be merged into the destination page (if not given or False,
all revisions will be merged)
:param reason: Optional reason for the history merge
+ :raises APIError: unexpected APIError
+ :raises Error: expected APIError or unexpected response
+ :raises NoPageError: *source* or *dest* does not exist
+ :raises PageSaveRelatedError: *source* is equal to *dest*
"""
# Data for error messages
errdata = {

To view, visit change 845862. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I67d68210a58ab8fd4dcace9d2bdb13a187c8d453
Gerrit-Change-Number: 845862
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged