jenkins-bot has submitted this change and it was merged.
Change subject: Use Page.revisions() instead of getVersionHistory() method ......................................................................
Use Page.revisions() instead of getVersionHistory() method
Change-Id: I85edfc11304c9c7fcb983e87d7cc71bd5b7d89ac --- M scripts/category_redirect.py M scripts/newitem.py M tests/page_tests.py M tests/site_tests.py 4 files changed, 8 insertions(+), 9 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/category_redirect.py b/scripts/category_redirect.py index e819332..af0aca3 100755 --- a/scripts/category_redirect.py +++ b/scripts/category_redirect.py @@ -198,12 +198,12 @@ sorted(log_items.items(), reverse=True)[:LOG_SIZE - 1]] log_text = "\n".join("\n".join(line for line in text) for text in keep) # get permalink to older logs - history = self.log_page.getVersionHistory(total=LOG_SIZE) + history = list(self.log_page.revisions(total=LOG_SIZE)) # get the id of the newest log being archived - rotate_revid = history[LOG_SIZE - 1][0] + rotate_revid = history[-1].revid # append permalink - log_text = log_text + ("\n\n'''[%s Older logs]'''" - % self.log_page.permalink(oldid=rotate_revid)) + log_text += ("\n\n'''[%s Older logs]'''" + % self.log_page.permalink(oldid=rotate_revid)) return log_text
def check_hard_redirect(self): diff --git a/scripts/newitem.py b/scripts/newitem.py index acba3da..f6bc7df 100644 --- a/scripts/newitem.py +++ b/scripts/newitem.py @@ -78,8 +78,7 @@ % (page, page.editTime().isoformat())) return
- rev = page.getVersionHistory(reverseOrder=True, total=1)[0] - if rev.timestamp > self.pageAgeBefore: + if page.oldest_revision.timestamp > self.pageAgeBefore: pywikibot.output( u'Page creation of %s on %s is too recent. Skipping.' % (page, page.editTime().isoformat())) diff --git a/tests/page_tests.py b/tests/page_tests.py index f95bd6d..087ce73 100644 --- a/tests/page_tests.py +++ b/tests/page_tests.py @@ -626,7 +626,7 @@ p.markDeletedRevision(del_revs[-2]) self.assertRaises(ValueError, p.markDeletedRevision, 123) p.undelete(reason='pywikibot unit test') - revs = list(p.getVersionHistory()) + revs = list(p.revisions()) self.assertEqual(len(revs), 2) self.assertEqual(revs[1].revid, revid)
diff --git a/tests/site_tests.py b/tests/site_tests.py index d8daebf..2b3aa90 100644 --- a/tests/site_tests.py +++ b/tests/site_tests.py @@ -1258,14 +1258,14 @@ revisions=[u'2014-12-21T06:07:47Z', u'2014-12-21T06:07:31Z'])
- revs = list(p.getVersionHistory()) + revs = list(p.revisions()) self.assertEqual(len(revs), 2) self.assertEqual(revs[0].revid, 219995) self.assertEqual(revs[1].revid, 219994)
site.deletepage(p, reason='pywikibot unit tests') site.undelete_page(p, 'pywikibot unit tests') - revs = list(p.getVersionHistory()) + revs = list(p.revisions()) self.assertTrue(len(revs) > 2)
pywikibot-commits@lists.wikimedia.org