# HG changeset patch # User pjv # Date 1248315811 18000 # Node ID a62c8ab6c87fdb26c6fd229b8c74f15fc1045ffe # Parent 923467766eba973080d54ba74c66d388c77ddf21 added task keyword diff -r 923467766eba -r a62c8ab6c87f prompt.py --- a/prompt.py Thu Jul 16 16:54:49 2009 -0400 +++ b/prompt.py Wed Jul 22 21:23:31 2009 -0500 @@ -1,5 +1,8 @@ #!/usr/bin/env python +# Uncomment next line if using python 2.5x +from __future__ import with_statement + '''get repository information for use in a shell prompt Take a string, parse any special variables inside, and output the result. @@ -107,6 +110,13 @@ except KeyError: return '' + def _task(m): + try: + task = extensions.find('tasks').current(repo) + return _with_groups(m.groups(), task) if task else '' + except KeyError: + return '' + def _root(m): return _with_groups(m.groups(), repo.root) if repo.root else '' @@ -149,6 +159,7 @@ 'branch': _branch, 'status': _status, 'bookmark': _bookmark, + 'task': _task, 'root': _root, 'root\|basename': _basename, 'incoming(\|count)?': _remote('incoming'), @@ -172,4 +183,4 @@ ('', 'cache-outgoing', None, 'used internally by hg-prompt'), ], 'hg prompt STRING') -} \ No newline at end of file +}