573d984e647a — Joe Ulfers 2 years ago
Dry status check failures
1 files changed, 8 insertions(+), 15 deletions(-)

M deploy.sh
M deploy.sh +8 -15
@@ 1,22 1,15 @@ 
 #!/bin/bash
 set -eo pipefail
 
-if [[ -n $(hg stat) ]]; then
-  echo "Error: uncommitted changes" >&2
-  exit 1
-fi
-if [[ "$(hg branch)" != "default" ]]; then
-  echo "Error: not default branch" >&2
+function fail {
+  echo $1 >&2
   exit 1
-fi
-if hg --pager '' outgoing; then
-  echo "Error: outgoing changes" >&2
-  exit 1
-fi
-if hg --pager '' incoming; then
-  echo "Error: outgoing changes" >&2
-  exit 1
-fi
+}
+
+if [[ -n $(hg stat) ]]; then fail "Error: uncommitted changes"; fi
+if [[ "$(hg branch)" != "default" ]]; then fail "Error: not default branch"; fi
+if hg --pager '' outgoing; then fail "Error: outgoing changes"; fi
+if hg --pager '' incoming; then fail "Error: incoming changes"; fi
 
 ssh -T root@qwertywar.com << PRE
   set -eo pipefail