From be45dcad9491e809d13145baab5e6ea1caf80791 Mon Sep 17 00:00:00 2001 From: Næþ'n Lasseter Date: Thu, 25 Aug 2016 14:22:29 +0100 Subject: Initial Commit --- incoming/pre-local/01-hg-pull | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 incoming/pre-local/01-hg-pull (limited to 'incoming/pre-local/01-hg-pull') diff --git a/incoming/pre-local/01-hg-pull b/incoming/pre-local/01-hg-pull new file mode 100755 index 0000000..bbc9336 --- /dev/null +++ b/incoming/pre-local/01-hg-pull @@ -0,0 +1,20 @@ +#!/bin/bash + +function pull_and_update_repo { + hg pull --update +} + +function test_if_working_directory_clean { + hg status --all 2>&1 | egrep -v '^C' > /dev/null || pull_and_update_repo +} + +function test_if_in_repo_root { + [ -d .hg ] && test_if_working_directory_clean +} + +function test_if_hg_repo { + hg status 2>&1 | grep 'abort: no repository found' > /dev/null || test_if_in_repo_root +} + +test_if_hg_repo +exit 0 -- cgit v1.2.3