Show More
@@ -754,6 +754,15 b' class revlog(object):' | |||||
754 | if isinstance(id, (long, int)): |
|
754 | if isinstance(id, (long, int)): | |
755 | # rev |
|
755 | # rev | |
756 | return self.node(id) |
|
756 | return self.node(id) | |
|
757 | if len(id) == 20: | |||
|
758 | # possibly a binary node | |||
|
759 | # odds of a binary node being all hex in ASCII are 1 in 10**25 | |||
|
760 | try: | |||
|
761 | node = id | |||
|
762 | r = self.rev(node) # quick search the index | |||
|
763 | return node | |||
|
764 | except RevlogError: | |||
|
765 | pass # may be partial hex id | |||
757 | try: |
|
766 | try: | |
758 | # str(rev) |
|
767 | # str(rev) | |
759 | rev = int(id) |
|
768 | rev = int(id) | |
@@ -764,11 +773,14 b' class revlog(object):' | |||||
764 | except (ValueError, OverflowError): |
|
773 | except (ValueError, OverflowError): | |
765 | pass |
|
774 | pass | |
766 | try: |
|
775 | try: | |
|
776 | if len(id) == 40: | |||
|
777 | # a full hex nodeid? | |||
|
778 | node = bin(id) | |||
|
779 | r = self.rev(node) | |||
|
780 | return node | |||
|
781 | elif len(id) < 40: | |||
767 | # hex(node)[:...] |
|
782 | # hex(node)[:...] | |
768 | if len(id) % 2 == 0: |
|
783 | bin_id = bin(id[:len(id) & ~1]) # grab an even number of digits | |
769 | bin_id = bin(id) |
|
|||
770 | else: |
|
|||
771 | bin_id = bin(id[:-1]) |
|
|||
772 | node = None |
|
784 | node = None | |
773 | for n in self.nodemap: |
|
785 | for n in self.nodemap: | |
774 | if n.startswith(bin_id) and hex(n).startswith(id): |
|
786 | if n.startswith(bin_id) and hex(n).startswith(id): | |
@@ -780,11 +792,6 b' class revlog(object):' | |||||
780 | except TypeError: |
|
792 | except TypeError: | |
781 | pass |
|
793 | pass | |
782 |
|
794 | |||
783 | # might need fixing if we change hash lengths |
|
|||
784 | if len(id) == 20 and id in self.nodemap: |
|
|||
785 | # node |
|
|||
786 | return id |
|
|||
787 |
|
||||
788 | raise RevlogError(_("No match found")) |
|
795 | raise RevlogError(_("No match found")) | |
789 |
|
796 | |||
790 | def cmp(self, node, text): |
|
797 | def cmp(self, node, text): |
General Comments 0
You need to be logged in to leave comments.
Login now