4 alias hgca='hg commit --amend'
5 alias hgci='hg commit --interactive'
7 alias hgba='hg branches'
8 alias hgbk='hg bookmarks'
9 alias hgco='hg checkout'
11 alias hged='hg diffmerge'
14 alias hgsl='hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|person}: {desc|strip|firstline}\n" '
15 alias hgun='hg resolve --list'
17 alias hgi='hg incoming'
18 alias hgl='hg pull -u'
19 alias hglr='hg pull --rebase'
20 alias hgo='hg outgoing'
21 alias hglg='hg log --stat -v'
22 alias hglgp='hg log --stat -p -v'
25 hg incoming "$@" | grep "changeset" | wc -l
29 hg outgoing "$@" | grep "changeset" | wc -l
35 while [[ "$dir" != "/" ]]; do
36 if [[ -d "$dir/.hg" ]]; then
49 function hg_get_branch_name() {
51 if ! dir=$(hg_root); then
55 if [[ ! -f "$dir/.hg/branch" ]]; then
60 echo "$(<"$dir/.hg/branch")"
63 function hg_get_bookmark_name() {
65 if ! dir=$(hg_root); then
69 if [[ ! -f "$dir/.hg/bookmarks.current" ]]; then
73 echo "$(<"$dir/.hg/bookmarks.current")"
76 function hg_prompt_info {
77 local dir branch dirty
78 if ! dir=$(hg_root); then
82 if [[ ! -f "$dir/.hg/branch" ]]; then
85 branch="$(<"$dir/.hg/branch")"
90 echo "${ZSH_THEME_HG_PROMPT_PREFIX}${branch:gs/%/%%}${dirty}${ZSH_THEME_HG_PROMPT_SUFFIX}"
94 # Do nothing if clean / dirty settings aren't defined
95 if [[ -z "$ZSH_THEME_HG_PROMPT_DIRTY" && -z "$ZSH_THEME_HG_PROMPT_CLEAN" ]]; then
99 # Check if there are modifications
101 if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" = true ]]; then
102 if ! hg_status="$(hg status -q 2>/dev/null)"; then
106 if ! hg_status="$(hg status 2>/dev/null)"; then
111 # grep exits with 0 when dirty
112 if command grep -Eq '^\s*[ACDIMR!?L].*$' <<< "$hg_status"; then
113 echo $ZSH_THEME_HG_PROMPT_DIRTY
117 echo $ZSH_THEME_HG_PROMPT_CLEAN