Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/localrepo.py @ 3433:5436c8fe0ff5
Make lookup aware of branch labels
adjust precedence order slightly:
- '.'
- tags
- branch labels
- revlog order
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 17 Oct 2006 18:31:56 -0500 |
parents | 028fff46a4ac |
children | d0459ec1455d |
comparison
equal
deleted
inserted
replaced
3432:028fff46a4ac | 3433:5436c8fe0ff5 |
---|---|
326 f.write("%s %s\n" % (hex(t), self.changelog.count() - 1)) | 326 f.write("%s %s\n" % (hex(t), self.changelog.count() - 1)) |
327 for label, node in self.branchcache.iteritems(): | 327 for label, node in self.branchcache.iteritems(): |
328 f.write("%s %s\n" % (hex(node), label)) | 328 f.write("%s %s\n" % (hex(node), label)) |
329 | 329 |
330 def lookup(self, key): | 330 def lookup(self, key): |
331 if key == '.': | |
332 key = self.dirstate.parents()[0] | |
333 if key == nullid: | |
334 raise repo.RepoError(_("no revision checked out")) | |
335 if key in self.tags(): | |
336 return self.tags()[key] | |
337 if key in self.branchtags(): | |
338 return self.branchtags()[key] | |
331 try: | 339 try: |
332 return self.tags()[key] | 340 return self.changelog.lookup(key) |
333 except KeyError: | 341 except: |
334 if key == '.': | 342 raise repo.RepoError(_("unknown revision '%s'") % key) |
335 key = self.dirstate.parents()[0] | |
336 if key == nullid: | |
337 raise repo.RepoError(_("no revision checked out")) | |
338 try: | |
339 return self.changelog.lookup(key) | |
340 except: | |
341 raise repo.RepoError(_("unknown revision '%s'") % key) | |
342 | 343 |
343 def dev(self): | 344 def dev(self): |
344 return os.lstat(self.path).st_dev | 345 return os.lstat(self.path).st_dev |
345 | 346 |
346 def local(self): | 347 def local(self): |