# HG changeset patch # User Steve Losh # Date 1259347204 18000 # Node ID 8539689091cfd9238acfdd4c885448196293c621 # Parent d93fe1c921f9b032f711ea5c98fd9b2e691379e7 Replace the any* and nondefault filters with a quiet filter. diff -r d93fe1c921f9 -r 8539689091cf docs/wiki/documentation/keywords/index.mdown --- a/docs/wiki/documentation/keywords/index.mdown Fri Nov 27 13:24:49 2009 +0100 +++ b/docs/wiki/documentation/keywords/index.mdown Fri Nov 27 13:40:04 2009 -0500 @@ -14,6 +14,9 @@ ##branch## : Display the current branch. + + |quiet + : Display the current branch only if it is not the default branch. ##incoming## : Display nothing, but if the default path contains incoming changesets the @@ -64,6 +67,9 @@ |unapplied : Display the number of currently unapplied patches in the queue. + + |quiet + : Display a number only if there are any patches in the queue. ##patches## : Display a list of the current patches in the queue. It will look like diff -r d93fe1c921f9 -r 8539689091cf prompt.py --- a/prompt.py Fri Nov 27 13:24:49 2009 +0100 +++ b/prompt.py Fri Nov 27 13:40:04 2009 -0500 @@ -94,12 +94,9 @@ out_g = (g[0],) + (g[-1],) branch = repo.dirstate.branch() - out = '' - if '|nondefault' in g: - if (branch != 'default'): - out = branch - else: - out = branch + quiet = _get_filter('quiet', g) + + out = branch if (not quiet) or (branch != 'default') else '' return _with_groups(out_g, out) if out else '' @@ -155,26 +152,18 @@ return '' q = repo.mq - out = '' - if '|applied' in g: + + if _get_filter('quiet', g) and not len(q.series): + return '' + + if _get_filter('applied', g): out = str(len(q.applied)) - elif '|unapplied' in g: + elif _get_filter('unapplied', g): out = str(len(q.unapplied(repo))) - elif '|count' in g: + elif _get_filter('count', g): out = str(len(q.series)) - elif '|anyapplied' in g: - if (len(q.series) > 0): - out = str(len(q.applied)) - elif '|anyunapplied' in g: - if (len(q.series) > 0): - out = str(len(q.unapplied(repo))) - elif '|anycount' in g: - if (len(q.series) > 0): - out = str(len(q.series)) else: - applied = q.applied - if applied: - out = applied[-1].name + out = q.applied[-1].name if q.applied else '' return _with_groups(out_g, out) if out else '' @@ -308,7 +297,7 @@ tag_end = r'(\}[^{}]*?)?\}' patterns = { 'bookmark': _bookmark, - 'branch(\|nondefault)?': _branch, + 'branch(\|quiet)?': _branch, 'node(?:' '(\|short)' '|(\|merge)' @@ -317,10 +306,8 @@ '(\|applied)' '|(\|unapplied)' '|(\|count)' - '|(\|anyapplied)' - '|(\|anyunapplied)' - '|(\|anycount)' - ')?': _patch, + '|(\|quiet)' + ')*': _patch, 'patches(?:' '(\|join\(.*?\))' '|(\|reverse)' @@ -401,8 +388,8 @@ branch Display the current branch. - |nondefault - Display the current branch if it is not the default branch. + |quiet + Display the current branch only if it is not the default branch. incoming Display nothing, but if the default path contains incoming changesets the @@ -454,17 +441,8 @@ |unapplied Display the number of currently unapplied patches in the queue. - |anycount - Display the number of patches in the queue if there are patches - present. - - |anyapplied - Display the number of currently applied patches in the queue if there - are patches present. - - |anyunapplied - Display the number of currently unapplied patches in the queue if - there are patches present. + |quiet + Display a number only if there are any patches in the queue. patches Display a list of the current patches in the queue. It will look like