Skip to content

Commit a6c237e

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 5e74365 commit a6c237e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

git-publish

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,9 @@ def parse_args():
640640
parser.add_argument('--skip-final-edit', dest='skip_final_edit',
641641
action='store_true', default=False,
642642
help='Skip final edit step (useful for scripting)')
643+
parser.add_argument('--dry-run', dest='dry_run',
644+
action='store_true', default=False,
645+
help='Non-interactive dry run (suitable for scripting)')
643646

644647
return parser.parse_known_args()
645648

@@ -936,9 +939,13 @@ branch.%s.pushRemote is set appropriately? (Override with --no-check-url)''' %
936939

937940
if (options.separate_send):
938941
for patch in selected_patches:
939-
git_send_email(to, cc, [patch], suppress_cc, options.in_reply_to, options.thread)
942+
git_send_email(to, cc, [patch], suppress_cc,
943+
options.in_reply_to,
944+
options.thread, dry_run=options.dry_run)
940945
else:
941-
git_send_email(to, cc, selected_patches, suppress_cc, options.in_reply_to, options.thread)
946+
git_send_email(to, cc, selected_patches, suppress_cc,
947+
options.in_reply_to, options.thread,
948+
dry_run=options.dry_run)
942949
except (GitSendEmailError, GitHookError, InspectEmailsError):
943950
return 1
944951
except GitError as e:
@@ -950,7 +957,7 @@ branch.%s.pushRemote is set appropriately? (Override with --no-check-url)''' %
950957

951958
git_save_email_lists(topic, to, cc, options.override_cc)
952959

953-
if not options.pull_request:
960+
if not options.pull_request and not options.dry_run:
954961
# Publishing is done, stablize the tag now
955962
_git_check('tag', '-f', tag_name(topic, number), tag_name_staging(topic))
956963
git_delete_tag(tag_name_staging(topic))

0 commit comments

Comments
 (0)