bullseye: Rename misleading dry-run option
The previous `--dry-run` actually means that bullseye will abandon the
target branch in the end. "Dry run" suggests that it won't touch the
tree, so rename this option into `--cleanup-after`.
Change-Id: I5d24386e59bad40e6232200e4822ab51e75ca880
diff --git a/bullseye/bulletin.py b/bullseye/bulletin.py
index a9f3d13..632c1d8 100644
--- a/bullseye/bulletin.py
+++ b/bullseye/bulletin.py
@@ -90,7 +90,7 @@
if not self.is_applied():
print("[BE]: Not yet applied: {}".format(self.get_description()))
- if self.args.apply_to_branch is not None:
+ if self.args.apply_to_branch:
self.apply()
else:
print("[BE]: Already applied: {}".format(self.get_description()))
@@ -162,7 +162,7 @@
self.rollback()
else:
print("[BE]: SUCCESS: applied.".format(self.filename))
- if not self.args.skip_amend and not self.args.dry_run:
+ if not self.args.skip_amend and not self.args.cleanup_after:
self.amend()
def exec_command(self, command):
diff --git a/bullseye/bullseye.py b/bullseye/bullseye.py
index a8901ff..4230304 100755
--- a/bullseye/bullseye.py
+++ b/bullseye/bullseye.py
@@ -30,8 +30,10 @@
"--apply-to-branch",
type=str,
help="Branch to apply patches to, if this option is set patches will "
- "be applied to this branch. WARNING: This branch will abandoned if it "
- "exists already.",
+ "be applied to this branch. Not setting this effectively results in a "
+ "dry run. No changes will be made in the tree.\n"
+ "WARNING: The branch set here will be abandoned if it already exists "
+ "and --skip-abandon is not set.",
)
parser.add_argument(
"--use-a-number",
@@ -44,9 +46,10 @@
help="Display both the A-number and the patch path",
)
parser.add_argument(
- "--dry-run",
+ "--cleanup-after",
action="store_true",
- help="Do rollback after applying the patch",
+ help="Abandon the branch selected in --apply-to-branch after bullseye "
+ "is done. This implies --skip-amend.",
)
parser.add_argument(
"--skip-amend", action="store_true", help="Skip amend step"
@@ -54,7 +57,8 @@
parser.add_argument(
"--skip-abandon",
action="store_true",
- help="Skip abandoning the target repo branch",
+ help="Skip the default behavior of abandoning and recreating the "
+ "target repo branch before applying any patches.",
)
parser.add_argument(
"--skip-patches", action="store_true", help="Skip the bulletin patches"
@@ -67,7 +71,7 @@
parser.add_argument(
"--quiet",
action="store_true",
- help="Be a bit quieter. (Surpress git output)",
+ help="Be a bit quieter. (Suppress git output)",
)
parser.add_argument(
"--use-old-format",
@@ -100,6 +104,17 @@
if __name__ == "__main__":
parser = make_arg_parser()
args = parser.parse_args()
+ if not args.apply_to_branch:
+ print(
+ "INFO: This is a dry run, because --apply-to-branch is not "
+ "specified."
+ )
+ if args.cleanup_after:
+ print(
+ "WARNING: Argument --cleanup-after will be ignored, because"
+ "--apply-to-branch is not specified."
+ )
+
manifest = AndroidManifest(
os.path.join(args.aosp_root, ".repo", "manifest.xml")
)
@@ -109,6 +124,6 @@
bulletin = SecurityBulletin(args, manifest)
bulletin.apply()
- if args.dry_run:
- print("Was dry run ...rolling back.")
+ if args.cleanup_after and args.apply_to_branch:
+ print("Abandoning the target branch as requested.")
rollback()