mercurial/revlog.py
changeset 2561 494f7787d8ee
parent 2560 c35694df7b13
child 2600 c4325f0a9b91
equal deleted inserted replaced
2560:c35694df7b13 2561:494f7787d8ee
   741                     continue
   741                     continue
   742         return c
   742         return c
   743 
   743 
   744     def lookup(self, id):
   744     def lookup(self, id):
   745         """locate a node based on revision number or subset of hex nodeid"""
   745         """locate a node based on revision number or subset of hex nodeid"""
       
   746         if id in self.nodemap:
       
   747             return id
   746         if type(id) == type(0):
   748         if type(id) == type(0):
   747             rev = id
   749             rev = id
   748             if rev < 0: rev = self.count() + rev
   750             if rev < 0: rev = self.count() + rev
   749             if rev < 0 or rev >= self.count(): return None
   751             if rev < 0 or rev >= self.count(): return None
   750             return self.node(rev)
   752             return self.node(rev)