Skip to content

Commit 12753e3

Browse files
committed
Add --dry-run option
Again this is useful for scripting. We can now test the whole chain with: git publish -v --base origin/master --skip-final-edit --no-inspect-emails --dry-run before finally hitting the big red button. Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
1 parent a8a0a81 commit 12753e3

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

git-publish

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,9 @@ def parse_args():
652652
parser.add_argument('--skip-final-edit', dest='skip_final_edit',
653653
action='store_true', default=False,
654654
help='Skip final edit step (useful for scripting)')
655+
parser.add_argument('--dry-run', dest='dry_run',
656+
action='store_true', default=False,
657+
help='Do everything except tagging and sending the emails')
655658

656659
return parser.parse_known_args()
657660

@@ -822,7 +825,7 @@ branch.%s.pushRemote is set appropriately? (Override with --no-check-url)''' %
822825
cl_info += git_cover_letter_info(base, topic, to, cc, options.in_reply_to, number)
823826

824827
# Tag the tree
825-
if options.pull_request:
828+
if options.pull_request and not options.dry_run:
826829
tag_message = get_latest_tag_message(topic, ['Pull request'])
827830
tag_message += cl_info
828831
tag(tag_name_pull_request(topic), tag_message, annotate=message, force=True, sign=sign_pull, keyid=keyid)
@@ -953,10 +956,12 @@ branch.%s.pushRemote is set appropriately? (Override with --no-check-url)''' %
953956
if (options.separate_send):
954957
for patch in selected_patches:
955958
git_send_email(to, cc, [patch], suppress_cc, options.in_reply_to, options.thread,
956-
send_email_args=options.send_email_args)
959+
send_email_args=options.send_email_args,
960+
dry_run=options.dry_run)
957961
else:
958962
git_send_email(to, cc, selected_patches, suppress_cc, options.in_reply_to, options.thread,
959-
send_email_args=options.send_email_args)
963+
send_email_args=options.send_email_args,
964+
dry_run=options.dry_run)
960965
except (GitSendEmailError, GitHookError, InspectEmailsError):
961966
return 1
962967
except GitError as e:
@@ -968,7 +973,7 @@ branch.%s.pushRemote is set appropriately? (Override with --no-check-url)''' %
968973

969974
git_save_email_lists(topic, to, cc, options.override_cc)
970975

971-
if not options.pull_request:
976+
if not options.pull_request and not options.dry_run:
972977
# Publishing is done, stablize the tag now
973978
_git_check('tag', '-f', tag_name(topic, number), tag_name_staging(topic))
974979
git_delete_tag(tag_name_staging(topic))

0 commit comments

Comments
 (0)