comparison mercurial/localrepo.py @ 32481:a87dabb053d0

localrepo: document that __contains__() may raise LookupError
author Yuya Nishihara <yuya@tcha.org>
date Thu, 25 May 2017 23:18:02 +0900
parents b647b923486f
children a722c8e17363
comparison
equal deleted inserted replaced
32480:43ae9e6eaaba 32481:a87dabb053d0
571 for i in xrange(*changeid.indices(len(self))) 571 for i in xrange(*changeid.indices(len(self)))
572 if i not in self.changelog.filteredrevs] 572 if i not in self.changelog.filteredrevs]
573 return context.changectx(self, changeid) 573 return context.changectx(self, changeid)
574 574
575 def __contains__(self, changeid): 575 def __contains__(self, changeid):
576 """True if the given changeid exists
577
578 error.LookupError is raised if an ambiguous node specified.
579 """
576 try: 580 try:
577 self[changeid] 581 self[changeid]
578 return True 582 return True
579 except error.RepoLookupError: 583 except error.RepoLookupError:
580 return False 584 return False