firstpush 595 B

12345678910111213141516171819202122232425262728
  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 HEAD:$BRANCH
  15. OPEN=$( which gnome-open xdg-open open | head -n1 )
  16. URL="https://github.com/$FORK/$REPO/commits/$BRANCH"
  17. if [ -z "$OPEN" ]; then
  18. echo "Can't find a tool to open the URL:"
  19. echo $URL
  20. else
  21. echo "Viewing commits on $BRANCH..."
  22. "$OPEN" "$URL"
  23. fi