Mercurial > public > mercurial-scm > hg
comparison mercurial/revsetlang.py @ 46113:59fa3890d40a
node: import symbols explicitly
There is no point in lazy importing mercurial.node, it is used all over
the place anyway. So consistently import the used symbols directly.
Fix one file using symbols indirectly via mercurial.revlog.
Differential Revision: https://phab.mercurial-scm.org/D9480
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Tue, 01 Dec 2020 21:54:46 +0100 |
parents | 89a2afe31e82 |
children | d4ba4d51f85f |
comparison
equal
deleted
inserted
replaced
46112:d6afa9c149c3 | 46113:59fa3890d40a |
---|---|
9 | 9 |
10 import string | 10 import string |
11 | 11 |
12 from .i18n import _ | 12 from .i18n import _ |
13 from .pycompat import getattr | 13 from .pycompat import getattr |
14 from .node import hex | |
14 from . import ( | 15 from . import ( |
15 error, | 16 error, |
16 node, | |
17 parser, | 17 parser, |
18 pycompat, | 18 pycompat, |
19 smartset, | 19 smartset, |
20 util, | 20 util, |
21 ) | 21 ) |
685 if not isinstance(arg, bytes): | 685 if not isinstance(arg, bytes): |
686 raise TypeError | 686 raise TypeError |
687 parse(arg) # make sure syntax errors are confined | 687 parse(arg) # make sure syntax errors are confined |
688 return b'(%s)' % arg | 688 return b'(%s)' % arg |
689 elif c == b'n': | 689 elif c == b'n': |
690 return _quote(node.hex(arg)) | 690 return _quote(hex(arg)) |
691 elif c == b'b': | 691 elif c == b'b': |
692 try: | 692 try: |
693 return _quote(arg.branch()) | 693 return _quote(arg.branch()) |
694 except AttributeError: | 694 except AttributeError: |
695 raise TypeError | 695 raise TypeError |
705 elif t == b'd': | 705 elif t == b'd': |
706 return _formatintlist(s) | 706 return _formatintlist(s) |
707 elif t == b's': | 707 elif t == b's': |
708 return b"_list(%s)" % _quote(b"\0".join(s)) | 708 return b"_list(%s)" % _quote(b"\0".join(s)) |
709 elif t == b'n': | 709 elif t == b'n': |
710 return b"_hexlist('%s')" % b"\0".join(node.hex(a) for a in s) | 710 return b"_hexlist('%s')" % b"\0".join(hex(a) for a in s) |
711 elif t == b'b': | 711 elif t == b'b': |
712 try: | 712 try: |
713 return b"_list('%s')" % b"\0".join(a.branch() for a in s) | 713 return b"_list('%s')" % b"\0".join(a.branch() for a in s) |
714 except AttributeError: | 714 except AttributeError: |
715 raise TypeError | 715 raise TypeError |