Skip to content

Commit 125e77b

Browse files
Renamed internal variable for force branch
1 parent 20ec68b commit 125e77b

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

sphinx_versioned/__main__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def main(
7676
loglevel: str = typer.Option(
7777
"info", "-log", "--log", help="Provide logging level. Example --log debug, default=info"
7878
),
79-
force_branches: bool = typer.Option(
79+
force_branch: bool = typer.Option(
8080
False,
8181
"--force",
8282
help="Force branch selection. Use this option to build detached head/commits. [Default: False]",
@@ -115,7 +115,7 @@ def main(
115115
Passed directly to sphinx. Specify more than once for more logging in sphinx. [Default = `False`]
116116
loglevel : :class:`str`
117117
Provide logging level. Example `--log` debug, [Default='info']
118-
force_branches : :class:`str`
118+
force_branch : :class:`str`
119119
Force branch selection. Use this option to build detached head/commits. [Default = `False`]
120120
121121
Returns
@@ -133,7 +133,7 @@ def main(
133133
config = {
134134
"reset_intersphinx_mapping": reset_intersphinx_mapping,
135135
"sphinx_compatibility": sphinx_compatibility,
136-
"force_branches": force_branches,
136+
"force_branch": force_branch,
137137
"exclude_branch": exclude_branch,
138138
"floating_badge": floating_badge,
139139
"select_branch": select_branch,

sphinx_versioned/build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __init__(self, config: dict, debug: bool = False) -> None:
5858

5959
# if `--force` is supplied with no `--main-branch`, make the `_active_branch` as the `main_branch`
6060
if not self.config.get("main_branch"):
61-
if self.config.get("force_branches"):
61+
if self.config.get("force_branch"):
6262
self.config["main_branch"] = self.versions.active_branch.name
6363
else:
6464
self.config["main_branch"] = "main"
@@ -109,7 +109,7 @@ def read_conf(self) -> bool:
109109

110110
def configure_conf(self) -> None:
111111
# Initialize GitVersions instance
112-
self.versions = GitVersions(self.git_root, self.output_dir, self.config.get("force_branches"))
112+
self.versions = GitVersions(self.git_root, self.output_dir, self.config.get("force_branch"))
113113

114114
if self.config.get("floating_badge"):
115115
EventHandlers.FLYOUT_FLOATING_BADGE = True

sphinx_versioned/versions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ class GitVersions(_BranchTag):
6969
Git repository root directory.
7070
build_directory : :class:`str`
7171
Path of build directory.
72-
force_branches : :class:`bool`
72+
force_branch : :class:`bool`
7373
This option allows `GitVersions` to treat the detached commits as normal branches.
7474
Use this option to build docs for detached head/commits.
7575
"""
7676

77-
def __init__(self, git_root: str, build_directory: str, force_branches: bool) -> None:
77+
def __init__(self, git_root: str, build_directory: str, force_branch: bool) -> None:
7878
self.git_root = git_root
7979
self.build_directory = pathlib.Path(build_directory)
80-
self.force_branches = force_branches
80+
self.force_branch = force_branch
8181

8282
# for detached head
8383
self._active_branch = None
@@ -116,7 +116,7 @@ def _parse_branches(self) -> bool:
116116
# check if if the current git status is detached, if yes, and if `--force` is supplied -> append:
117117
if self.repo.head.is_detached:
118118
log.warning(f"git head detached {self.repo.head.is_detached}")
119-
if self.force_branches:
119+
if self.force_branch:
120120
log.debug("Forcing detached commit into PseudoBranch")
121121
self.all_versions.append(PseudoBranch(self.repo.head.object.hexsha))
122122

0 commit comments

Comments
 (0)