Created
August 22, 2014 19:39
-
-
Save jimjam88/84bff0209c214b519388 to your computer and use it in GitHub Desktop.
Mercurial branch in command prompt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function hg_in_repo() { | |
| hg branch 2> /dev/null | awk '{print "on "}' | |
| } | |
| function hg_dirty() { | |
| hg status --no-color 2> /dev/null \ | |
| | awk '$1 == "?" { print "?" } $1 != "?" { print "!" }' \ | |
| | sort | uniq | head -c1 | |
| } | |
| function hg_branch() { | |
| hg branch 2> /dev/null | awk '{print $1}' | |
| } | |
| function hg_prompt() { | |
| hg branch 2> /dev/null > /dev/null && echo "($(hg_branch)$(hg_dirty))" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment