Skip to content

Commit

Permalink
Merge "wikisourcetext.py: remove misleading -force and -showdiff"
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Mar 5, 2017
2 parents 9143efd + e9f4203 commit 15ad6fe
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions scripts/wikisourcetext.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,14 @@
A -> just page A
-B -> pages 1 until B
-showdiff show difference before old and new text before saving.
-summary: custom edit summary.
Use quotes if edit summary contains spaces.
-force overwrites existing text
optional, default False
-always don't bother asking to confirm any of the changes.
"""
#
# (C) Pywikibot team, 2016
# (C) Pywikibot team, 2016-2017
#
# Distributed under the terms of the MIT license.
#
Expand All @@ -50,6 +45,7 @@

from pywikibot.bot import SingleSiteBot
from pywikibot.proofreadpage import IndexPage
from pywikibot.tools import issue_deprecation_warning


class UploadTextBot(SingleSiteBot):
Expand All @@ -58,7 +54,7 @@ class UploadTextBot(SingleSiteBot):
A bot that uploads text-layer to Page:namespace.
Text is fetched via preload as on Wikisource wikis, text can be preloaded
even if a page does not exist, if an Index page is present.
only if a page does not exist, if an Index page is present.
Works only on sites with Proofread Page extension installed.
"""
Expand All @@ -71,9 +67,7 @@ def __init__(self, generator, **kwargs):
@type generator: generator
"""
self.availableOptions.update({
'force': False,
'showdiff': False,
'summary': 'Uploading text'
'summary': 'Bot: uploading text'
})
super(UploadTextBot, self).__init__(**kwargs)
self.generator = generator
Expand All @@ -90,7 +84,7 @@ def treat(self, page):
new_text = page.text

summary = self.getOption('summary')
if page.exists() and not self.getOption('force'):
if page.exists():
pywikibot.output('Page %s already exists, not adding!' % page)
else:
self.userPut(page, old_text, new_text,
Expand Down Expand Up @@ -120,11 +114,11 @@ def main(*args):
elif arg == '-pages':
pages = value
elif arg == '-showdiff':
options['showdiff'] = True
issue_deprecation_warning('The usage of -showdiff option', None, 0)
elif arg == '-summary':
options['summary'] = value
elif arg == '-force':
options['force'] = True
issue_deprecation_warning('The usage of -force option', None, 0)
elif arg == '-always':
options['always'] = True
else:
Expand Down

0 comments on commit 15ad6fe

Please sign in to comment.