jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1235474?usp=email )

Change subject: addwikis: Show the difference instead of the new list
......................................................................

addwikis: Show the difference instead of the new list

Change-Id: Ia2ee05ae2ad0bb4cf3c2f15a6b71dbb4367df6cd
---
M scripts/maintenance/addwikis.py
1 file changed, 8 insertions(+), 7 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/scripts/maintenance/addwikis.py b/scripts/maintenance/addwikis.py
index 501b8f7..86fa4a0 100755
--- a/scripts/maintenance/addwikis.py
+++ b/scripts/maintenance/addwikis.py
@@ -20,7 +20,8 @@
 .. deprecated:: 10.4
    The ``help`` option
 .. versionchanged:: 11.0
-   Multiple families can be given with one run.
+   Multiple families can be given with one run. The difference is shown
+   instead of the new list.
 """
 #
 # (C) Pywikibot team, 2024-2025
@@ -73,7 +74,7 @@

     # combine new codes set
     new = sorted(original | new_codes)
-    pywikibot.info("The lists don't match, the new list is:\n")
+    pywikibot.info("The lists don't match, the updated list is:\n")
     text = '    codes = {\n'
     line = ' ' * 7
     for code in new:
@@ -83,14 +84,14 @@
         line += f" '{code}',"
     text += line + '\n'
     text += '    }'
-    pywikibot.info(text)

     # update codes
     filepath = Path(f'pywikibot/families/{family}_family.py')
-    family_text = filepath.read_text(encoding='utf8')
-    family_text = re.sub(r'(?ms)^ {4}codes = \{.+?\}',
-                         text, family_text, count=1)
-    filepath.write_text(family_text, encoding='utf8')
+    old_family_text = filepath.read_text(encoding='utf8')
+    new_family_text = re.sub(r'(?ms)^ {4}codes = \{.+?\}',
+                             text, old_family_text, count=1)
+    pywikibot.showDiff(old_family_text, new_family_text)
+    filepath.write_text(new_family_text, encoding='utf8')


 def main(*args: str) -> None:

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1235474?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ia2ee05ae2ad0bb4cf3c2f15a6b71dbb4367df6cd
Gerrit-Change-Number: 1235474
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to