Show More
@@ -199,6 +199,7 b' except ImportError:' | |||||
199 | fcntl = None |
|
199 | fcntl = None | |
200 | termios = None |
|
200 | termios = None | |
201 |
|
201 | |||
|
202 | import binascii | |||
202 | import functools |
|
203 | import functools | |
203 | import os |
|
204 | import os | |
204 | import pickle |
|
205 | import pickle | |
@@ -504,7 +505,7 b' class histeditaction:' | |||||
504 | # Check for validation of rule ids and get the rulehash |
|
505 | # Check for validation of rule ids and get the rulehash | |
505 | try: |
|
506 | try: | |
506 | rev = bin(ruleid) |
|
507 | rev = bin(ruleid) | |
507 |
except |
|
508 | except binascii.Error: | |
508 | try: |
|
509 | try: | |
509 | _ctx = scmutil.revsingle(state.repo, ruleid) |
|
510 | _ctx = scmutil.revsingle(state.repo, ruleid) | |
510 | rulehash = _ctx.hex() |
|
511 | rulehash = _ctx.hex() |
@@ -8,6 +8,7 b'' | |||||
8 |
|
8 | |||
9 | '''High-level command function for lfconvert, plus the cmdtable.''' |
|
9 | '''High-level command function for lfconvert, plus the cmdtable.''' | |
10 |
|
10 | |||
|
11 | import binascii | |||
11 | import errno |
|
12 | import errno | |
12 | import os |
|
13 | import os | |
13 | import shutil |
|
14 | import shutil | |
@@ -384,7 +385,7 b' def _converttags(ui, revmap, data):' | |||||
384 | continue |
|
385 | continue | |
385 | try: |
|
386 | try: | |
386 | newid = bin(id) |
|
387 | newid = bin(id) | |
387 |
except |
|
388 | except binascii.Error: | |
388 | ui.warn(_(b'skipping incorrectly formatted id %s\n') % id) |
|
389 | ui.warn(_(b'skipping incorrectly formatted id %s\n') % id) | |
389 | continue |
|
390 | continue | |
390 | try: |
|
391 | try: |
@@ -101,8 +101,8 b' class bmstore:' | |||||
101 | if nrefs[-2] > refspec: |
|
101 | if nrefs[-2] > refspec: | |
102 | # bookmarks weren't sorted before 4.5 |
|
102 | # bookmarks weren't sorted before 4.5 | |
103 | nrefs.sort() |
|
103 | nrefs.sort() | |
104 |
except |
|
104 | except ValueError: | |
105 |
# |
|
105 | # binascii.Error (ValueError subclass): | |
106 | # - bin(...) |
|
106 | # - bin(...) | |
107 | # ValueError: |
|
107 | # ValueError: | |
108 | # - node in nm, for non-20-bytes entry |
|
108 | # - node in nm, for non-20-bytes entry |
@@ -2691,9 +2691,9 b' def debugobsolete(ui, repo, precursor=No' | |||||
2691 | # local repository. |
|
2691 | # local repository. | |
2692 | n = bin(s) |
|
2692 | n = bin(s) | |
2693 | if len(n) != repo.nodeconstants.nodelen: |
|
2693 | if len(n) != repo.nodeconstants.nodelen: | |
2694 |
raise |
|
2694 | raise ValueError | |
2695 | return n |
|
2695 | return n | |
2696 |
except |
|
2696 | except ValueError: | |
2697 | raise error.InputError( |
|
2697 | raise error.InputError( | |
2698 | b'changeset references must be full hexadecimal ' |
|
2698 | b'changeset references must be full hexadecimal ' | |
2699 | b'node identifiers' |
|
2699 | b'node identifiers' |
@@ -10,14 +10,7 b' import binascii' | |||||
10 |
|
10 | |||
11 | # This ugly style has a noticeable effect in manifest parsing |
|
11 | # This ugly style has a noticeable effect in manifest parsing | |
12 | hex = binascii.hexlify |
|
12 | hex = binascii.hexlify | |
13 | # Adapt to Python 3 API changes. If this ends up showing up in |
|
13 | bin = binascii.unhexlify | |
14 | # profiles, we can use this version only on Python 3, and forward |
|
|||
15 | # binascii.unhexlify like we used to on Python 2. |
|
|||
16 | def bin(s): |
|
|||
17 | try: |
|
|||
18 | return binascii.unhexlify(s) |
|
|||
19 | except binascii.Error as e: |
|
|||
20 | raise TypeError(e) |
|
|||
21 |
|
14 | |||
22 |
|
15 | |||
23 | def short(node): |
|
16 | def short(node): |
@@ -68,6 +68,7 b' comment associated with each format for ' | |||||
68 |
|
68 | |||
69 | """ |
|
69 | """ | |
70 |
|
70 | |||
|
71 | import binascii | |||
71 | import errno |
|
72 | import errno | |
72 | import struct |
|
73 | import struct | |
73 |
|
74 | |||
@@ -244,7 +245,7 b' def _fm0readmarkers(data, off, stop):' | |||||
244 | if len(p) != 20: |
|
245 | if len(p) != 20: | |
245 | parents = None |
|
246 | parents = None | |
246 | break |
|
247 | break | |
247 |
except |
|
248 | except binascii.Error: | |
248 | # if content cannot be translated to nodeid drop the data. |
|
249 | # if content cannot be translated to nodeid drop the data. | |
249 | parents = None |
|
250 | parents = None | |
250 |
|
251 |
@@ -1487,7 +1487,7 b' class revlog:' | |||||
1487 | node = bin(id) |
|
1487 | node = bin(id) | |
1488 | self.rev(node) |
|
1488 | self.rev(node) | |
1489 | return node |
|
1489 | return node | |
1490 |
except ( |
|
1490 | except (binascii.Error, error.LookupError): | |
1491 | pass |
|
1491 | pass | |
1492 |
|
1492 | |||
1493 | def _partialmatch(self, id): |
|
1493 | def _partialmatch(self, id): | |
@@ -1529,7 +1529,7 b' class revlog:' | |||||
1529 | l = len(id) // 2 * 2 # grab an even number of digits |
|
1529 | l = len(id) // 2 * 2 # grab an even number of digits | |
1530 | try: |
|
1530 | try: | |
1531 | prefix = bin(id[:l]) |
|
1531 | prefix = bin(id[:l]) | |
1532 |
except |
|
1532 | except binascii.Error: | |
1533 | pass |
|
1533 | pass | |
1534 | else: |
|
1534 | else: | |
1535 | nl = [e[7] for e in self.index if e[7].startswith(prefix)] |
|
1535 | nl = [e[7] for e in self.index if e[7].startswith(prefix)] |
@@ -6,6 +6,7 b'' | |||||
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 |
|
8 | |||
|
9 | import binascii | |||
9 | import re |
|
10 | import re | |
10 |
|
11 | |||
11 | from .i18n import _ |
|
12 | from .i18n import _ | |
@@ -1728,7 +1729,7 b' def _node(repo, n):' | |||||
1728 | rn = repo.changelog.rev(bin(n)) |
|
1729 | rn = repo.changelog.rev(bin(n)) | |
1729 | except error.WdirUnsupported: |
|
1730 | except error.WdirUnsupported: | |
1730 | rn = wdirrev |
|
1731 | rn = wdirrev | |
1731 |
except ( |
|
1732 | except (binascii.Error, LookupError): | |
1732 | rn = None |
|
1733 | rn = None | |
1733 | else: |
|
1734 | else: | |
1734 | try: |
|
1735 | try: |
@@ -6,6 +6,7 b'' | |||||
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 |
|
8 | |||
|
9 | import binascii | |||
9 | import errno |
|
10 | import errno | |
10 | import glob |
|
11 | import glob | |
11 | import os |
|
12 | import os | |
@@ -639,7 +640,7 b' def revsymbol(repo, symbol):' | |||||
639 | return repo[rev] |
|
640 | return repo[rev] | |
640 | except error.FilteredLookupError: |
|
641 | except error.FilteredLookupError: | |
641 | raise |
|
642 | raise | |
642 |
except ( |
|
643 | except (binascii.Error, LookupError): | |
643 | pass |
|
644 | pass | |
644 |
|
645 | |||
645 | # look up bookmarks through the name interface |
|
646 | # look up bookmarks through the name interface |
@@ -238,7 +238,7 b' class shelvedstate:' | |||||
238 | d[b'nodestoremove'] = [ |
|
238 | d[b'nodestoremove'] = [ | |
239 | bin(h) for h in d[b'nodestoremove'].split(b' ') |
|
239 | bin(h) for h in d[b'nodestoremove'].split(b' ') | |
240 | ] |
|
240 | ] | |
241 |
except (ValueError |
|
241 | except (ValueError, KeyError) as err: | |
242 | raise error.CorruptedState(stringutil.forcebytestr(err)) |
|
242 | raise error.CorruptedState(stringutil.forcebytestr(err)) | |
243 |
|
243 | |||
244 | @classmethod |
|
244 | @classmethod |
@@ -11,6 +11,7 b'' | |||||
11 | # tags too. |
|
11 | # tags too. | |
12 |
|
12 | |||
13 |
|
13 | |||
|
14 | import binascii | |||
14 | import errno |
|
15 | import errno | |
15 | import io |
|
16 | import io | |
16 |
|
17 | |||
@@ -303,7 +304,7 b' def _readtaghist(ui, repo, lines, fn, re' | |||||
303 | name = recode(name) |
|
304 | name = recode(name) | |
304 | try: |
|
305 | try: | |
305 | nodebin = bin(nodehex) |
|
306 | nodebin = bin(nodehex) | |
306 |
except |
|
307 | except binascii.Error: | |
307 | dbg(b"node '%s' is not well formed" % nodehex) |
|
308 | dbg(b"node '%s' is not well formed" % nodehex) | |
308 | continue |
|
309 | continue | |
309 |
|
310 |
@@ -6,6 +6,7 b'' | |||||
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 |
|
8 | |||
|
9 | import binascii | |||
9 | import re |
|
10 | import re | |
10 |
|
11 | |||
11 | from .i18n import _ |
|
12 | from .i18n import _ | |
@@ -769,7 +770,7 b' def shortest(context, mapping, args):' | |||||
769 | elif len(hexnode) == hexnodelen: |
|
770 | elif len(hexnode) == hexnodelen: | |
770 | try: |
|
771 | try: | |
771 | node = bin(hexnode) |
|
772 | node = bin(hexnode) | |
772 |
except |
|
773 | except binascii.Error: | |
773 | return hexnode |
|
774 | return hexnode | |
774 | else: |
|
775 | else: | |
775 | try: |
|
776 | try: |
@@ -386,14 +386,10 b' Server sends an incomplete HTTP response' | |||||
386 | > -p $HGPORT -d --pid-file=hg.pid -E error.log |
|
386 | > -p $HGPORT -d --pid-file=hg.pid -E error.log | |
387 | $ cat hg.pid > $DAEMON_PIDS |
|
387 | $ cat hg.pid > $DAEMON_PIDS | |
388 |
|
388 | |||
389 | TODO client spews a stack due to uncaught ValueError in batch.results() |
|
389 | $ hg clone http://localhost:$HGPORT/ clone | |
390 | #if no-chg |
|
390 | abort: unexpected response: | |
391 | $ hg clone http://localhost:$HGPORT/ clone 2> /dev/null |
|
391 | '96ee1d7354c4ad7372047672' | |
392 | [1] |
|
|||
393 | #else |
|
|||
394 | $ hg clone http://localhost:$HGPORT/ clone 2> /dev/null |
|
|||
395 |
|
|
392 | [255] | |
396 | #endif |
|
|||
397 |
|
|
393 | ||
398 | $ killdaemons.py $DAEMON_PIDS |
|
394 | $ killdaemons.py $DAEMON_PIDS | |
399 |
|
395 |
General Comments 0
You need to be logged in to leave comments.
Login now