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
author |
Steve Losh <steve@stevelosh.com> |
date |
Wed, 30 Sep 2009 17:06:12 -0400 |
parents |
b60fac62931e
|
children |
859cab1100e5
|
branches/tags |
(none) |
files |
prompt.py |
Changes
--- 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()