@@ -525,36 +525,52 @@ def read_pull_request_info_from_github():
525
525
pullRequests .append (pr )
526
526
527
527
528
+ # The script will resolve what the next serialization version id (SID) should be. This is a complex task.
529
+ # Here is an overview:
530
+ # 1. If the --serVerId option exist, then the latest SID is bumped and used.
531
+ # 2. If the --release option exist, then the current pom.xml SID is validated, if ok it is used,
532
+ # if not the script exit.
533
+ # 3. All merged in PRs are checked. If a PR is labeled with 'bump serialization id' and the the
534
+ # HEAD commit is not in the latest release, then the last release SID is bumped and used.
535
+ # 4. Finally, the script look at the upstream SID for the last release and the base. If the SID
536
+ # is not the same the SID of the last release is bumped. To find the *upstream* SIDs the script
537
+ # look at the git history/log NOT matching the project serialization version id prefix - this
538
+ # is assumed to be the latest SID for the upstream project.
539
+ #
540
+ # Tip! If the '--release' option is used, then the serialization version id is NOT updated. Use the
541
+ # '--serVerId' option together with the '--release' to force update the serialization version id.
542
+ #
528
543
def resolve_next_ser_ver_id ():
529
544
info ('Resolve the next serialization version id ...' )
530
545
latest_release_hash = state .latest_version_git_hash ()
531
- latest_ser_ver_id = read_ser_ver_id_from_pom_file (latest_release_hash )
532
- bump_ser_ver_id = options .bump_ser_ver_id
533
-
534
- # If none of the PRs have the 'bump serialization id' label set, then find the upstream
535
- # serialization-version-id for the release-base and the current version. If these
536
- # serialization-version-ids are different, then we need to bump the new release serialization
537
- # version id. To find the *upstream* ids we step back in the git history looking for an id
538
- # not matching the project serialization version id prefix - this is assumed to be the latest
539
- # serialization version from the upstream project.
540
- if not bump_ser_ver_id :
546
+ state .latest_ser_ver_id = read_ser_ver_id_from_pom_file (latest_release_hash )
547
+
548
+ if options .bump_ser_ver_id :
549
+ state .next_ser_ver_id = bump_release_ser_ver_id (state .latest_ser_ver_id )
550
+ elif options .releaseOnly :
551
+ current_ser_ver_id = read_ser_ver_id_from_pom_file ("HEAD" )
552
+ if current_ser_ver_id .startswith (config .ser_ver_id_prefix ):
553
+ state .next_ser_ver_id = current_ser_ver_id
554
+ else :
555
+ error (f'The serialization-version-id ({ current_ser_ver_id } ) in the pom.xml must start with { config .ser_ver_id_prefix } .' )
556
+ elif state .prs_bump_ser_ver_id :
557
+ state .next_ser_ver_id = bump_release_ser_ver_id (state .latest_ser_ver_id )
558
+ else :
541
559
info (' - Find upstream serialization version id for latest release ...' )
542
- latest_upstream_id = find_upstream_ser_ver_id_in_history (latest_release_hash )
560
+ latest_upstream_ser_id = find_upstream_ser_ver_id_in_history (latest_release_hash )
543
561
544
562
info (f' - Find base serialization version id ...' )
545
563
base_hash = options .release_base_git_hash ()
546
- base_upstream_id = find_upstream_ser_ver_id_in_history (base_hash )
564
+ base_upstream_ser_id = find_upstream_ser_ver_id_in_history (base_hash )
547
565
548
566
# Update serialization version id in release if serialization version id has changed
549
- bump_ser_ver_id = latest_upstream_id != base_upstream_id
550
- info (f' - The latest upstream serialization.ver.id is { latest_upstream_id } '
551
- f'and the base upstream id is { base_upstream_id } .' )
552
-
553
- state .latest_ser_ver_id = latest_ser_ver_id
554
- if bump_ser_ver_id :
555
- state .next_ser_ver_id = bump_release_ser_ver_id (latest_ser_ver_id )
556
- else :
557
- state .next_ser_ver_id = latest_ser_ver_id
567
+ if latest_upstream_ser_id != base_upstream_ser_id :
568
+ info (f' - The latest upstream serialization.ver.id { latest_upstream_ser_id } '
569
+ f'and the base upstream id { base_upstream_ser_id } is diffrent. '
570
+ 'The serialization.ver.id is bumped.' )
571
+ state .next_ser_ver_id = bump_release_ser_ver_id (latest_ser_ver_id )
572
+ else :
573
+ state .next_ser_ver_id = latest_ser_ver_id
558
574
559
575
560
576
# Find the serialization-version-id for the upstream git project using the git log starting
@@ -801,14 +817,13 @@ def print_help():
801
817
print (f"""
802
818
This script is used to create a new release in a downstream fork of OTP. It will set both
803
819
the Maven version(2.7.0-entur-23) and the serialization-version-id(EN-0020) to a unique id
804
- using the fork project name. For the script to work the git remote name must match the
805
- GitHub 'owner' name.
820
+ using the provided configuration.
806
821
807
822
Release process overview
808
- 1. The configured release-branch is reset hard to the <base-revision>.
809
- 2. Then the labeled PRs are merged into the release-branch, if configured.
810
- 3. The config-branches are merged into the release-branch.
811
- 4. The pom.xml file is updated with a new version and serialization version id.
823
+ 1. The configured release-branch is reset hard to the <base-revision> script argument .
824
+ 2. Then the labeled PRs are merged into the release-branch [ if configured] .
825
+ 3. The config-branches are merged into the release-branch [if configured] .
826
+ 4. The pom.xml file is updated with a new version and serialization version id [if requiered] .
812
827
5. The release is tested, tagged and pushed to Git repo.
813
828
814
829
See the RELEASE_README.md for more details.
@@ -818,17 +833,18 @@ def print_help():
818
833
819
834
Arguments
820
835
<base-revision> : The base branch or commit to use as the base for the release. The
821
- 'otp/dev-2.x' is the most common base branch to use, but you can
822
- create a new release on top of any <commit>.
823
- This parameter is required unless option --release is used.
836
+ 'otp/dev-2.x' is the most common base branch to use, but you can create a
837
+ new release on top of any <commit>. This parameter is required unless
838
+ option --release is used.
824
839
825
840
Options
826
841
-h, --help : Print this help.
827
842
--debug : Run script with debug output enabled.
828
843
--dryRun : Run script locally, nothing is pushed to remote server.
829
- --release : Create a new release from the current local Git repo HEAD. It updates the
830
- maven-project-version and the serialization-version-id, creates a new tag
831
- and push the release. You should apply all fixes and commit BEFORE running
844
+ --release : Create a new release from the checked out local Git repo HEAD. It updates the
845
+ maven-project-version, but NOT the serialization-version-id. To increment the
846
+ serialization-version-id use the --serVerId option as well. This create a new
847
+ tag and push the release. You should apply all fixes and commit BEFORE running
832
848
this script. Can not be used with the <base-revision> argument set. The
833
849
'custom-release-extension' script is NOT run.
834
850
--serVerId : Force incrementation of the serialization version id.
0 commit comments