refactor: move constants to git_flow module
This commit is contained in:
@@ -49,3 +49,5 @@ SUPPORTED_REMOTE_APIS = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
REPOSITORY_TOKEN_FILENAME = ".repository-token"
|
REPOSITORY_TOKEN_FILENAME = ".repository-token"
|
||||||
|
|
||||||
|
FLOWCONFIG_FILENAME = ".flowconfig"
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
from git_flow import (
|
from git_flow import (
|
||||||
BRANCH_TYPES,
|
BRANCH_TYPES,
|
||||||
REPOSITORY_TOKEN_FILENAME,
|
REPOSITORY_TOKEN_FILENAME,
|
||||||
|
FLOWCONFIG_FILENAME,
|
||||||
GitFlowError,
|
GitFlowError,
|
||||||
)
|
)
|
||||||
from git_flow.git import FLOWCONFIG_FILE, Git
|
from git_flow.git import Git
|
||||||
from git_flow.remote.base import RemoteAPI
|
from git_flow.remote.base import RemoteAPI
|
||||||
from git_flow.remote.bitbucket import BitbucketRemoteAPI
|
from git_flow.remote.bitbucket import BitbucketRemoteAPI
|
||||||
from git_flow.remote.github import GithubRemoteAPI
|
from git_flow.remote.github import GithubRemoteAPI
|
||||||
@@ -16,7 +17,7 @@ TYPE_ERROR = 2
|
|||||||
TYPE_INFO = 3
|
TYPE_INFO = 3
|
||||||
|
|
||||||
|
|
||||||
flowconfig = Git.get_config(FLOWCONFIG_FILE) if isfile(FLOWCONFIG_FILE) else {}
|
flowconfig = Git.get_config(FLOWCONFIG_FILENAME) if isfile(FLOWCONFIG_FILENAME) else {}
|
||||||
|
|
||||||
|
|
||||||
def ensure_initialized():
|
def ensure_initialized():
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import typer
|
import typer
|
||||||
|
|
||||||
from git_flow import GitFlowError
|
from git_flow import FLOWCONFIG_FILENAME, GitFlowError
|
||||||
from git_flow.git import FLOWCONFIG_FILE, Git
|
from git_flow.git import Git
|
||||||
from git_flow.command.base import *
|
from git_flow.command.base import *
|
||||||
|
|
||||||
app = typer.Typer()
|
app = typer.Typer()
|
||||||
@@ -25,8 +25,8 @@ def init():
|
|||||||
if remote:
|
if remote:
|
||||||
flowconfig["flow.remote"] = remote
|
flowconfig["flow.remote"] = remote
|
||||||
|
|
||||||
Git.set_config(flowconfig, FLOWCONFIG_FILE)
|
Git.set_config(flowconfig, FLOWCONFIG_FILENAME)
|
||||||
Git("add", FLOWCONFIG_FILE).exec()
|
Git("add", FLOWCONFIG_FILENAME).exec()
|
||||||
Git("commit", message="feature: initialize git-flow").exec()
|
Git("commit", message="feature: initialize git-flow").exec()
|
||||||
|
|
||||||
_ensure_all_flow_branches_exist(branches, remote)
|
_ensure_all_flow_branches_exist(branches, remote)
|
||||||
@@ -43,7 +43,6 @@ def _ensure_is_repository():
|
|||||||
|
|
||||||
|
|
||||||
def _ensure_not_already_initialized():
|
def _ensure_not_already_initialized():
|
||||||
flowconfig = get_config()
|
|
||||||
if not flowconfig:
|
if not flowconfig:
|
||||||
return
|
return
|
||||||
elif flowconfig.get("flow.initialized") == "true":
|
elif flowconfig.get("flow.initialized") == "true":
|
||||||
|
|||||||
+2
-7
@@ -1,13 +1,8 @@
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
from git_flow import FLOWCONFIG_FILENAME
|
||||||
from git_flow.io import *
|
from git_flow.io import *
|
||||||
|
|
||||||
FLOWCONFIG_FILE = ".flowconfig"
|
|
||||||
|
|
||||||
CHANGELOG_FILE = "CHANGELOG.md"
|
|
||||||
|
|
||||||
BUMP_VERSION = "chore: bump version and update CHANGELOG.md [skip ci]"
|
|
||||||
|
|
||||||
|
|
||||||
class Git:
|
class Git:
|
||||||
class Status:
|
class Status:
|
||||||
@@ -42,7 +37,7 @@ class Git:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def flow_config(*args, **kwargs):
|
def flow_config(*args, **kwargs):
|
||||||
return Git("config", *args, file=FLOWCONFIG_FILE, **kwargs)
|
return Git("config", *args, file=FLOWCONFIG_FILENAME, **kwargs)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_current_branch():
|
def get_current_branch():
|
||||||
|
|||||||
Reference in New Issue
Block a user