Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 29th, 2012  |  syntax: None  |  size: 0.99 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2. #
  3. # A kind of an alias support for the Perforce p4.
  4. #
  5. # This one aliases "interchanges" and "changes" commands to be printed out nicely in format:
  6. #
  7. #   Change <change_no> on <date> by <user>@<workspace> [<status>]
  8. #       <first line of change description>
  9. #       --
  10. #   Change <change_no> on <date> by <user>@<workspace> [<status>]
  11. #       <first line of change description>
  12. #       --
  13. #   ...
  14. #
  15. # The alias works by checking the first arugument. If it's "interchanges" or
  16. # "changes", then the we pass all the remaining arguments to the real p4 and
  17. # then format the output.
  18. #
  19. # In all other cases we invoke real p4 and pass all arguments as-is.
  20. #
  21. # To use this instead of the real p4, add this line to .bashrc:
  22. #
  23. # alias p4='<path_to_p4x.sh'
  24. #
  25. if [ $# -eq 1 ]
  26. then
  27.     \p4
  28. elif [ "$1" == "interchanges" -o "$1" == "changes" ]
  29. then
  30.     command=$1
  31.     shift
  32.     # Note: don't quote $*, it doesn't work with p4
  33.     \p4 $command -l $* | grep -A2 -e '^Change' | grep -v '^$'
  34. else
  35.     \p4 "$*"
  36. fi