From 186c0eafdac0adfc75905026368f8f04d6f8da05 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Wed, 25 Dec 2019 19:24:23 +0530 Subject: [PATCH] feat: auto-stash changes in bench (tool) on update --- bench/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bench/utils.py b/bench/utils.py index 192ea5a0..74aeeabc 100755 --- a/bench/utils.py +++ b/bench/utils.py @@ -275,7 +275,11 @@ def update_bench(bench_repo=True, requirements=True): cwd = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) if bench_repo: - exec_cmd("git pull", cwd=cwd) + try: + exec_cmd("git pull", cwd=cwd) + except bench.utils.CommandFailedError: + exec_cmd("git stash", cwd=cwd) + logger.info("Stashing changes made at {}\nUse git stash apply to recover changes after the successful update!".format(cwd)) if requirements: update_bench_requirements()