--- a/hgext/obsolete.py Thu Aug 23 12:23:34 2012 +0200
+++ b/hgext/obsolete.py Thu Aug 23 03:14:03 2012 +0200
@@ -589,6 +589,18 @@
node = repo.revs('last((.:: and branch(%s)) - hidden())', branch)[0]
return orig(repo, node, *args, **kwargs)
+@eh.wrapfunction(localrepo.localrepository, 'branchtip')
+def obsbranchtip(orig, repo, branch):
+ """ensure "stable" reference does not end on a hidden changeset"""
+ result = ()
+ heads = repo.branchmap().get(branch, ())
+ if heads:
+ result = list(repo.set('last(heads(branch(%n) - hidden()))', heads[0]))
+ if not result:
+ raise error.RepoLookupError(_("unknown branch '%s'") % branch)
+ return result[0].node()
+
+
#####################################################################
### Additional Utilities ###
#####################################################################
--- a/tests/test-obsolete.t Thu Aug 23 12:23:34 2012 +0200
+++ b/tests/test-obsolete.t Thu Aug 23 03:14:03 2012 +0200
@@ -446,6 +446,13 @@
$ hg id -n
8
+Check that named update do too
+
+ $ hg update default
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ hg id -n
+ 8
+
$ hg up null -q # to be not based on 9 anymore
check rebase compat