272a76c50002

Fix a possible edge-case bug with {tip}.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sun, 08 Nov 2009 15:52:58 -0500
parents e1c8340a2a3a
children 342f1099aabc
branches/tags (none)
files prompt.py

Changes

--- a/prompt.py	Sun Nov 08 15:50:53 2009 -0500
+++ b/prompt.py	Sun Nov 08 15:52:58 2009 -0500
@@ -211,6 +211,7 @@
         
         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],)
@@ -218,9 +219,10 @@
         format = short if '|short' in g else hex
         
         tip = repo[len(repo) - 1]
+        rev = tip.rev()
         tip = format(tip.node()) if '|node' in g else tip.rev()
         
-        return _with_groups(out_g, str(tip)) if tip >= 0 else ''
+        return _with_groups(out_g, str(tip)) if rev >= 0 else ''
     
     def _node(m):
         g = m.groups()