aboutsummaryrefslogtreecommitdiff
path: root/bashrc
diff options
context:
space:
mode:
authorMiquel Sabaté <mikisabate@gmail.com>2013-07-27 16:43:48 +0200
committerMiquel Sabaté <mikisabate@gmail.com>2013-07-27 16:43:48 +0200
commit5e2b6d05c9fa3ae6ef9565fdd3ec268d0157cfc7 (patch)
tree24150cc21e4fc9d0107dad3e2c717f49a7205d15 /bashrc
parent20d37e60f9c42718e4f09d347888dda3a3208b7d (diff)
downloaddotfiles-5e2b6d05c9fa3ae6ef9565fdd3ec268d0157cfc7.tar.gz
dotfiles-5e2b6d05c9fa3ae6ef9565fdd3ec268d0157cfc7.zip
Extended the p function so it also supports hg and svn
Diffstat (limited to 'bashrc')
-rw-r--r--bashrc14
1 files changed, 13 insertions, 1 deletions
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
}