Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revsetlang.py @ 31394:1c48a8278b2f
py3: fix slicing of bytes in revset.formatspec()
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 12 Mar 2017 17:16:43 -0700 |
parents | fac5cd3b8673 |
children | f784ba187089 |
comparison
equal
deleted
inserted
replaced
31393:fac5cd3b8673 | 31394:1c48a8278b2f |
---|---|
642 | 642 |
643 ret = '' | 643 ret = '' |
644 pos = 0 | 644 pos = 0 |
645 arg = 0 | 645 arg = 0 |
646 while pos < len(expr): | 646 while pos < len(expr): |
647 c = expr[pos] | 647 c = expr[pos:pos + 1] |
648 if c == '%': | 648 if c == '%': |
649 pos += 1 | 649 pos += 1 |
650 d = expr[pos] | 650 d = expr[pos:pos + 1] |
651 if d == '%': | 651 if d == '%': |
652 ret += d | 652 ret += d |
653 elif d in 'dsnbr': | 653 elif d in 'dsnbr': |
654 ret += argtype(d, args[arg]) | 654 ret += argtype(d, args[arg]) |
655 arg += 1 | 655 arg += 1 |
656 elif d == 'l': | 656 elif d == 'l': |
657 # a list of some type | 657 # a list of some type |
658 pos += 1 | 658 pos += 1 |
659 d = expr[pos] | 659 d = expr[pos:pos + 1] |
660 ret += listexp(list(args[arg]), d) | 660 ret += listexp(list(args[arg]), d) |
661 arg += 1 | 661 arg += 1 |
662 else: | 662 else: |
663 raise error.Abort(_('unexpected revspec format character %s') | 663 raise error.Abort(_('unexpected revspec format character %s') |
664 % d) | 664 % d) |