tools (utils): fix getRepositoryData crash:
- use `hg_path` to be sure to use the right executable - better exception handling
This commit is contained in:
parent
0112d503ff
commit
3ee5e1bbba
1 changed files with 8 additions and 3 deletions
|
|
@ -227,7 +227,8 @@ def getRepositoryData(module, as_string=True, is_path=False):
|
|||
try:
|
||||
hg_data_raw = subprocess.check_output(
|
||||
[
|
||||
"hg",
|
||||
"python3",
|
||||
hg_path,
|
||||
"log",
|
||||
"-r",
|
||||
"-1",
|
||||
|
|
@ -241,12 +242,16 @@ def getRepositoryData(module, as_string=True, is_path=False):
|
|||
],
|
||||
text=True
|
||||
)
|
||||
except subprocess.CalledProcessError:
|
||||
except subprocess.CalledProcessError as e:
|
||||
log.error(f"Can't get repository data: {e}")
|
||||
hg_data = {}
|
||||
except Exception as e:
|
||||
log.error(f"Unexpected error, can't get repository data : [{type(e)}] {e}")
|
||||
hg_data = {}
|
||||
else:
|
||||
hg_data = dict(list(zip(KEYS, hg_data_raw.split("\n"))))
|
||||
try:
|
||||
hg_data["modified"] = "+" in subprocess.check_output(["hg", "id", "-i"], text=True)
|
||||
hg_data["modified"] = "+" in subprocess.check_output(["python3", hg_path, "id", "-i"], text=True)
|
||||
except subprocess.CalledProcessError:
|
||||
pass
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue