mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 01:07:45 +01:00
Accept change as proposed by black. (#2055)
This commit is contained in:
parent
10a6e9b4ee
commit
caa651e55b
1 changed files with 7 additions and 5 deletions
|
@ -109,9 +109,9 @@ def _compute_destination_path(key: str) -> Path:
|
|||
return base_dir / h.hexdigest()[:8]
|
||||
|
||||
|
||||
def _run_git_command(cmd):
|
||||
def _run_git_command(cmd, cwd=None):
|
||||
try:
|
||||
ret = subprocess.run(cmd, capture_output=True, check=False)
|
||||
ret = subprocess.run(cmd, cwd=cwd, capture_output=True, check=False)
|
||||
except FileNotFoundError as err:
|
||||
raise cv.Invalid(
|
||||
"git is not installed but required for external_components.\n"
|
||||
|
@ -151,14 +151,16 @@ def _process_git_config(config: dict, refresh) -> str:
|
|||
_LOGGER.info("Updating %s", key)
|
||||
_LOGGER.debug("Location: %s", repo_dir)
|
||||
# Stash local changes (if any)
|
||||
_run_git_command(["git", "stash", "push", "--include-untracked"])
|
||||
_run_git_command(
|
||||
["git", "stash", "push", "--include-untracked"], str(repo_dir)
|
||||
)
|
||||
# Fetch remote ref
|
||||
cmd = ["git", "fetch", "--", "origin"]
|
||||
if CONF_REF in config:
|
||||
cmd.append(config[CONF_REF])
|
||||
_run_git_command(cmd)
|
||||
_run_git_command(cmd, str(repo_dir))
|
||||
# Hard reset to FETCH_HEAD (short-lived git ref corresponding to most recent fetch)
|
||||
_run_git_command(["git", "reset", "--hard", "FETCH_HEAD"])
|
||||
_run_git_command(["git", "reset", "--hard", "FETCH_HEAD"], str(repo_dir))
|
||||
|
||||
if (repo_dir / "esphome" / "components").is_dir():
|
||||
components_dir = repo_dir / "esphome" / "components"
|
||||
|
|
Loading…
Reference in a new issue