equal
deleted
inserted
replaced
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 |