Commits

Pierre-Yves David  committed cd1d5b7

obsolete: ignore hidden changeset when resolving `branchname` revision

  • Participants
  • Parent commits b63da0f
  • Branches default

Comments (0)

Files changed (2)

File hgext/obsolete.py

         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                                          ###
 #####################################################################

File tests/test-obsolete.t

   $ 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