Fixes#4061.
Four things:
1. Reorder the script steps so that builds are triggered before the PR
is created. This should not really be necessary, but I am seeing some
evidence that TeamCity is not respecting the commit sha we request to
build. (This arose with 14.0.194 where a build agent became
unavailable during a build and TC cancelled and restarted the build,
but from a later revision... which this particular fix may not help,
I guess...)
2. Add debug logging so we can see exactly which commit sha that we
send to TeamCity
3. Handle errors in version increment by aborting the script with an
error.
4. Add a -f force mode which we can use to trigger a build even if no
changes are detected. This will need a corresponding patch in TC.
Instead of just reporting on --first-parent, now lists all merges that
are in the log, which means we get some non-PR merges but that's ok. At
least we get all of them.
This was most visible with chained PRs which were merged bottom-up.
This prepares a PR with updated history and version
for auto-merge. Any new PRs are merged into HISTORY.md
but existing entries are left untouched. Thus, we can
tweak wording in HISTORY.md at any time without the
effort of figuring out which PRs need to be present
manually.