Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions oca_port/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class App(Output):
flag to not wait for user input and to return a error code to the shell.
Returns 100 if an addon could be migrated, 110 if pull requests/commits
could be ported, 0 if the history of the addon is the same on both branches.
assume_yes:
Assume yes to prompts
output:
returns a parsable output. This implies the 'non-interactive' mode
defined above but without returning any special exit code.
Expand Down Expand Up @@ -73,6 +75,7 @@ class App(Output):
upstream_org: str = "OCA"
verbose: bool = False
non_interactive: bool = False
assume_yes: bool = False
dry_run: bool = False
output: str = None
fetch: bool = False
Expand Down
3 changes: 3 additions & 0 deletions oca_port/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
@click.option(
"--non-interactive", is_flag=True, help="Disable all interactive prompts."
)
@click.option("-y", "--yes", "assume_yes", is_flag=True, help="Assume yes to prompts.")
@click.option("--dry-run", is_flag=True, help="Print results, no nothing.")
@click.option(
"--output",
Expand Down Expand Up @@ -128,6 +129,7 @@ def main(
upstream_org: str,
verbose: bool,
non_interactive: bool,
assume_yes: bool,
output: str,
fetch: bool,
no_cache: bool,
Expand Down Expand Up @@ -163,6 +165,7 @@ def main(
upstream_org=upstream_org,
verbose=verbose,
non_interactive=non_interactive,
assume_yes=assume_yes,
output=output,
fetch=fetch,
no_cache=no_cache,
Expand Down
6 changes: 3 additions & 3 deletions oca_port/migrate_addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def run(self):
return False, None
# At this stage, the addon could be migrated
self._detect_existing_pr()
if self.app.non_interactive or self.app.dry_run:
if (self.app.non_interactive and not self.app.assume_yes) or self.app.dry_run:
msg = (
f"ℹ️ {bc.BOLD}{self.app.source.addon}{bc.END} can be migrated "
f"from {bc.BOLD}{self.app.source_version}{bc.END} "
Expand Down Expand Up @@ -137,7 +137,7 @@ def run(self):
confirm += f" and move it to {bc.BOLD}{self.app.target.addon_path}{bc.END}?"
else:
confirm += "?"
if not click.confirm(confirm):
if not (self.app.assume_yes or click.confirm(confirm)):
self.app.storage.blacklist_addon(confirm=True)
if not self.app.storage.dirty:
return False, None
Expand Down Expand Up @@ -262,7 +262,7 @@ def _create_mig_branch(self):
f"Branch {bc.BOLD}{self.mig_branch.name}{bc.END} already exists, "
"recreate it?\n(⚠️ you will lose the existing branch)"
)
if click.confirm(confirm):
if self.app.assume_yes or click.confirm(confirm):
self.app.repo.delete_head(self.mig_branch.name, "-f")
else:
create_branch = False
Expand Down