New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ADD] Massive changer #442
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi. First thanks for this usefull tools !
Just a question, I don't see push command at the end to push on github. This tool just makes commits, or also push on distant repo ?
Kind regards.
This is using GitHub API. There's no concept of "pushing". The similar operation is: https://github.com/OCA/maintainer-tools/pull/442/files#diff-ff7702c786dba119e1cda5eaa8acd52cR152 |
I'd suggest name OCA sed tool or something like that. |
@pedrobaeza : thanks for the precision. |
@yelizariev I think you can already do this with this tool, as you can include newlines with
I'm searching for that part but at the end of the line. Nothing prevents you to put as destination string several lines with that character at the end of each, and looking for the preceding line including it as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some small comments.
Otherwise, seems very good, specially for solving something like OCA/oca-addons-repo-template#33
This script helps to make a massive change across a whole organization on contents of a file. Installation ============ For using this utility, you need to install these dependencies: * github3.py library for handling Github calls. To install it, use: ``sudo pip install github3.py``. Configuration ============= You must have a file called oca.cfg on the same folder of the script for storing credentials parameters. You can generate an skeleton config running this script for a first time. Usage ===== oca-massive-change [-h] [-p PROJECTS [PROJECTS ...]] [-e EMAIL] [-t TARGET_ORG] [-m COMMIT_MESSAGE] target path source_string target_string Performs a massive change over a whole organization. positional arguments: target Target branch path File path source_string Source string (or regexp) target_string Target string (or regexp) optional arguments: -h, --help show this help message and exit -p PROJECTS [PROJECTS ...], --projects PROJECTS [PROJECTS ...] List of specific projects to migrate -e EMAIL, --email EMAIL Provides an email address used to commit on GitHub if the one associated to the GitHub account is not public -t TARGET_ORG, --target-org TARGET_ORG By default, the GitHub organization used is OCA. This arg lets you provide an alternative organization -m COMMIT_MESSAGE, --message COMMIT_MESSAGE By default, '[UPD] Massive change [skip ci]', but can be provided with an alternative one This script will perform the following operations for each project: * Look for the selected file in the target branch. * If found, modify it searching for the source string and replacing it by the target string. * Commit the changes with optional commit message.
146376a
to
d7ee640
Compare
This script helps to make a massive change across a whole organization on contents of a file.
Installation
For using this utility, you need to install these dependencies:
sudo pip install github3.py
.Configuration
You must have a file called oca.cfg on the same folder of the script for storing credentials parameters. You can generate an skeleton config running this script for a first time.
Usage
oca-massive-change [-h] [-p PROJECTS [PROJECTS ...]] [-e EMAIL]
[-t TARGET_ORG] [-m COMMIT_MESSAGE]
target path source_string target_string
Performs a massive change over a whole organization.
positional arguments:
target Target branch
path File path
source_string Source string (or regexp)
target_string Target string (or regexp)
optional arguments:
-h, --help show this help message and exit
-p PROJECTS [PROJECTS ...], --projects PROJECTS [PROJECTS ...]
List of specific projects to migrate
-e EMAIL, --email EMAIL
Provides an email address used to commit on GitHub if
the one associated to the GitHub account is not public
-t TARGET_ORG, --target-org TARGET_ORG
By default, the GitHub organization used is OCA. This
arg lets you provide an alternative organization
-m COMMIT_MESSAGE, --message COMMIT_MESSAGE
By default, '[UPD] Massive change [skip ci]', but can
be provided with an alternative one
This script will perform the following operations for each project:
cc @Tecnativa