Skip to content
Snippets Groups Projects
Commit db4d1051 authored by Tim Jaacks's avatar Tim Jaacks
Browse files

Refactoring: rename arguments for consistency

parent 59ce0ad8
No related branches found
No related tags found
No related merge requests found
...@@ -42,7 +42,7 @@ integrate: ...@@ -42,7 +42,7 @@ integrate:
--token=${GITBOT_TOKEN} --token=${GITBOT_TOKEN}
--manifest-project=${TARGET_PROJECT} --manifest-project=${TARGET_PROJECT}
--manifest-file=${MANIFEST_FILE} --manifest-file=${MANIFEST_FILE}
--integration-base=${TARGET_BRANCH} --manifest-branch=${TARGET_BRANCH}
--project=${CI_PROJECT_PATH} --project=${CI_PROJECT_PATH}
--merge-request=${MERGE_REQUEST} --merge-request=${MERGE_REQUEST}
--save-revision-to=manifest_revision --save-revision-to=manifest_revision
...@@ -68,9 +68,9 @@ merge: ...@@ -68,9 +68,9 @@ merge:
--gitlab-url=${CI_SERVER_URL} --gitlab-url=${CI_SERVER_URL}
--token=${GITBOT_TOKEN} --token=${GITBOT_TOKEN}
--manifest-project=${TARGET_PROJECT} --manifest-project=${TARGET_PROJECT}
--master-branch=${TARGET_BRANCH} --manifest-branch=${TARGET_BRANCH}
--project=${CI_PROJECT_PATH} --project=${CI_PROJECT_PATH}
--master-branch-project=${SOURCE_BRANCH} --project-branch=${SOURCE_BRANCH}
--commit=${CI_COMMIT_SHA} --commit=${CI_COMMIT_SHA}
--save-revision-to=manifest_revision --save-revision-to=manifest_revision
--recipe-name=${BB_RECIPE_NAME} --recipe-name=${BB_RECIPE_NAME}
......
...@@ -72,7 +72,7 @@ def update_srcrev(srcrev, recipe_name, new_revision): ...@@ -72,7 +72,7 @@ def update_srcrev(srcrev, recipe_name, new_revision):
def integrate_into_manifest( def integrate_into_manifest(
manifest_project: Project, manifest_project: Project,
integration_base, manifest_branch,
manifest_file, manifest_file,
srcrev_file, srcrev_file,
recipe_name, recipe_name,
...@@ -95,12 +95,12 @@ def integrate_into_manifest( ...@@ -95,12 +95,12 @@ def integrate_into_manifest(
print("Cloning manifest repo: %s" % manifest_project.http_url_to_repo) print("Cloning manifest repo: %s" % manifest_project.http_url_to_repo)
try: try:
manifest_repo = Repo.clone_from( manifest_repo = Repo.clone_from(
clone_url.url, manifest_dir, branch=integration_base clone_url.url, manifest_dir, branch=manifest_branch
) )
except GitCommandError as e: except GitCommandError as e:
sys.exit("ERROR: could not clone manifest repository\n" + str(e)) sys.exit("ERROR: could not clone manifest repository\n" + str(e))
except IndexError: except IndexError:
sys.exit("ERROR: branch '%s' not found" % integration_base) sys.exit("ERROR: branch '%s' not found" % manifest_branch)
# Special handling for the gitlab-ci integration # Special handling for the gitlab-ci integration
# When the branch 'merge_request.source_branch' already starts with # When the branch 'merge_request.source_branch' already starts with
...@@ -121,7 +121,7 @@ def integrate_into_manifest( ...@@ -121,7 +121,7 @@ def integrate_into_manifest(
else: else:
# Create integration branch (delete former one if already exists) # Create integration branch (delete former one if already exists)
integration_branch = common.integration_branch_name( integration_branch = common.integration_branch_name(
project.name, merge_request.source_branch, integration_base project.name, merge_request.source_branch, manifest_branch
) )
for ref in manifest_repo.references: for ref in manifest_repo.references:
if integration_branch == ref.name: if integration_branch == ref.name:
...@@ -210,9 +210,9 @@ def main(): ...@@ -210,9 +210,9 @@ def main():
required=True, required=True,
) )
parser.add_argument( parser.add_argument(
"--integration-base", "--manifest-branch",
help="""manifest branch to branch off from""", help="""manifest branch to branch off from""",
dest="integration_base", dest="manifest_branch",
required=True, required=True,
) )
parser.add_argument( parser.add_argument(
...@@ -280,7 +280,7 @@ def main(): ...@@ -280,7 +280,7 @@ def main():
manifest_revision = integrate_into_manifest( manifest_revision = integrate_into_manifest(
manifest_project=manifest_project, manifest_project=manifest_project,
integration_base=args.integration_base, manifest_branch=args.manifest_branch,
manifest_file=args.manifest_file, manifest_file=args.manifest_file,
srcrev_file=args.srcrev_file, srcrev_file=args.srcrev_file,
recipe_name=args.recipe_name, recipe_name=args.recipe_name,
......
...@@ -14,9 +14,9 @@ from integrate_into_manifest import integrate_into_manifest ...@@ -14,9 +14,9 @@ from integrate_into_manifest import integrate_into_manifest
def merge_into_manifest( def merge_into_manifest(
manifest_project, manifest_project,
master_branch, manifest_branch,
project, project,
master_branch_project, project_branch,
srcrev_file, srcrev_file,
recipe_name, recipe_name,
commit, commit,
...@@ -30,7 +30,7 @@ def merge_into_manifest( ...@@ -30,7 +30,7 @@ def merge_into_manifest(
# Get source merge request # Get source merge request
mrs = get_merge_requests( mrs = get_merge_requests(
project, project,
target_branch=master_branch_project, target_branch=project_branch,
state="merged", state="merged",
commit=commit, commit=commit,
) )
...@@ -52,7 +52,7 @@ def merge_into_manifest( ...@@ -52,7 +52,7 @@ def merge_into_manifest(
) )
return "" return ""
target_branch = master_branch target_branch = manifest_branch
integration_branch = common.integration_branch_name( integration_branch = common.integration_branch_name(
project.name, original_branch, target_branch project.name, original_branch, target_branch
...@@ -95,7 +95,7 @@ def merge_into_manifest( ...@@ -95,7 +95,7 @@ def merge_into_manifest(
# we want a completely automated process in every case. # we want a completely automated process in every case.
manifest_revision = integrate_into_manifest( manifest_revision = integrate_into_manifest(
manifest_project=manifest_project, manifest_project=manifest_project,
integration_base=target_branch, manifest_branch=target_branch,
manifest_file=common.manifest_file, manifest_file=common.manifest_file,
srcrev_file=srcrev_file, srcrev_file=srcrev_file,
recipe_name=recipe_name, recipe_name=recipe_name,
...@@ -139,9 +139,9 @@ def main(): ...@@ -139,9 +139,9 @@ def main():
required=True, required=True,
) )
parser.add_argument( parser.add_argument(
"--master-branch", "--manifest-branch",
help="""master branch to merge changes into""", help="""manifest branch to merge changes into""",
dest="master_branch", dest="manifest_branch",
required=True, required=True,
) )
parser.add_argument( parser.add_argument(
...@@ -151,9 +151,9 @@ def main(): ...@@ -151,9 +151,9 @@ def main():
required=True, required=True,
) )
parser.add_argument( parser.add_argument(
"--master-branch-project", "--project-branch",
help="""master branch to merge changes into (project)""", help="""project branch to merge changes into""",
dest="master_branch_project", dest="project_branch",
default=None, default=None,
required=False, required=False,
) )
...@@ -198,16 +198,15 @@ def main(): ...@@ -198,16 +198,15 @@ def main():
project = common.get_project(gitlab, args.project) project = common.get_project(gitlab, args.project)
manifest_project = common.get_project(gitlab, args.manifest_project) manifest_project = common.get_project(gitlab, args.manifest_project)
# If no master_branch_project is set assume manifest and project # If no project_branch is set, assume manifest and project branches are the same
# master branches are named the same if not args.project_branch:
if not args.master_branch_project: args.project_branch = args.manifest_branch
args.master_branch_project = args.master_branch
manifest_revision = merge_into_manifest( manifest_revision = merge_into_manifest(
manifest_project=manifest_project, manifest_project=manifest_project,
master_branch=args.master_branch, manifest_branch=args.manifest_branch,
project=project, project=project,
master_branch_project=args.master_branch_project, project_branch=args.project_branch,
srcrev_file=args.srcrev_file, srcrev_file=args.srcrev_file,
recipe_name=args.recipe_name, recipe_name=args.recipe_name,
commit=args.commit, commit=args.commit,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment