1cb3af183d2f

Fix for Mercurial 2.9 (issue #33)
[view raw] [browse files]
author Jeffrey Gelens <jeffrey@gelens.org>
date Mon, 10 Feb 2014 14:14:04 +0100
parents 661dbd42f386
children 869146b8b9fb 046811b7cb2d
branches/tags (none)
files prompt.py

Changes

--- a/prompt.py	Wed Mar 14 17:13:42 2012 -0400
+++ b/prompt.py	Mon Feb 10 14:14:04 2014 +0100
@@ -344,13 +344,23 @@
         return _with_groups(g, str(tip)) if rev >= 0 else ''
 
     def _update(m):
-        if not repo.branchtags():
+        current_rev = repo[None].parents()[0]
+
+        # Get the tip of the branch for the current branch
+        try:
+            heads = repo.branchmap()[current_rev.branch()]
+            tip = heads[-1]
+        except (KeyError, IndexError):
             # We are in an empty repository.
+
             return ''
 
-        current_rev = repo[None].parents()[0]
-        to = repo[repo.branchtags()[current_rev.branch()]]
-        return _with_groups(m.groups(), '^') if current_rev != to else ''
+        for head in reversed(heads):
+            if not repo[head].closesbranch():
+                tip = head
+                break
+
+        return _with_groups(m.groups(), '^') if current_rev != repo[tip] else ''
 
 
     if opts.get("angle_brackets"):