refactor: Rename config functions and parameters
- Renamed `read_config` to `read_config_item` and updated its usage - Renamed `save_config` to `save_config_item` and updated its usage - Renamed `save_branch` parameter to `base_branch` in `save_last_base_branch`
This commit is contained in:
parent
3a15d11026
commit
da9f21e1dc
@ -414,7 +414,7 @@ def update_pr(pr_number, title, body, repo_name):
|
||||
|
||||
def get_last_base_branch(default_branch):
|
||||
""" read last base branch from config file """
|
||||
def read_config(config_path, item):
|
||||
def read_config_item(config_path, item):
|
||||
if os.path.exists(config_path):
|
||||
with open(config_path, "r", encoding="utf-8") as f:
|
||||
config = json.load(f)
|
||||
@ -422,14 +422,14 @@ def get_last_base_branch(default_branch):
|
||||
return None
|
||||
|
||||
project_config_path = os.path.join(os.getcwd(), ".chat", ".workflow_config.json")
|
||||
last_base_branch = read_config(project_config_path, "last_base_branch")
|
||||
last_base_branch = read_config_item(project_config_path, "last_base_branch")
|
||||
if last_base_branch:
|
||||
return last_base_branch
|
||||
return default_branch
|
||||
|
||||
def save_last_base_branch(save_branch=None):
|
||||
def save_last_base_branch(base_branch=None):
|
||||
""" save last base branch to config file """
|
||||
def save_config(config_path, item, value):
|
||||
def save_config_item(config_path, item, value):
|
||||
if os.path.exists(config_path):
|
||||
with open(config_path, "r", encoding="utf-8") as f:
|
||||
config = json.load(f)
|
||||
@ -440,7 +440,7 @@ def save_last_base_branch(save_branch=None):
|
||||
with open(config_path, "w", encoding="utf-8") as f:
|
||||
json.dump(config, f, indent=4)
|
||||
|
||||
if not save_branch:
|
||||
if not base_branch:
|
||||
base_branch = get_current_branch()
|
||||
project_config_path = os.path.join(os.getcwd(), ".chat", ".workflow_config.json")
|
||||
save_config(project_config_path, "last_base_branch", base_branch)
|
||||
save_config_item(project_config_path, "last_base_branch", base_branch)
|
||||
|
Loading…
x
Reference in New Issue
Block a user