aboutsummaryrefslogtreecommitdiff
path: root/bdep/release.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-03-11 22:56:51 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-03-12 12:50:02 +0300
commit74d010e9ca446f7a736f9215a961f6728f6047be (patch)
treefe4630b7af1563decba7442432eee1524aca1c29 /bdep/release.cxx
parent9e75650b59e4cd580c07e2ff50788019108cd194 (diff)
Add --edit and --no-edit options to bdep-release
Diffstat (limited to 'bdep/release.cxx')
-rw-r--r--bdep/release.cxx21
1 files changed, 15 insertions, 6 deletions
diff --git a/bdep/release.cxx b/bdep/release.cxx
index cb74957..c6eef28 100644
--- a/bdep/release.cxx
+++ b/bdep/release.cxx
@@ -493,11 +493,13 @@ namespace bdep
gopt = o.revision () ? nullptr : mopt;
verify ("--no-tag", o.no_tag ());
- // The following option is only meaningful for the releasing, revising,
- // and opening modes.
+ // The following (mutually exclusive) options are only meaningful for
+ // the releasing, revising, and opening modes.
//
gopt = o.revision () || o.open () ? nullptr : mopt;
verify ("--no-commit", o.no_commit ());
+ verify ("--edit", o.edit ());
+ verify ("--no-edit", o.no_edit ());
// The following (mutually exclusive) options are only meaningful for
// the releasing and opening modes.
@@ -772,9 +774,11 @@ namespace bdep
return 1;
}
- // Stage and commit the project changes.
+ // Stage and commit the project changes. Open the commit message in the
+ // editor if requested and --no-edit is not specified or if --edit is
+ // specified.
//
- auto commit_project = [&prj] (const string& msg)
+ auto commit_project = [&o, &prj] (const string& msg, bool edit)
{
// We shouldn't have any untracked files or unstaged changes other than
// our modifications, so -a is good enough.
@@ -784,6 +788,7 @@ namespace bdep
"commit",
verb < 1 ? "-q" : verb >= 2 ? "-v" : nullptr,
"-a",
+ (edit && !o.no_edit ()) || o.edit () ? "-e" : nullptr,
"-m", msg);
};
@@ -858,7 +863,11 @@ namespace bdep
else
m = "Release version " + pkg.release_version->string ();
- commit_project (m);
+ commit_project (m, st.staged);
+
+ // The (possibly) staged changes are now committed.
+ //
+ st.staged = false;
}
// Tag.
@@ -923,7 +932,7 @@ namespace bdep
// Commit the manifest rewrites.
//
- commit_project ("Change version to " + ov);
+ commit_project ("Change version to " + ov, st.staged);
}
if (push)