jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/510277 )
Change subject: [IMPR] Fix getFileVersionHistory deprecation warnings in scripts ......................................................................
[IMPR] Fix getFileVersionHistory deprecation warnings in scripts
- FilePage.getFileVersionHistory is deprecated and should be avoided in scripts as well
Change-Id: Ia8a7d66eaab4d17abd8dc816dbe115d11af61f3f --- M pywikibot/page.py M scripts/imagecopy.py M scripts/imagecopy_self.py M scripts/nowcommons.py M scripts/unusedfiles.py 5 files changed, 7 insertions(+), 7 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py index c39a3e6..79c9771 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -2626,7 +2626,7 @@ def getFileVersionHistoryTable(self): """Return the version history in the form of a wiki table.""" lines = [] - for info in self.getFileVersionHistory(): + for info in self.get_file_history(): dimension = '{width}×{height} px ({size} bytes)'.format(**info) lines.append('| {timestamp} || {user} || {dimension} |' '| <nowiki>{comment}</nowiki>' diff --git a/scripts/imagecopy.py b/scripts/imagecopy.py index 00a54c7..dad8dee 100644 --- a/scripts/imagecopy.py +++ b/scripts/imagecopy.py @@ -538,7 +538,7 @@ except NotImplementedError: # No API, using the page file instead (datetime, username, resolution, size, - comment) = imagepage.getFileVersionHistory().pop() + comment) = imagepage.get_file_history().pop() if always: newname = imagepage.title(with_ns=False) CommonsPage = pywikibot.Page(pywikibot.Site('commons', diff --git a/scripts/imagecopy_self.py b/scripts/imagecopy_self.py index f132d04..0d788e7 100644 --- a/scripts/imagecopy_self.py +++ b/scripts/imagecopy_self.py @@ -536,7 +536,7 @@ information template. If we really have nothing better.
""" - uploadtime = imagepage.getFileVersionHistory()[-1][0] + uploadtime = imagepage.get_file_history()[-1][0] uploadDatetime = datetime.strptime(uploadtime, '%Y-%m-%dT%H:%M:%SZ') return ('{{Date|%s|%s|%s}} (original upload date)' % (str(uploadDatetime.year), @@ -569,7 +569,7 @@
def getAuthor(self, imagepage): """Get the first uploader.""" - return imagepage.getFileVersionHistory()[-1][1].strip() + return imagepage.get_file_history()[-1][1].strip()
def convertLinks(self, text, sourceSite): """Convert links from the current wiki to Commons.""" @@ -947,7 +947,7 @@ @param imagepage: The file page to retrieve the log. @type imagepage: pywikibot.FilePage """ - filehistory = imagepage.getFileVersionHistory() + filehistory = imagepage.get_file_history() filehistory.reverse()
site = imagepage.site() diff --git a/scripts/nowcommons.py b/scripts/nowcommons.py index ca899aa..1c7d9f6 100755 --- a/scripts/nowcommons.py +++ b/scripts/nowcommons.py @@ -329,7 +329,7 @@ if sha1 == commonsImagePage.latest_file_info.sha1: pywikibot.output( 'The image is identical to the one on Commons.') - if len(localImagePage.getFileVersionHistory()) > 1: + if len(localImagePage.get_file_history()) > 1: pywikibot.output( 'This image has a version history. Please ' 'delete it manually after making sure that ' diff --git a/scripts/unusedfiles.py b/scripts/unusedfiles.py index 9c010e4..2801f5b 100755 --- a/scripts/unusedfiles.py +++ b/scripts/unusedfiles.py @@ -78,7 +78,7 @@ self.append_text(image, '\n\n' + self.template_image) if self.getOption('nouserwarning'): return - uploader = image.getFileVersionHistory().pop(0)['user'] + uploader = image.get_file_history().pop(0)['user'] user = pywikibot.User(image.site, uploader) usertalkpage = user.getUserTalkPage() msg2uploader = self.template_user % {'title': image.title()}
pywikibot-commits@lists.wikimedia.org