summaryrefslogtreecommitdiff
path: root/bin/changelog
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2016-11-02 22:15:20 +0000
committerRobert Speicher <rspeicher@gmail.com>2016-11-02 22:15:20 +0000
commit895673733a5712ee4b69c84195a1d717a72fc032 (patch)
treee8cdf2b42901430a88b1ad77525c77caa36513b8 /bin/changelog
parent99a12e120953c7b11d35a65e002a7906f30a99cb (diff)
downloadgitlab-ce-895673733a5712ee4b69c84195a1d717a72fc032.tar.gz
Add a `--force` option to bin/changelogrs-changelog-force
Diffstat (limited to 'bin/changelog')
-rwxr-xr-xbin/changelog8
1 files changed, 7 insertions, 1 deletions
diff --git a/bin/changelog b/bin/changelog
index a0d1ad2d730..2cd337af778 100755
--- a/bin/changelog
+++ b/bin/changelog
@@ -12,6 +12,7 @@ Options = Struct.new(
:amend,
:author,
:dry_run,
+ :force,
:merge_request,
:title
)
@@ -29,6 +30,10 @@ class ChangelogOptionParser
options.amend = value
end
+ opts.on('-f', '--force', 'Overwrite an existing entry') do |value|
+ options.force = value
+ end
+
opts.on('-m', '--merge-request [integer]', Integer, 'Merge Request ID') do |value|
options.merge_request = value
end
@@ -111,8 +116,9 @@ class ChangelogEntry
def assert_new_file!
return unless File.exist?(file_path)
+ return if options.force
- fail_with "#{file_path} already exists!"
+ fail_with "#{file_path} already exists! Use `--force` to overwrite."
end
def assert_title!