# HG changeset patch # User Steve Losh # Date 1259110855 18000 # Node ID 213be62d55e29f438d8ee979293033cf1cdd9463 # Parent 89912d294ece147fc2898a60e9bf60075a6d13ee Add the post and pre filters for patches. diff -r 89912d294ece -r 213be62d55e2 prompt.py --- a/prompt.py Tue Nov 24 19:50:03 2009 -0500 +++ b/prompt.py Tue Nov 24 20:00:55 2009 -0500 @@ -242,6 +242,28 @@ if _get_filter('reverse', g): patches = reversed(patches) + pre_applied_filter = _get_filter('pre_applied', g) + pre_applied_filter_arg = _get_filter_arg(pre_applied_filter) + post_applied_filter = _get_filter('post_applied', g) + post_applied_filter_arg = _get_filter_arg(post_applied_filter) + + pre_unapplied_filter = _get_filter('pre_unapplied', g) + pre_unapplied_filter_arg = _get_filter_arg(pre_unapplied_filter) + post_unapplied_filter = _get_filter('post_unapplied', g) + post_unapplied_filter_arg = _get_filter_arg(post_unapplied_filter) + + for n, patch in enumerate(patches): + if patch in applied: + if pre_applied_filter: + patches[n] = pre_applied_filter_arg + patches[n] + if post_applied_filter: + patches[n] = patches[n] + post_applied_filter_arg + elif patch in unapplied: + if pre_unapplied_filter: + patches[n] = pre_unapplied_filter_arg + patches[n] + if post_unapplied_filter: + patches[n] = patches[n] + post_unapplied_filter_arg + return _with_groups(out_g, sep.join(patches)) if patches else '' def _root(m): @@ -340,6 +362,10 @@ '|(\|reverse)' '|(\|hide_applied)' '|(\|hide_unapplied)' + '|(\|pre_applied\(.*?\))' + '|(\|post_applied\(.*?\))' + '|(\|pre_unapplied\(.*?\))' + '|(\|post_unapplied\(.*?\))' ')*': _patches, 'rev(\|merge)?': _rev, 'root': _root,