# HG changeset patch # User Goffi # Date 1647964842 -3600 # Node ID 0a87cae857465ef295f429b1f2d32dd410e63818 # Parent ffa8c8c78115532430996031c2b5ce3582116d5f tools (utils): fix `getRepositoryData` crash: - use `hg_path` to be sure to use the right executable - better exception handling diff -r ffa8c8c78115 -r 0a87cae85746 sat/tools/utils.py --- a/sat/tools/utils.py Tue Mar 22 17:00:42 2022 +0100 +++ b/sat/tools/utils.py Tue Mar 22 17:00:42 2022 +0100 @@ -227,7 +227,8 @@ try: hg_data_raw = subprocess.check_output( [ - "hg", + "python3", + hg_path, "log", "-r", "-1", @@ -241,12 +242,16 @@ ], 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: