jenkins-bot merged this change.
[cleanup] Desupport Page.getVersionHistory() method
getVersionHistory has multiple breaking changes against compat
and is deprecated for 5 years. Throw a FutureWarning and announce
their removal.
Also desupport Revision.hist_entry method and Revision.HistEntry
class attribute which are only used for getVersionHistory.
Bug: T136513
Change-Id: I0a13cc5abae61109fd272335104b4ef27b1c4293
---
M pywikibot/page/__init__.py
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index 3816a8a..88b05b8 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -1770,7 +1770,7 @@
# (revid, timestamp, user, comment, size, tags)
#
# timestamp is a pywikibot.Timestamp, not a MediaWiki timestamp string
- @deprecated('Page.revisions()', since='20150206')
+ @deprecated('Page.revisions()', since='20150206', future_warning=True)
@deprecated_args(forceReload=None, revCount='total', step=None,
getAll=None, reverseOrder='reverse')
def getVersionHistory(self, reverse=False, total=None):
@@ -1784,9 +1784,13 @@
@param total: iterate no more than this number of revisions in total
"""
- return [rev.hist_entry()
+ with suppress_warnings(
+ 'pywikibot.page.Revision.hist_entry is deprecated'):
+ revisions = [
+ rev.hist_entry()
for rev in self.revisions(reverse=reverse, total=total)
- ]
+ ]
+ return revisions
@deprecated_args(forceReload=None, reverseOrder='reverse', step=None)
def getVersionHistoryTable(self, reverse=False, total=None):
@@ -5799,10 +5803,10 @@
"""A structure holding information about a single revision of a Page."""
- HistEntry = namedtuple('HistEntry', ['revid',
- 'timestamp',
- 'user',
- 'comment'])
+ _HistEntry = namedtuple('HistEntry', ['revid',
+ 'timestamp',
+ 'user',
+ 'comment'])
_FullHistEntry = namedtuple('FullHistEntry', ['revid',
'timestamp',
@@ -5859,6 +5863,12 @@
@classproperty
@deprecated(since='20200329', future_warning=True)
+ def HistEntry(cls):
+ """Class property which returns deprecated class attribute."""
+ return cls._HistEntry
+
+ @classproperty
+ @deprecated(since='20200329', future_warning=True)
def FullHistEntry(cls):
"""Class property which returns deprecated FullHistEntry attribute."""
return cls._FullHistEntry
@@ -5941,10 +5951,14 @@
return self._sha1
+ @deprecated(since='20200329', future_warning=True)
def hist_entry(self):
"""Return a namedtuple with a Page history record."""
- return Revision.HistEntry(self.revid, self.timestamp, self.user,
- self.comment)
+ with suppress_warnings(
+ 'pywikibot.page.Revision.HistEntry is deprecated'):
+ entry = Revision.HistEntry(self.revid, self.timestamp, self.user,
+ self.comment)
+ return entry
@deprecated(since='20200329', future_warning=True)
def full_hist_entry(self):
To view, visit change 584194. To unsubscribe, or for help writing mail filters, visit settings.