# HG changeset patch # User Steve Losh # Date 1257713453 18000 # Node ID e1c8340a2a3a0dac524c6da7f649af471b4ff206 # Parent ce8ef31a90efc5f1121e734b7b6457faf381b9d3 Add a {tip} keyword. diff -r ce8ef31a90ef -r e1c8340a2a3a prompt.py --- a/prompt.py Sun Oct 04 01:24:35 2009 -0500 +++ b/prompt.py Sun Nov 08 15:50:53 2009 -0500 @@ -211,6 +211,16 @@ rev = parents[parent].rev() if parent is not None else -1 return _with_groups(out_g, str(rev)) if rev >= 0 else '' + def _tip(m): + g = m.groups() + out_g = (g[0],) + (g[-1],) + + format = short if '|short' in g else hex + + tip = repo[len(repo) - 1] + tip = format(tip.node()) if '|node' in g else tip.rev() + + return _with_groups(out_g, str(tip)) if tip >= 0 else '' def _node(m): g = m.groups() @@ -268,6 +278,7 @@ 'status(?:(\|modified)|(\|unknown))*': _status, 'tags(\|[^}]*)?': _tags, 'task': _task, + 'tip(?:(\|node)|(\|short))*?': _tip, 'update': _update, 'incoming(\|count)?': _remote('incoming'),