591 if reachable: |
591 if reachable: |
592 bheads = [b for b in bheads if b not in reachable] |
592 bheads = [b for b in bheads if b not in reachable] |
593 partial[branch] = bheads |
593 partial[branch] = bheads |
594 |
594 |
595 def lookup(self, key): |
595 def lookup(self, key): |
596 if isinstance(key, int): |
596 return self[key].node() |
597 return self.changelog.node(key) |
|
598 elif key == '.': |
|
599 return self.dirstate.p1() |
|
600 elif key == 'null': |
|
601 return nullid |
|
602 elif key == 'tip': |
|
603 return self.changelog.tip() |
|
604 n = self.changelog._match(key) |
|
605 if n: |
|
606 return n |
|
607 if key in self._bookmarks: |
|
608 return self._bookmarks[key] |
|
609 if key in self.tags(): |
|
610 return self.tags()[key] |
|
611 if key in self.branchtags(): |
|
612 return self.branchtags()[key] |
|
613 n = self.changelog._partialmatch(key) |
|
614 if n: |
|
615 return n |
|
616 |
|
617 # can't find key, check if it might have come from damaged dirstate |
|
618 if key in self.dirstate.parents(): |
|
619 raise error.Abort(_("working directory has unknown parent '%s'!") |
|
620 % short(key)) |
|
621 try: |
|
622 if len(key) == 20: |
|
623 key = hex(key) |
|
624 except TypeError: |
|
625 pass |
|
626 raise error.RepoLookupError(_("unknown revision '%s'") % key) |
|
627 |
597 |
628 def lookupbranch(self, key, remote=None): |
598 def lookupbranch(self, key, remote=None): |
629 repo = remote or self |
599 repo = remote or self |
630 if key in repo.branchmap(): |
600 if key in repo.branchmap(): |
631 return key |
601 return key |