summaryrefslogtreecommitdiff
path: root/git-compiz
diff options
context:
space:
mode:
authoromega <marco.biasco@gmail.com>2009-03-27 19:34:00 +0100
committeromega <marco.biasco@gmail.com>2009-03-27 19:34:00 +0100
commitcf6a84b06d8cc978dc86ebd02187ae9274e81e7c (patch)
tree5c3fdf3da1e52753e03f803321062703defa4695 /git-compiz
parent6f5ba000872311b2126e0bd91cdc95fc0b3d615b (diff)
downloadscripts-cf6a84b06d8cc978dc86ebd02187ae9274e81e7c.tar.gz
scripts-cf6a84b06d8cc978dc86ebd02187ae9274e81e7c.tar.bz2
Added new feature --undo (restore version before last commit)
Diffstat (limited to 'git-compiz')
-rwxr-xr-xgit-compiz10
1 files changed, 9 insertions, 1 deletions
diff --git a/git-compiz b/git-compiz
index 7868acb..ddb7a08 100755
--- a/git-compiz
+++ b/git-compiz
@@ -281,6 +281,10 @@ for singlearg in $ARGS_SCRIPT; do
--skip-build)
NOBUILD="yes"
;;
+ --undo=*)
+ FORCE_REBUILT=`get_arg --undo=`
+ UNDO_LAST_UPDATE="yes"
+ ;;
*)
echo "$ERROR_INVALID_OPTION $singlearg";
exit 1
@@ -384,7 +388,7 @@ if [ -d $b -o -d $b-http ]; then
mv $orig `echo $orig | sed 's,.orig,,'` >/dev/null
done
fi
- if [ "$SKIP_UPDATE" != "true" -a -z "`echo $b | grep -e tar.bz2 -e tar.gz -e zip`" ]; then
+ if [ "$SKIP_UPDATE" != "true" -a $UNDO_LAST_UPDATE != "yes" -a -z "`echo $b | grep -e tar.bz2 -e tar.gz -e zip`" ]; then
printinfo info "${INFO_UPDATE//%s/$b}";
logcmd echo
git pull | grep -q "Already up-to-date."
@@ -397,6 +401,10 @@ if [ -d $b -o -d $b-http ]; then
logcmd git checkout -b $(echo $GIT_BRANCH | sed 's|.*/||g') --track $GIT_BRANCH
fi
cd $here
+ elif [ "$UNDO_LAST_UPDATE" == "yes" -a -z "`echo $b | grep -e tar.bz2 -e tar.gz -e zip`" ]; then
+ printinfo info "${INFO_UNDO//%s/$b}";
+ logcmd echo
+ git reset --hard HEAD^ &>/dev/null
fi
cd $here
else