From 1d863eb14f652eafd2d283c7a3474b636da97423 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Fri, 11 Jul 2008 14:03:05 -0400 Subject: [PATCH] cmd_switch: show failure message from read-tree If read-tree fails the user will need to see the failure message in order to take corrective action. --- yap/yap.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/yap/yap.py b/yap/yap.py index f075720..8c1ad66 100644 --- a/yap/yap.py +++ b/yap/yap.py @@ -655,7 +655,8 @@ of history. idx = get_output("git write-tree") new = get_output("git rev-parse refs/heads/%s" % branch) - run_safely("git read-tree --aggressive -u -m HEAD %s %s" % (idx[0], new[0])) + if os.system("git read-tree --aggressive -u -m HEAD %s %s" % (idx[0], new[0])): + raise YapError("Failed to switch") run_safely("git symbolic-ref HEAD refs/heads/%s" % branch) if not staged: @@ -701,7 +702,7 @@ operation in spite of this. run_safely("git read-tree -u -m HEAD") except ShellError: run_safely("git read-tree HEAD") - run_safely("git checkout-index -u -f -a") + run_safely("git checkout-index -u -f -a") @short_help("alter history by dropping or amending commits") @long_help(""" -- 2.11.4.GIT