# HG changeset patch # User Jeffrey Gelens # Date 1392038044 -3600 # Node ID 1cb3af183d2f692622f84da88d5ca18bd4f91b1f # Parent 661dbd42f386611a1c03f3eaf82927d3f1b874d8 Fix for Mercurial 2.9 (issue #33) diff -r 661dbd42f386 -r 1cb3af183d2f prompt.py --- 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"):