comparison hgext/obsolete.py @ 480:cd1d5b7308be

obsolete: ignore hidden changeset when resolving `branchname` revision
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Thu, 23 Aug 2012 03:14:03 +0200
parents b63da0fb8ee5
children b12ff7ef35b1
comparison
equal deleted inserted replaced
479:b63da0fb8ee5 480:cd1d5b7308be
586 if node is None: 586 if node is None:
587 # tip of current branch 587 # tip of current branch
588 branch = repo[None].branch() 588 branch = repo[None].branch()
589 node = repo.revs('last((.:: and branch(%s)) - hidden())', branch)[0] 589 node = repo.revs('last((.:: and branch(%s)) - hidden())', branch)[0]
590 return orig(repo, node, *args, **kwargs) 590 return orig(repo, node, *args, **kwargs)
591
592 @eh.wrapfunction(localrepo.localrepository, 'branchtip')
593 def obsbranchtip(orig, repo, branch):
594 """ensure "stable" reference does not end on a hidden changeset"""
595 result = ()
596 heads = repo.branchmap().get(branch, ())
597 if heads:
598 result = list(repo.set('last(heads(branch(%n) - hidden()))', heads[0]))
599 if not result:
600 raise error.RepoLookupError(_("unknown branch '%s'") % branch)
601 return result[0].node()
602
591 603
592 ##################################################################### 604 #####################################################################
593 ### Additional Utilities ### 605 ### Additional Utilities ###
594 ##################################################################### 606 #####################################################################
595 607