# HG changeset patch # User Steve Losh # Date 1278355851 14400 # Node ID 43b7fb82d9a0c41ec8489c6763226778ab30e3dd # Parent 34e96de049abe0a2585e4f819584443ee1c3d60e Add the {closed} keyword. diff -r 34e96de049ab -r 43b7fb82d9a0 docs/wiki/documentation/keywords/index.mdown --- a/docs/wiki/documentation/keywords/index.mdown Tue Jun 22 18:16:29 2010 -0400 +++ b/docs/wiki/documentation/keywords/index.mdown Mon Jul 05 14:50:51 2010 -0400 @@ -1,11 +1,13 @@ Keywords ======== -There a number of keywords available. If you have any suggestions for more please [let me know][issues]. +There a number of keywords available. If you have any suggestions for more +please [let me know][issues]. [issues]: http://bitbucket.org/sjl/issues -Some of the keywords support filters. These filters can be combined when it makes sense. If in doubt, try it! +Some of the keywords support filters. These filters can be combined when it +makes sense. If in doubt, try it! [TOC] @@ -18,6 +20,10 @@ |quiet : Display the current branch only if it is not the default branch. +##closed## +: Display `X` if working on a closed branch (i.e. if committing now would + reopen the branch). + ##count## : Display the number of revisions in the given revset (the revset `all()` will be used if none is given). diff -r 34e96de049ab -r 43b7fb82d9a0 prompt.py --- a/prompt.py Tue Jun 22 18:16:29 2010 -0400 +++ b/prompt.py Mon Jul 05 14:50:51 2010 -0400 @@ -103,6 +103,20 @@ return _with_groups(g, out) if out else '' + def _closed(m): + g = m.groups() + + quiet = _get_filter('quiet', g) + + p = repo[None].parents()[0] + pn = p.node() + branch = repo.dirstate.branch() + closed = (p.extra().get('close') + and pn in repo.branchheads(branch, closed=True)) + out = 'X' if (not quiet) and closed else '' + + return _with_groups(g, out) if out else '' + def _status(m): g = m.groups() @@ -311,6 +325,7 @@ 'bookmark': _bookmark, 'branch(\|quiet)?': _branch, 'count(\|[^%s]*?)?' % brackets[-1]: _count, + 'closed(\|quiet)?': _closed, 'node(?:' '(\|short)' '|(\|merge)' @@ -405,6 +420,10 @@ |quiet Display the current branch only if it is not the default branch. +closed + Display `X` if working on a closed branch (i.e. committing now would reopen + the branch). + count Display the number of revisions in the given revset (the revset `all()` will be used if none is given).