firstpush 663 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env bash
  2. #
  3. # firstpush
  4. #
  5. # Push a branch to 'origin' and open the
  6. # commit log to watch Travis CI progress.
  7. #
  8. [[ $# == 0 ]] || { echo "usage: `basename $0`" 1>&2 ; exit 1; }
  9. MFINFO=$(mfinfo) || exit 1
  10. IFS=' ' read -a INFO <<< "$MFINFO"
  11. FORK=${INFO[1]}
  12. REPO=${INFO[2]}
  13. BRANCH=${INFO[5]}
  14. git push --set-upstream origin $BRANCH
  15. which xdg-open >/dev/null && TOOL=xdg-open
  16. which gnome-open >/dev/null && TOOL=gnome-open
  17. which open >/dev/null && TOOL=open
  18. URL="https://github.com/$FORK/$REPO/commits/$BRANCH"
  19. if [ -z "$OPEN" ]; then
  20. echo "Can't find a tool to open the URL:"
  21. echo $URL
  22. else
  23. echo "Viewing commits on $BRANCH..."
  24. "$OPEN" "$URL"
  25. fi