Some cleanup for qapplied/qparent

Add some missing quoting, use rev-parse to get the branch rather than
passing git-branch output to sed
Check that origin/master exists before using it

And warn if no upstream is found, so the subsequent git errors make more
sense