Skip to content

Instantly share code, notes, and snippets.

@dcai
Last active September 10, 2023 03:51
Show Gist options
  • Save dcai/1071173 to your computer and use it in GitHub Desktop.
Save dcai/1071173 to your computer and use it in GitHub Desktop.
cvs helper for moodle repository
ct (){
if [ $# -eq 0 ]; then
echo "CVS TAG: No arguments entered.";
return 1
else
echo "Tagging [MOODLE_$1_MERGED]";
echo "File(s) ${@:2}";
echo "Tagging ...";
cvs tag -RF MOODLE_$1_MERGED ${@:2}
fi
}
ci (){
if [ $# -eq 0 ]; then
echo "CVS COMMIT: No arguments entered.";
return 1
else
echo "Processing file(s): ${@:2}";
echo "Committing ...";
cvs ci -m "\"$1\"" ${@:2}
fi
}
co () {
cvs co -z3 -d $1 -r MOODLE_$2_STABLE moodle;
}
cm (){
if [ $# -eq 0 ]; then
echo "CVS Merge: No arguments entered.";
return 1
else
echo "MERGED FROM MOODLE_$1_STABLE"
echo "File(s): ${@:2}"
echo "Merging ...";
cvs update -kk -j MOODLE_$1_MERGED -j MOODLE_$1_STABLE ${@:2};
fi
}
cr (){
if [ $# -ne 2 ]; then
echo "CVS Revert: Incorrect arguments entered.";
return 1
else
cvs update -p -r $1 $2 > $2;
fi
}
cu (){
if [ $# -eq 0 ]; then
echo "UPDATING MOODLE HEAD"
cvs -q update -dPA $@;
else
echo "UPDATING MOODLE_$1_STABLE"
echo "File(s): ${@:2}"
cvs -q update -dPA -r MOODLE_$1_STABLE ${@:2};
fi
}
cleanupcvs (){
find . -name "CVS" -type d | xargs rm -rf
}
difflist () {
if [ $# -eq 2 ]; then
cat $1 |grep "\<Index"|awk '{print $2}'|tr -d '\n'
else
cat $1 |grep "\<Index"|awk '{print $2}'
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment