Show More
@@ -235,6 +235,8 b' FILE_TOO_SHORT_MSG = _(' | |||||
235 | b' expected %d bytes from offset %d, data size is %d' |
|
235 | b' expected %d bytes from offset %d, data size is %d' | |
236 | ) |
|
236 | ) | |
237 |
|
237 | |||
|
238 | hexdigits = b'0123456789abcdefABCDEF' | |||
|
239 | ||||
238 |
|
240 | |||
239 | class revlog: |
|
241 | class revlog: | |
240 | """ |
|
242 | """ | |
@@ -1509,7 +1511,7 b' class revlog:' | |||||
1509 | ambiguous = True |
|
1511 | ambiguous = True | |
1510 | # fall through to slow path that filters hidden revisions |
|
1512 | # fall through to slow path that filters hidden revisions | |
1511 | except (AttributeError, ValueError): |
|
1513 | except (AttributeError, ValueError): | |
1512 |
# we are pure python, or key |
|
1514 | # we are pure python, or key is not hex | |
1513 | pass |
|
1515 | pass | |
1514 | if ambiguous: |
|
1516 | if ambiguous: | |
1515 | raise error.AmbiguousPrefixLookupError( |
|
1517 | raise error.AmbiguousPrefixLookupError( | |
@@ -1523,6 +1525,11 b' class revlog:' | |||||
1523 | # hex(node)[:...] |
|
1525 | # hex(node)[:...] | |
1524 | l = len(id) // 2 * 2 # grab an even number of digits |
|
1526 | l = len(id) // 2 * 2 # grab an even number of digits | |
1525 | try: |
|
1527 | try: | |
|
1528 | # we're dropping the last digit, so let's check that it's hex, | |||
|
1529 | # to avoid the expensive computation below if it's not | |||
|
1530 | if len(id) % 2 > 0: | |||
|
1531 | if not (id[-1] in hexdigits): | |||
|
1532 | return None | |||
1526 | prefix = bin(id[:l]) |
|
1533 | prefix = bin(id[:l]) | |
1527 | except binascii.Error: |
|
1534 | except binascii.Error: | |
1528 | pass |
|
1535 | pass |
General Comments 0
You need to be logged in to leave comments.
Login now