# HG changeset patch # User Steve Losh # Date 1254344772 14400 # Node ID 8e444c0f0dd9931eb23cd105de30b12aa3508d24 # Parent b60fac62931ea98c2967276f5316331c4d54b396 Make {rev} behave correctly for some corner cases. The {rev} keyword now expands like so: * To nothing, when the working directory has no parent (i.e. when in a freshly init'ed repo or after running 'hg update null'). * To the revision number of the (first) parent of the working directory otherwise. fixes issue 9 diff -r b60fac62931e -r 8e444c0f0dd9 prompt.py --- a/prompt.py Sun Sep 27 10:30:14 2009 -0400 +++ b/prompt.py Wed Sep 30 17:06:12 2009 -0400 @@ -178,11 +178,11 @@ out_g = (g[0],) + (g[-1],) parents = repo[None].parents() - p = 0 if '|merge' not in g else 1 - p = p if len(parents) > p else None + parent = 0 if '|merge' not in g else 1 + parent = parent if len(parents) > parent else None - rev = parents[p].rev() if p is not None else None - return _with_groups(out_g, str(rev)) if rev else '' + rev = parents[parent].rev() if parent is not None else -1 + return _with_groups(out_g, str(rev)) if rev >= 0 else '' def _node(m): g = m.groups()