# HG changeset patch # User Steve Losh # Date 1247570626 14400 # Node ID f0e69918f2f3fbf3662c51d706c4394e6b73bb17 # Parent 95281c1ac8a06d0da43d2c1553378e0188be9f90 Add the root and root|basename keywords. diff -r 95281c1ac8a0 -r f0e69918f2f3 prompt.py --- a/prompt.py Tue Jul 14 07:12:19 2009 -0400 +++ b/prompt.py Tue Jul 14 07:23:46 2009 -0400 @@ -9,6 +9,7 @@ ''' import re +from os import path from mercurial import extensions def _with_groups(m, out): @@ -68,12 +69,20 @@ except KeyError: return '' + def _root(m): + return _with_groups(m, repo.root) if repo.root else '' + + def _basename(m): + return _with_groups(m, path.basename(repo.root)) if repo.root else '' + tag_start = r'\{([^{}]*?\{)?' tag_end = r'(\}[^{}]*?)?\}' patterns = { 'branch': _branch, 'status': _status, 'bookmark': _bookmark, + 'root': _root, + 'root\|basename': _basename, } for tag, repl in patterns.items():