##// END OF EJS Templates
ui: fix configlist on Python 3...
Augie Fackler -
r31156:e5aab82e default
parent child Browse files
Show More
@@ -569,37 +569,38 b' class ui(object):'
569
569
570 def _parse_plain(parts, s, offset):
570 def _parse_plain(parts, s, offset):
571 whitespace = False
571 whitespace = False
572 while offset < len(s) and (s[offset].isspace() or s[offset] == ','):
572 while offset < len(s) and (s[offset:offset + 1].isspace()
573 or s[offset:offset + 1] == ','):
573 whitespace = True
574 whitespace = True
574 offset += 1
575 offset += 1
575 if offset >= len(s):
576 if offset >= len(s):
576 return None, parts, offset
577 return None, parts, offset
577 if whitespace:
578 if whitespace:
578 parts.append('')
579 parts.append('')
579 if s[offset] == '"' and not parts[-1]:
580 if s[offset:offset + 1] == '"' and not parts[-1]:
580 return _parse_quote, parts, offset + 1
581 return _parse_quote, parts, offset + 1
581 elif s[offset] == '"' and parts[-1][-1] == '\\':
582 elif s[offset:offset + 1] == '"' and parts[-1][-1] == '\\':
582 parts[-1] = parts[-1][:-1] + s[offset]
583 parts[-1] = parts[-1][:-1] + s[offset:offset + 1]
583 return _parse_plain, parts, offset + 1
584 return _parse_plain, parts, offset + 1
584 parts[-1] += s[offset]
585 parts[-1] += s[offset:offset + 1]
585 return _parse_plain, parts, offset + 1
586 return _parse_plain, parts, offset + 1
586
587
587 def _parse_quote(parts, s, offset):
588 def _parse_quote(parts, s, offset):
588 if offset < len(s) and s[offset] == '"': # ""
589 if offset < len(s) and s[offset:offset + 1] == '"': # ""
589 parts.append('')
590 parts.append('')
590 offset += 1
591 offset += 1
591 while offset < len(s) and (s[offset].isspace() or
592 while offset < len(s) and (s[offset:offset + 1].isspace() or
592 s[offset] == ','):
593 s[offset:offset + 1] == ','):
593 offset += 1
594 offset += 1
594 return _parse_plain, parts, offset
595 return _parse_plain, parts, offset
595
596
596 while offset < len(s) and s[offset] != '"':
597 while offset < len(s) and s[offset:offset + 1] != '"':
597 if (s[offset] == '\\' and offset + 1 < len(s)
598 if (s[offset:offset + 1] == '\\' and offset + 1 < len(s)
598 and s[offset + 1] == '"'):
599 and s[offset + 1:offset + 2] == '"'):
599 offset += 1
600 offset += 1
600 parts[-1] += '"'
601 parts[-1] += '"'
601 else:
602 else:
602 parts[-1] += s[offset]
603 parts[-1] += s[offset:offset + 1]
603 offset += 1
604 offset += 1
604
605
605 if offset >= len(s):
606 if offset >= len(s):
@@ -613,11 +614,11 b' class ui(object):'
613 return None, parts, offset
614 return None, parts, offset
614
615
615 offset += 1
616 offset += 1
616 while offset < len(s) and s[offset] in [' ', ',']:
617 while offset < len(s) and s[offset:offset + 1] in [' ', ',']:
617 offset += 1
618 offset += 1
618
619
619 if offset < len(s):
620 if offset < len(s):
620 if offset + 1 == len(s) and s[offset] == '"':
621 if offset + 1 == len(s) and s[offset:offset + 1] == '"':
621 parts[-1] += '"'
622 parts[-1] += '"'
622 offset += 1
623 offset += 1
623 else:
624 else:
General Comments 0
You need to be logged in to leave comments. Login now