jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/491946 )
Change subject: [IMPR] Offer possibility to skip to the next disambiguation ......................................................................
[IMPR] Offer possibility to skip to the next disambiguation
I took 'g' for this option because 'n', 'e', 'x', 't', 'd' are already used.
Bug: T216544 Change-Id: I5f3fbc1a2cb7830fe8857db79cce1058e856ca70 --- M scripts/solve_disambiguation.py 1 file changed, 12 insertions(+), 3 deletions(-)
Approvals: Dvorapa: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py index 8ac4435..77b483f 100755 --- a/scripts/solve_disambiguation.py +++ b/scripts/solve_disambiguation.py @@ -738,7 +738,9 @@ @type disambPage: pywikibot.Page @param refPage: a page linking to disambPage @type refPage: pywikibot.Page - @rtype: None + @return: Return whether continue with next page (True) + or next disambig (False) + @rtype: bool
""" nochange = True @@ -748,12 +750,15 @@ ): treat_result = self.treat_disamb_only(refPage, page) if treat_result == 'nextpage': - return + return True + if treat_result == 'nextdisambig': + return False if treat_result == 'done': nochange = False
if nochange: pywikibot.output('No changes necessary in ' + refPage.title()) + return True
def treat_disamb_only(self, refPage, disambPage): """Resolve the links to disambPage but don't look for its redirects. @@ -881,6 +886,7 @@ StandardOption('skip link', 's'), edit, StandardOption('next page', 'n'), + StandardOption('next disambig', 'g'), StandardOption('unlink', 'u')] if self.dn_template_str: # '?', '/' for old choice @@ -921,6 +927,8 @@ # occurrence next time. self.primaryIgnoreManager.ignore(refPage) return 'nextpage' + elif answer == 'g': + return 'nextdisambig'
# The link looks like this: # [[page_title|link_text]]trailing_chars @@ -1208,7 +1216,8 @@ preloadingGen = pagegenerators.PreloadingGenerator(gen) for refPage in preloadingGen: if not self.primaryIgnoreManager.isIgnored(refPage): - self.treat_links(refPage, page) + if not self.treat_links(refPage, page): + break # next disambig
# clear alternatives before working on next disambiguation page self.alternatives = []