summaryrefslogtreecommitdiff
path: root/librecommit
diff options
context:
space:
mode:
Diffstat (limited to 'librecommit')
-rwxr-xr-xlibrecommit54
1 files changed, 28 insertions, 26 deletions
diff --git a/librecommit b/librecommit
index 9444bd9..d3ddbff 100755
--- a/librecommit
+++ b/librecommit
@@ -2,21 +2,21 @@
# Copyright 2010 Nicolás Reynolds
# ---------- GNU General Public License 3 ----------
-
-# This file is part of Parabola.
-
-# Parabola is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# Parabola is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
+
+# This file is part of Parabola.
+
+# Parabola is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# Parabola is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
source /etc/libretools.conf
@@ -27,36 +27,38 @@ usage () {
echo
echo "This script commits the package using name, pkgver an pkgver"
echo
+ exit 1
}
-msg='Commiting libre package $pkg-$pkgver-$pkgrel'
-files=""
+msg="Commiting libre package \"\$pkg-\$pkgver-\$pkgrel\""
for opt in $@ ; do
case ${opt} in
- h) usage ;;
- m) msg=${OPTARG} ;;
- *) files+="${opt} " ;;
+ -h) usage ;;
+ -m) shift; msg=${1}; shift ;;
+ *) files+="${1} " ; shift ;;
esac
done
-if [ ! -e PKGBUILD ]; then exit 1; fi
+if [ ! -e PKGBUILD -o -z "$files" ]; then usage; fi
source PKGBUILD
pkg=${pkgbase:-${pkgname}}
-if [ ${COMMITCD} = 'git' ]; then
+msg=$(eval echo $msg)
+
+if [ "$COMMITCMD" = 'git' ]; then
- ${COMMITCD} add $@ && ${COMMITCD} -m ""
+ ${COMMITCMD} add ${files} && ${COMMITCMD} commit -m "$(echo $msg)"
-elif [ ${COMMITCD} = 'hg' ]; then
+elif [ "$COMMITCMD" = 'hg' ]; then
- ${COMMITCMD} commit $@ -m -v || exit 1
+ ${COMMITCMD} commit ${files} -m "$msg" -v || exit 1
else
- error "COMMITCD is not correctly set on libretools.conf"
+ error "COMMITCMD is not correctly set on libretools.conf"
fi