Page MenuHomePhabricator

Unify name of parameters -pairs and -replacementfile in scripts
Closed, ResolvedPublic

Description

To my understanding the parameter -pairs in movepages.py is equal to -replacementfile in replace.py. It would be better to change -replacementfile to -pairs to prevent confusion and to shorten it.

Event Timeline

Wesalius raised the priority of this task from to Needs Triage.
Wesalius updated the task description. (Show Details)
Wesalius added a project: Pywikibot.
Wesalius subscribed.

A "pair" in replace.py is usually a replacement pair (see e.g. ERROR: Incomplete command line pattern replacement pair.)
So -pairs might not be the best name.
-pagepairs for both of them maybe?

-pagepairs or -replacementfile for both sounds good to me

replace's -replacementfile has a bit different file format, but there are enough similarities to justify using the same option name. -pairsfile ?

Just an idea: movepages -pairs could use -file , as its file has the same file format as the pagegenerators -file, and it even uses the same pagegenerators.TextfilePageGenerator. It uses the content of the file slightly differently, so it can't re-use the pagegenerator documentation (unless it was rewritten to be more generic, but that may mean it isnt helpful).

IMO the -replacementfile format is a poor substitute for user-fixes.py, as the -replacementfile file contents is interpreted differently depending on -regex and other command line options, and should probably be deprecated.

I'm going with -pairsfile, as suggested above.
Apart from the respective files in core, what else should I update to reflect this change?

Change 275025 had a related patch set uploaded (by Darthbhyrava):
Change: Unify name of parameters -pairs and -replacementfile in scripts

https://gerrit.wikimedia.org/r/275025

I've added a patch, and would be much obliged if someone could give me some feedback.
Thanks. :)

Change 275025 merged by jenkins-bot:
Change: Unify name of parameters -pairs and -replacementfile in scripts

https://gerrit.wikimedia.org/r/275025