This repository was archived by the owner on Jul 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathcommit.py
More file actions
72 lines (67 loc) · 2.04 KB
/
commit.py
File metadata and controls
72 lines (67 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import logging
import typing
import click
import sentry_sdk
from codecov_cli.fallbacks import CodecovOption, FallbackFieldEnum
from codecov_cli.helpers.args import get_cli_args
from codecov_cli.helpers.git import GitService
from codecov_cli.helpers.options import global_options
from codecov_cli.services.commit import create_commit_logic
from codecov_cli.types import CommandContext
logger = logging.getLogger("codecovcli")
@click.command()
@click.option(
"--parent-sha",
help="SHA (with 40 chars) of what should be the parent of this commit",
)
@click.option(
"-P",
"--pr",
"--pull-request-number",
"pull_request_number",
help="Specify the pull request number manually. Used to override pre-existing CI environment variables",
cls=CodecovOption,
fallback_field=FallbackFieldEnum.pull_request_number,
)
@click.option(
"-B",
"--branch",
help="Branch to which this commit belongs to",
cls=CodecovOption,
fallback_field=FallbackFieldEnum.branch,
)
@global_options
@click.pass_context
def create_commit(
ctx: CommandContext,
commit_sha: str,
parent_sha: typing.Optional[str],
pull_request_number: typing.Optional[int],
branch: typing.Optional[str],
slug: typing.Optional[str],
token: typing.Optional[str],
git_service: typing.Optional[str],
fail_on_error: bool,
):
with sentry_sdk.start_transaction(op="task", name="Create Commit"):
with sentry_sdk.start_span(name="create_commit"):
enterprise_url = ctx.obj.get("enterprise_url")
args = get_cli_args(ctx)
logger.debug(
"Starting create commit process",
extra=dict(
extra_log_attributes=args,
),
)
create_commit_logic(
commit_sha,
parent_sha,
pull_request_number,
branch,
slug,
token,
git_service,
enterprise_url,
fail_on_error,
args,
)