Guest User

Untitled

a guest
Sep 24th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. # SVN override to prevent commits that try to implicitly commit more than one file.
  2. # Has weaned me off of svn ci -m very effectively. I now almost always use svn ci,
  3. # which usually results in me writing longer and more helpful commit messages.
  4. # Also, it prevents me from committing unrelated code, so there's that.
  5. #
  6. # Also checks for error_log, var_dump, and console.log, and rejects these commits.
  7.  
  8. function svn() {
  9. if [ "$1" == "ci" ] && [ "$2" == "-m" ] && [ -z "$4" ] && [ "$(svn stat --ignore-externals | grep '^[^?X]' | wc -l | awk '{print $1}')" -gt 1 ]; then
  10. svn stat --ignore-externals | grep '^[^?X]'
  11. echo ""
  12. echo $3
  13. echo ""
  14. echo "Unbounded commit... What are you doing, man?"
  15. return
  16. elif [ "$1" == "ci" ] && [ "$(svn diff | grep -E '^\+.*(error_log|var_dump|console\.log)' | wc -l | awk '{print $1}')" -gt 0 ]; then
  17. echo "You left in some debug cruft."
  18. return
  19. fi
  20. /usr/bin/svn "$@"
  21. }
Add Comment
Please, Sign In to add comment