erplibre/script/git_repo_manifest.py
Mathieu Benoit 8a11ab88c7 Script integrate manifest git-repo
- Add sync repo with manifest xml
- sync repo print to show missing or added repo
- Release 1.0.0 manifest for prod
- Support generation manifest from script
- Separate prod/dev installation locally script
- Generate repo and keep old manifest configuration when update
- Move manifest in directory ./manifest/
- Many general fixes
2020-07-05 22:55:13 -04:00

61 lines
1.9 KiB
Python

#!/usr/bin/env python
import os
import sys
import argparse
import logging
new_path = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(new_path)
from script.git_tool import GitTool
_logger = logging.getLogger(__name__)
def get_config():
"""Parse command line arguments, extracting the config file name,
returning the union of config file and command line arguments
:return: dict of config file settings and command line arguments
"""
# TODO update description
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
description='''\
''',
epilog='''\
'''
)
parser.add_argument('-d', '--dir', dest="dir", default="./",
help="Path of repo to change remote, including submodule.")
parser.add_argument('--clear', action="store_true",
help="Create a new manifest and clear old configuration.")
args = parser.parse_args()
return args
def main():
config = get_config()
git_tool = GitTool()
lst_repo = git_tool.get_source_repo_addons(repo_path=config.dir, add_repo_root=True)
lst_repo_organization = [git_tool.get_transformed_repo_info_from_url(
a.get("url"), repo_path=config.dir, get_obj=True,
is_submodule=a.get("is_submodule"), sub_path=a.get("sub_path"),
revision=a.get("revision"), clone_depth=a.get("clone_depth"))
for a in lst_repo]
# Update origin to new repo
if not config.clear:
dct_remote, dct_project = git_tool.get_manifest_xml_info(repo_path=config.dir,
add_root=True)
else:
dct_remote = {}
dct_project = {}
git_tool.generate_repo_manifest(lst_repo_organization, repo_path=config.dir,
dct_remote=dct_remote, dct_project=dct_project)
git_tool.generate_install_locally()
if __name__ == '__main__':
main()