From 5e2b6d05c9fa3ae6ef9565fdd3ec268d0157cfc7 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Date: Sat, 27 Jul 2013 16:43:48 +0200 Subject: Extended the p function so it also supports hg and svn --- bashrc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'bashrc') diff --git a/bashrc b/bashrc index 152c56f..3fb9a79 100644 --- a/bashrc +++ b/bashrc @@ -80,6 +80,8 @@ export PATCH=$HOME/.patches # already exists, it will ask if the user wants to overwrite it. p() { path="$PATCH/$1.patch" + + # The patch file already exists. if [ -f $path ]; then echo "The patch \`$1' already exists." read -p "Do you want to overwrite its contents ? (Y/n) " yn @@ -87,5 +89,15 @@ p() { n | N | no | NO ) exit 1 esac fi - git diff > $path + + # Choose the proper SCM tool. + if [ -d .git ]; then + git diff > $path + elif [ -d .hg ]; then + hg diff > $path + elif [ -d .svn ]; then + svn diff > $path + else + echo 'Unsupported SCM.' + fi } -- cgit v1.2.3