Permalink
Browse files

Show mercurial shelf status in prompt

Should I put this up as a pull request @sjl?
  • Loading branch information...
jlfwong committed May 9, 2012
1 parent e30d393 commit 16ff9758a03a1a06574b8909d9a9cd0ea8302b70
Showing with 12 additions and 1 deletion.
  1. +1 −1 .bash_profile
  2. +11 −0 hg-prompt/prompt.py
View
@@ -25,7 +25,7 @@ function git_ps1
function hg_ps1
{
- hg prompt "({root|basename}@{rev}{ {status}}{>{outgoing}}{<{incoming}}) " 2> /dev/null
+ hg prompt "({root|basename}@{rev}{ {status}{shelf}}{>{outgoing}}{<{incoming}}) " 2> /dev/null
}
PROMPT_COMMAND='bpwd=$(basename `pwd`); echo -ne "\033]0;\007\033k${bpwd}\033\\"'
View
@@ -313,6 +313,16 @@ def _status(m):
return _with_groups(g, flag) if flag else ''
+ def _shelf(m):
+ try:
+ shelves_path = repo.join('shelves')
+ if os.path.exists(shelves_path) and os.listdir(shelves_path):
+ return _with_groups(m.groups(), '[shelved]')
+ else:
+ return ''
+ except KeyError:
+ return ''
+
def _tags(m):
g = m.groups()
@@ -392,6 +402,7 @@ def _update(m):
'rev(\|merge)?': _rev,
'root': _root,
'root\|basename': _basename,
+ 'shelf':_shelf,
'status(?:'
'(\|modified)'
'|(\|unknown)'

0 comments on commit 16ff975

Please sign in to comment.