python-semantic-release 9.2.2__py3-none-any.whl → 9.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_semantic_release-9.2.2.dist-info → python_semantic_release-9.3.1.dist-info}/METADATA +2 -2
- {python_semantic_release-9.2.2.dist-info → python_semantic_release-9.3.1.dist-info}/RECORD +11 -11
- semantic_release/__init__.py +1 -1
- semantic_release/cli/commands/version.py +79 -86
- semantic_release/errors.py +7 -0
- semantic_release/version/algorithm.py +84 -60
- {python_semantic_release-9.2.2.dist-info → python_semantic_release-9.3.1.dist-info}/AUTHORS.rst +0 -0
- {python_semantic_release-9.2.2.dist-info → python_semantic_release-9.3.1.dist-info}/LICENSE +0 -0
- {python_semantic_release-9.2.2.dist-info → python_semantic_release-9.3.1.dist-info}/WHEEL +0 -0
- {python_semantic_release-9.2.2.dist-info → python_semantic_release-9.3.1.dist-info}/entry_points.txt +0 -0
- {python_semantic_release-9.2.2.dist-info → python_semantic_release-9.3.1.dist-info}/top_level.txt +0 -0
{python_semantic_release-9.2.2.dist-info → python_semantic_release-9.3.1.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-semantic-release
|
|
3
|
-
Version: 9.
|
|
3
|
+
Version: 9.3.1
|
|
4
4
|
Summary: Automatic Semantic Versioning for Python projects
|
|
5
5
|
Author-email: Rolf Erik Lekang <me@rolflekang.com>
|
|
6
6
|
License: MIT
|
|
@@ -35,7 +35,7 @@ Requires-Dist: shellingham >=1.5.0.post1
|
|
|
35
35
|
Provides-Extra: dev
|
|
36
36
|
Requires-Dist: pre-commit ; extra == 'dev'
|
|
37
37
|
Requires-Dist: tox ; extra == 'dev'
|
|
38
|
-
Requires-Dist: ruff ==0.3.
|
|
38
|
+
Requires-Dist: ruff ==0.3.3 ; extra == 'dev'
|
|
39
39
|
Provides-Extra: docs
|
|
40
40
|
Requires-Dist: Sphinx <=6.0.0 ; extra == 'docs'
|
|
41
41
|
Requires-Dist: sphinxcontrib-apidoc ==0.3.0 ; extra == 'docs'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
semantic_release/__init__.py,sha256=
|
|
1
|
+
semantic_release/__init__.py,sha256=FskRwovkP1zTcZTjLsLItxs24ykLO8-6VyZ_ffSU9EU,870
|
|
2
2
|
semantic_release/__main__.py,sha256=vXOARLV7KHeVXgpOMU0Q-8wovpdsOrtTsycxulI5xIE,106
|
|
3
3
|
semantic_release/const.py,sha256=Z1o2QNh60wSLeF-_1TemMBjU3ZXbV0XghnUFsbTVfOs,831
|
|
4
4
|
semantic_release/enums.py,sha256=D5B_reQGGKQQT22HO5PUtvn2Bok3fkht6TfJtXkmAUg,1020
|
|
5
|
-
semantic_release/errors.py,sha256=
|
|
5
|
+
semantic_release/errors.py,sha256=8cNiMhgUTNZC0CecokLyl9YWxREHEh9otm1cRs9kkbU,1001
|
|
6
6
|
semantic_release/helpers.py,sha256=d1jOX0SNyqPc_3wr14xR25FfpqhMd4Ev7MNBOWlScc0,5581
|
|
7
7
|
semantic_release/changelog/__init__.py,sha256=Bg6Xe5Vt32rWoMscW-hd4sUwiZqzWmsg4CD1EhMesMY,262
|
|
8
8
|
semantic_release/changelog/context.py,sha256=ItSz5Bon2mcJkLxyQZzBTukN0zEdcaVQ4iXvz3jGCLc,986
|
|
@@ -21,7 +21,7 @@ semantic_release/cli/commands/cli_context.py,sha256=fOLTUKb4UnZGQ6zVhftuvdfZ7fK7
|
|
|
21
21
|
semantic_release/cli/commands/generate_config.py,sha256=2xZOu3NpyhBp0pWr7d8ugKl_kjqQgpSsSMHq5wHTfrE,1699
|
|
22
22
|
semantic_release/cli/commands/main.py,sha256=LuL-O0LGonI5fQTZn0AUtYv2Ei_CYyNqYHMF_wN4InI,2900
|
|
23
23
|
semantic_release/cli/commands/publish.py,sha256=_pz7rKx65tCH7J2uyWiBghQ61MmmIbxhF9bE4AkE0N8,1703
|
|
24
|
-
semantic_release/cli/commands/version.py,sha256=
|
|
24
|
+
semantic_release/cli/commands/version.py,sha256=jz3ao9AV0YeMAwZULSnnanl6OL-NWIc5rnr9E7BrZL0,22111
|
|
25
25
|
semantic_release/commit_parser/__init__.py,sha256=cv5HFBdw7OJd4Laj4Ex8ZZ5Tml8GwXgQcXW6Pasr2Ao,615
|
|
26
26
|
semantic_release/commit_parser/_base.py,sha256=aDS0dhFosT5i11tA5Ez8BTeikk6jwXjSEpJnJC5D2cs,2609
|
|
27
27
|
semantic_release/commit_parser/angular.py,sha256=bS7Wrzpg_6zFil5Y4GIZkeGDPhvWQdTlFdWTtGVcpp0,4393
|
|
@@ -41,14 +41,14 @@ semantic_release/hvcs/gitlab.py,sha256=qSvNdQK40QM20-HDh3eIO6Rz8Lo3PEND_4kluugVx
|
|
|
41
41
|
semantic_release/hvcs/token_auth.py,sha256=ZjT56-NIPB4OKIt1qwHCu1TavXnrWFIBl9ARlg56hgU,663
|
|
42
42
|
semantic_release/hvcs/util.py,sha256=PNKXApgL2np9lpnKjAbo77toRgElLPXrbS1q7621waI,2886
|
|
43
43
|
semantic_release/version/__init__.py,sha256=CLhtGQry9dLIij5XyRa9ZevxU_1p8tjMTSQ-K_GMpWM,270
|
|
44
|
-
semantic_release/version/algorithm.py,sha256
|
|
44
|
+
semantic_release/version/algorithm.py,sha256=-9ulTy1z4u-jUvbc-FrvEdFL7Omc3O3HhaPohjiCmm0,16854
|
|
45
45
|
semantic_release/version/declaration.py,sha256=f6Ld7hIhrqvDrRBapJHr-KDimuyo-4IG8009Zu9BIgU,7357
|
|
46
46
|
semantic_release/version/translator.py,sha256=P1noIsVBn8u6zNOFjG0xKYOWapxqf_PHSMvMeLJ9kXg,3050
|
|
47
47
|
semantic_release/version/version.py,sha256=6PCtSbLP88U1daoxnCwHc--YguZo4waGNLqJ5JfeczE,14175
|
|
48
|
-
python_semantic_release-9.
|
|
49
|
-
python_semantic_release-9.
|
|
50
|
-
python_semantic_release-9.
|
|
51
|
-
python_semantic_release-9.
|
|
52
|
-
python_semantic_release-9.
|
|
53
|
-
python_semantic_release-9.
|
|
54
|
-
python_semantic_release-9.
|
|
48
|
+
python_semantic_release-9.3.1.dist-info/AUTHORS.rst,sha256=XOReVvpymEFUPsS2QPH97jlfJBVrxwS2eu8-jVAe4gk,230
|
|
49
|
+
python_semantic_release-9.3.1.dist-info/LICENSE,sha256=NE85nszX252sdQdu0xgS9qwfYES0k8qS6gW3uO4jRGE,1083
|
|
50
|
+
python_semantic_release-9.3.1.dist-info/METADATA,sha256=5qM5BEHU7GNT6jkoRTluZCmmrJUJDtrWOKHbbwJUmII,5365
|
|
51
|
+
python_semantic_release-9.3.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
52
|
+
python_semantic_release-9.3.1.dist-info/entry_points.txt,sha256=qojUBx_Ywf4u7KgP6NWlDaBDymZVUGQ7m5wF2duC2F0,95
|
|
53
|
+
python_semantic_release-9.3.1.dist-info/top_level.txt,sha256=qYA24nyg3eP-ti5UW7Vuj2aXVmM0wqVHx4mREdRZNAA,17
|
|
54
|
+
python_semantic_release-9.3.1.dist-info/RECORD,,
|
semantic_release/__init__.py
CHANGED
|
@@ -375,13 +375,71 @@ def version( # noqa: C901
|
|
|
375
375
|
|
|
376
376
|
rprint(f"[bold green]The next version is: [white]{new_version!s}[/white]! :rocket:")
|
|
377
377
|
|
|
378
|
+
rh = ReleaseHistory.from_git_history(
|
|
379
|
+
repo=repo,
|
|
380
|
+
translator=translator,
|
|
381
|
+
commit_parser=parser,
|
|
382
|
+
exclude_commit_patterns=changelog_excluded_commit_patterns,
|
|
383
|
+
)
|
|
384
|
+
|
|
385
|
+
commit_date = datetime.now()
|
|
386
|
+
try:
|
|
387
|
+
rh = rh.release(
|
|
388
|
+
new_version,
|
|
389
|
+
tagger=commit_author,
|
|
390
|
+
committer=commit_author,
|
|
391
|
+
tagged_date=commit_date,
|
|
392
|
+
)
|
|
393
|
+
except ValueError as ve:
|
|
394
|
+
ctx.fail(str(ve))
|
|
395
|
+
|
|
396
|
+
all_paths_to_add: list[str] = []
|
|
397
|
+
|
|
398
|
+
if update_changelog:
|
|
399
|
+
changelog_context = make_changelog_context(
|
|
400
|
+
hvcs_client=hvcs_client, release_history=rh
|
|
401
|
+
)
|
|
402
|
+
changelog_context.bind_to_environment(env)
|
|
403
|
+
|
|
404
|
+
if template_dir.is_dir():
|
|
405
|
+
if opts.noop:
|
|
406
|
+
noop_report(
|
|
407
|
+
f"would have recursively rendered the template directory "
|
|
408
|
+
f"{template_dir!r} relative to {repo.working_dir!r}. "
|
|
409
|
+
"Paths which would be modified by this operation cannot be "
|
|
410
|
+
"determined in no-op mode."
|
|
411
|
+
)
|
|
412
|
+
else:
|
|
413
|
+
all_paths_to_add.extend(
|
|
414
|
+
recursive_render(
|
|
415
|
+
template_dir, environment=env, _root_dir=repo.working_dir
|
|
416
|
+
)
|
|
417
|
+
)
|
|
418
|
+
|
|
419
|
+
else:
|
|
420
|
+
log.info(
|
|
421
|
+
"Path %r not found, using default changelog template", template_dir
|
|
422
|
+
)
|
|
423
|
+
if opts.noop:
|
|
424
|
+
noop_report(
|
|
425
|
+
"would have written your changelog to "
|
|
426
|
+
+ str(changelog_file.relative_to(repo.working_dir))
|
|
427
|
+
)
|
|
428
|
+
else:
|
|
429
|
+
changelog_text = render_default_changelog_file(env)
|
|
430
|
+
changelog_file.write_text(f"{changelog_text}\n", encoding="utf-8")
|
|
431
|
+
|
|
432
|
+
all_paths_to_add.append(str(changelog_file.relative_to(repo.working_dir)))
|
|
433
|
+
|
|
434
|
+
# Apply the new version to the source files
|
|
378
435
|
files_with_new_version_written = apply_version_to_source_files(
|
|
379
436
|
repo=repo,
|
|
380
437
|
version_declarations=runtime.version_declarations,
|
|
381
438
|
version=new_version,
|
|
382
439
|
noop=opts.noop,
|
|
383
440
|
)
|
|
384
|
-
all_paths_to_add
|
|
441
|
+
all_paths_to_add.extend(files_with_new_version_written)
|
|
442
|
+
all_paths_to_add.extend(assets or [])
|
|
385
443
|
|
|
386
444
|
# Build distributions before committing any changes - this way if the
|
|
387
445
|
# build fails, modifications to the source code won't be committed
|
|
@@ -404,19 +462,11 @@ def version( # noqa: C901
|
|
|
404
462
|
|
|
405
463
|
# Commit changes
|
|
406
464
|
if commit_changes and opts.noop:
|
|
407
|
-
# Indents the newlines so that terminal formatting is happy - note the
|
|
408
|
-
# git commit line of the output is 24 spaces indented too
|
|
409
|
-
# Only this message needs such special handling because of the newlines
|
|
410
|
-
# that might be in a commit message between the subject and body
|
|
411
|
-
indented_commit_message = commit_message.format(version=new_version).replace(
|
|
412
|
-
"\n\n", "\n\n" + " " * 24
|
|
413
|
-
)
|
|
414
465
|
noop_report(
|
|
415
466
|
indented(
|
|
416
467
|
f"""
|
|
417
468
|
would have run:
|
|
418
469
|
git add {" ".join(all_paths_to_add)}
|
|
419
|
-
git commit -m "{indented_commit_message}"
|
|
420
470
|
"""
|
|
421
471
|
)
|
|
422
472
|
)
|
|
@@ -432,80 +482,6 @@ def version( # noqa: C901
|
|
|
432
482
|
except GitCommandError: # noqa: PERF203
|
|
433
483
|
log.warning("Failed to add path (%s) to index", updated_path)
|
|
434
484
|
|
|
435
|
-
rh = ReleaseHistory.from_git_history(
|
|
436
|
-
repo=repo,
|
|
437
|
-
translator=translator,
|
|
438
|
-
commit_parser=parser,
|
|
439
|
-
exclude_commit_patterns=changelog_excluded_commit_patterns,
|
|
440
|
-
)
|
|
441
|
-
|
|
442
|
-
commit_date = datetime.now()
|
|
443
|
-
try:
|
|
444
|
-
rh = rh.release(
|
|
445
|
-
new_version,
|
|
446
|
-
tagger=commit_author,
|
|
447
|
-
committer=commit_author,
|
|
448
|
-
tagged_date=commit_date,
|
|
449
|
-
)
|
|
450
|
-
except ValueError as ve:
|
|
451
|
-
ctx.fail(str(ve))
|
|
452
|
-
|
|
453
|
-
changelog_context = make_changelog_context(
|
|
454
|
-
hvcs_client=hvcs_client, release_history=rh
|
|
455
|
-
)
|
|
456
|
-
changelog_context.bind_to_environment(env)
|
|
457
|
-
|
|
458
|
-
updated_paths: list[str] = []
|
|
459
|
-
if update_changelog:
|
|
460
|
-
if template_dir.is_dir():
|
|
461
|
-
if opts.noop:
|
|
462
|
-
noop_report(
|
|
463
|
-
f"would have recursively rendered the template directory "
|
|
464
|
-
f"{template_dir!r} relative to {repo.working_dir!r}. "
|
|
465
|
-
"Paths which would be modified by this operation cannot be "
|
|
466
|
-
"determined in no-op mode."
|
|
467
|
-
)
|
|
468
|
-
else:
|
|
469
|
-
updated_paths = recursive_render(
|
|
470
|
-
template_dir, environment=env, _root_dir=repo.working_dir
|
|
471
|
-
)
|
|
472
|
-
|
|
473
|
-
else:
|
|
474
|
-
log.info(
|
|
475
|
-
"Path %r not found, using default changelog template", template_dir
|
|
476
|
-
)
|
|
477
|
-
if opts.noop:
|
|
478
|
-
noop_report(
|
|
479
|
-
"would have written your changelog to "
|
|
480
|
-
+ str(changelog_file.relative_to(repo.working_dir))
|
|
481
|
-
)
|
|
482
|
-
else:
|
|
483
|
-
changelog_text = render_default_changelog_file(env)
|
|
484
|
-
changelog_file.write_text(f"{changelog_text}\n", encoding="utf-8")
|
|
485
|
-
|
|
486
|
-
updated_paths = [str(changelog_file.relative_to(repo.working_dir))]
|
|
487
|
-
|
|
488
|
-
if commit_changes and opts.noop:
|
|
489
|
-
noop_report(
|
|
490
|
-
indented(
|
|
491
|
-
f"""
|
|
492
|
-
would have run:
|
|
493
|
-
git add {" ".join(updated_paths)}
|
|
494
|
-
"""
|
|
495
|
-
)
|
|
496
|
-
)
|
|
497
|
-
elif commit_changes:
|
|
498
|
-
# Anything changed here should be staged.
|
|
499
|
-
# TODO: in future this loop should be 1 line:
|
|
500
|
-
# repo.index.add(updated_paths, force=False) # noqa: ERA001
|
|
501
|
-
# but since 'force' is deliberally ineffective (as in docstring) in gitpython 3.1.18
|
|
502
|
-
# we have to do manually add each filepath, and catch the exception if it is an ignored file
|
|
503
|
-
for updated_path in updated_paths:
|
|
504
|
-
try:
|
|
505
|
-
repo.git.add(updated_path)
|
|
506
|
-
except GitCommandError: # noqa: PERF203
|
|
507
|
-
log.warning("Failed to add path (%s) to index", updated_path)
|
|
508
|
-
|
|
509
485
|
def custom_git_environment() -> ContextManager[None]:
|
|
510
486
|
"""
|
|
511
487
|
git.custom_environment is a context manager but
|
|
@@ -541,7 +517,16 @@ def version( # noqa: C901
|
|
|
541
517
|
if commit_author
|
|
542
518
|
else ""
|
|
543
519
|
)
|
|
544
|
-
|
|
520
|
+
|
|
521
|
+
# Indents the newlines so that terminal formatting is happy - note the
|
|
522
|
+
# git commit line of the output is 24 spaces indented too
|
|
523
|
+
# Only this message needs such special handling because of the newlines
|
|
524
|
+
# that might be in a commit message between the subject and body
|
|
525
|
+
indented_commit_message = commit_message.format(version=new_version).replace(
|
|
526
|
+
"\n\n", "\n\n" + " " * 24
|
|
527
|
+
)
|
|
528
|
+
|
|
529
|
+
command += f"git commit -m '{indented_commit_message}'"
|
|
545
530
|
|
|
546
531
|
noop_report(
|
|
547
532
|
indented(
|
|
@@ -600,12 +585,17 @@ def version( # noqa: C901
|
|
|
600
585
|
indented(
|
|
601
586
|
f"""
|
|
602
587
|
would have run:
|
|
603
|
-
git push
|
|
588
|
+
git push {runtime.masker.mask(remote_url)} tag {new_version.as_tag()}
|
|
604
589
|
""" # noqa: E501
|
|
605
590
|
)
|
|
606
591
|
)
|
|
607
592
|
elif create_tag:
|
|
608
|
-
|
|
593
|
+
# push specific tag refspec (that we made) to remote
|
|
594
|
+
# ---------------
|
|
595
|
+
# Resolves issue #803 where a tag that already existed was pushed and caused
|
|
596
|
+
# a failure. Its not clear why there was an incorrect tag (likely user error change)
|
|
597
|
+
# but we will avoid possibly pushing an separate tag that we didn't create.
|
|
598
|
+
repo.git.push(remote_url, "tag", new_version.as_tag())
|
|
609
599
|
|
|
610
600
|
gha_output.released = True
|
|
611
601
|
|
|
@@ -619,6 +609,9 @@ def version( # noqa: C901
|
|
|
619
609
|
# Use a new, non-configurable environment for release notes -
|
|
620
610
|
# not user-configurable at the moment
|
|
621
611
|
release_note_environment = environment(template_dir=runtime.template_dir)
|
|
612
|
+
changelog_context = make_changelog_context(
|
|
613
|
+
hvcs_client=hvcs_client, release_history=rh
|
|
614
|
+
)
|
|
622
615
|
changelog_context.bind_to_environment(release_note_environment)
|
|
623
616
|
|
|
624
617
|
template = get_release_notes_template(template_dir)
|
semantic_release/errors.py
CHANGED
|
@@ -31,3 +31,10 @@ class CommitParseError(SemanticReleaseBaseError):
|
|
|
31
31
|
Raised when a commit cannot be parsed by a commit parser. Custom commit parsers
|
|
32
32
|
should also raise this Exception
|
|
33
33
|
"""
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class MissingMergeBaseError(SemanticReleaseBaseError):
|
|
37
|
+
"""
|
|
38
|
+
Raised when the merge base cannot be found with the current history. Generally
|
|
39
|
+
because of a shallow git clone.
|
|
40
|
+
"""
|
|
@@ -4,12 +4,10 @@ import logging
|
|
|
4
4
|
from queue import Queue
|
|
5
5
|
from typing import TYPE_CHECKING, Iterable
|
|
6
6
|
|
|
7
|
-
from semantic_release.commit_parser import
|
|
8
|
-
ParsedCommit,
|
|
9
|
-
)
|
|
7
|
+
from semantic_release.commit_parser import ParsedCommit
|
|
10
8
|
from semantic_release.const import DEFAULT_VERSION
|
|
11
9
|
from semantic_release.enums import LevelBump
|
|
12
|
-
from semantic_release.errors import InvalidVersion
|
|
10
|
+
from semantic_release.errors import InvalidVersion, MissingMergeBaseError
|
|
13
11
|
from semantic_release.version.version import Version
|
|
14
12
|
|
|
15
13
|
if TYPE_CHECKING:
|
|
@@ -278,9 +276,9 @@ def next_version(
|
|
|
278
276
|
"""
|
|
279
277
|
# Step 1. All tags, sorted descending by semver ordering rules
|
|
280
278
|
all_git_tags_as_versions = tags_and_versions(repo.tags, translator)
|
|
281
|
-
all_full_release_tags_and_versions =
|
|
282
|
-
(
|
|
283
|
-
|
|
279
|
+
all_full_release_tags_and_versions = list(
|
|
280
|
+
filter(lambda t_v: not t_v[1].is_prerelease, all_git_tags_as_versions)
|
|
281
|
+
)
|
|
284
282
|
log.info(
|
|
285
283
|
"Found %s full releases (excluding prereleases)",
|
|
286
284
|
len(all_full_release_tags_and_versions),
|
|
@@ -291,30 +289,59 @@ def next_version(
|
|
|
291
289
|
iter(all_full_release_tags_and_versions),
|
|
292
290
|
(None, translator.from_string(DEFAULT_VERSION)),
|
|
293
291
|
)
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
292
|
+
|
|
293
|
+
# we can safely scan the extra commits on this
|
|
294
|
+
# branch if it's never been released, but we have no other
|
|
295
|
+
# guarantees that other branches exist
|
|
296
|
+
# Note the merge_base might be on our current branch, it's not
|
|
297
|
+
# necessarily the merge base of the current branch with `main`
|
|
298
|
+
other_ref = (
|
|
299
|
+
repo.active_branch
|
|
300
|
+
if latest_full_release_tag is None
|
|
301
|
+
else latest_full_release_tag.name
|
|
302
|
+
)
|
|
303
|
+
|
|
304
|
+
# Conditional log message to inform what was chosen as the comparison point
|
|
305
|
+
# to find the merge base of the current branch with the latest full release
|
|
306
|
+
log_msg = (
|
|
307
|
+
str.join(
|
|
308
|
+
", ",
|
|
309
|
+
[
|
|
310
|
+
"No full releases have been made yet",
|
|
311
|
+
f"the default version to use is {latest_full_release_version}",
|
|
312
|
+
],
|
|
301
313
|
)
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
latest_full_release_tag,
|
|
314
|
+
if latest_full_release_tag is None
|
|
315
|
+
else str.join(
|
|
316
|
+
", ",
|
|
317
|
+
[
|
|
318
|
+
f"The last full release was {latest_full_release_version}",
|
|
319
|
+
f"tagged as {latest_full_release_tag!r}",
|
|
320
|
+
],
|
|
310
321
|
)
|
|
311
|
-
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
log.info(log_msg)
|
|
325
|
+
merge_bases = repo.merge_base(other_ref, repo.active_branch)
|
|
326
|
+
|
|
327
|
+
if len(merge_bases) < 1:
|
|
328
|
+
raise MissingMergeBaseError(
|
|
329
|
+
f"Unable to find merge-base between {other_ref} and {repo.active_branch.name}"
|
|
330
|
+
)
|
|
331
|
+
|
|
312
332
|
if len(merge_bases) > 1:
|
|
313
333
|
raise NotImplementedError(
|
|
314
|
-
|
|
315
|
-
|
|
334
|
+
str.join(
|
|
335
|
+
" ",
|
|
336
|
+
[
|
|
337
|
+
"This branch has more than one merge-base with the",
|
|
338
|
+
"latest version, which is not yet supported",
|
|
339
|
+
],
|
|
340
|
+
)
|
|
316
341
|
)
|
|
342
|
+
|
|
317
343
|
merge_base = merge_bases[0]
|
|
344
|
+
|
|
318
345
|
if merge_base is None:
|
|
319
346
|
str_tag_name = (
|
|
320
347
|
"None" if latest_full_release_tag is None else latest_full_release_tag.name
|
|
@@ -350,6 +377,23 @@ def next_version(
|
|
|
350
377
|
tag_format=translator.tag_format,
|
|
351
378
|
)
|
|
352
379
|
|
|
380
|
+
# We only include pre-releases here if doing a prerelease.
|
|
381
|
+
# If it's not a prerelease, we need to include commits back
|
|
382
|
+
# to the last full version in consideration for what kind of
|
|
383
|
+
# bump to produce. However if we're doing a prerelease, we can
|
|
384
|
+
# include prereleases here to potentially consider a smaller portion
|
|
385
|
+
# of history (from a prerelease since the last full release, onwards)
|
|
386
|
+
|
|
387
|
+
# Note that a side-effect of this is, if at some point the configuration
|
|
388
|
+
# for a particular branch pattern changes w.r.t. prerelease=True/False,
|
|
389
|
+
# the new kind of version will be produced from the commits already
|
|
390
|
+
# included in a prerelease since the last full release on the branch
|
|
391
|
+
tag_sha_2_version_lookup = {
|
|
392
|
+
tag.commit.hexsha: (tag, version)
|
|
393
|
+
for tag, version in all_git_tags_as_versions
|
|
394
|
+
if prerelease or not version.is_prerelease
|
|
395
|
+
}
|
|
396
|
+
|
|
353
397
|
# N.B. these should be sorted so long as we iterate the commits in reverse order
|
|
354
398
|
for commit in commits_since_last_full_release:
|
|
355
399
|
parse_result = commit_parser.parse(commit)
|
|
@@ -360,44 +404,24 @@ def next_version(
|
|
|
360
404
|
)
|
|
361
405
|
parsed_levels.add(parse_result.bump)
|
|
362
406
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
# include prereleases here to potentially consider a smaller portion
|
|
368
|
-
# of history (from a prerelease since the last full release, onwards)
|
|
369
|
-
|
|
370
|
-
# Note that a side-effect of this is, if at some point the configuration
|
|
371
|
-
# for a particular branch pattern changes w.r.t. prerelease=True/False,
|
|
372
|
-
# the new kind of version will be produced from the commits already
|
|
373
|
-
# included in a prerelease since the last full release on the branch
|
|
374
|
-
for tag, version in (
|
|
375
|
-
(tag, version)
|
|
376
|
-
for tag, version in all_git_tags_as_versions
|
|
377
|
-
if prerelease or not version.is_prerelease
|
|
378
|
-
):
|
|
379
|
-
log.debug(
|
|
380
|
-
"testing if tag %r (%s) matches commit %s",
|
|
381
|
-
tag.name,
|
|
382
|
-
tag.commit.hexsha,
|
|
383
|
-
commit.hexsha,
|
|
384
|
-
)
|
|
385
|
-
if tag.commit == commit:
|
|
386
|
-
latest_version = version
|
|
387
|
-
log.debug(
|
|
388
|
-
"tag %r (%s) matches commit %s. the latest version is %s",
|
|
389
|
-
tag.name,
|
|
390
|
-
tag.commit.hexsha,
|
|
391
|
-
commit.hexsha,
|
|
392
|
-
latest_version,
|
|
393
|
-
)
|
|
394
|
-
break
|
|
395
|
-
else:
|
|
407
|
+
log.debug("checking if commit %s matches any tags", commit.hexsha)
|
|
408
|
+
t_v = tag_sha_2_version_lookup.get(commit.hexsha, None)
|
|
409
|
+
|
|
410
|
+
if t_v is None:
|
|
396
411
|
# If we haven't found the latest prerelease on the branch,
|
|
397
|
-
# keep the
|
|
412
|
+
# keep the loop going to look for it
|
|
398
413
|
log.debug("no tags correspond to commit %s", commit.hexsha)
|
|
399
414
|
continue
|
|
400
|
-
|
|
415
|
+
|
|
416
|
+
# Unpack the tuple
|
|
417
|
+
tag, latest_version = t_v
|
|
418
|
+
log.debug(
|
|
419
|
+
"tag %r (%s) matches commit %s. the latest version is %s",
|
|
420
|
+
tag.name,
|
|
421
|
+
tag.commit.hexsha,
|
|
422
|
+
commit.hexsha,
|
|
423
|
+
latest_version,
|
|
424
|
+
)
|
|
401
425
|
break
|
|
402
426
|
|
|
403
427
|
log.debug(
|
{python_semantic_release-9.2.2.dist-info → python_semantic_release-9.3.1.dist-info}/AUTHORS.rst
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_semantic_release-9.2.2.dist-info → python_semantic_release-9.3.1.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{python_semantic_release-9.2.2.dist-info → python_semantic_release-9.3.1.dist-info}/top_level.txt
RENAMED
|
File without changes
|