Show More
@@ -11,6 +11,7 b' import node as nodemod' | |||||
11 | import bookmarks as bookmarksmod |
|
11 | import bookmarks as bookmarksmod | |
12 | import match as matchmod |
|
12 | import match as matchmod | |
13 | from i18n import _ |
|
13 | from i18n import _ | |
|
14 | import encoding | |||
14 |
|
15 | |||
15 | elements = { |
|
16 | elements = { | |
16 | "(": (20, ("group", 1, ")"), ("func", 1, ")")), |
|
17 | "(": (20, ("group", 1, ")"), ("func", 1, ")")), | |
@@ -233,8 +234,8 b' def author(repo, subset, x):' | |||||
233 | Alias for ``user(string)``. |
|
234 | Alias for ``user(string)``. | |
234 | """ |
|
235 | """ | |
235 | # i18n: "author" is a keyword |
|
236 | # i18n: "author" is a keyword | |
236 |
n = getstring(x, _("author requires a string")) |
|
237 | n = encoding.lower(getstring(x, _("author requires a string"))) | |
237 |
return [r for r in subset if n in repo[r].user() |
|
238 | return [r for r in subset if n in encoding.lower(repo[r].user())] | |
238 |
|
239 | |||
239 | def bisect(repo, subset, x): |
|
240 | def bisect(repo, subset, x): | |
240 | """``bisect(string)`` |
|
241 | """``bisect(string)`` | |
@@ -376,11 +377,11 b' def desc(repo, subset, x):' | |||||
376 | Search commit message for string. The match is case-insensitive. |
|
377 | Search commit message for string. The match is case-insensitive. | |
377 | """ |
|
378 | """ | |
378 | # i18n: "desc" is a keyword |
|
379 | # i18n: "desc" is a keyword | |
379 |
ds = getstring(x, _("desc requires a string")) |
|
380 | ds = encoding.lower(getstring(x, _("desc requires a string"))) | |
380 | l = [] |
|
381 | l = [] | |
381 | for r in subset: |
|
382 | for r in subset: | |
382 | c = repo[r] |
|
383 | c = repo[r] | |
383 |
if ds in c.description() |
|
384 | if ds in encoding.lower(c.description()): | |
384 | l.append(r) |
|
385 | l.append(r) | |
385 | return l |
|
386 | return l | |
386 |
|
387 | |||
@@ -522,12 +523,12 b' def keyword(repo, subset, x):' | |||||
522 | string. The match is case-insensitive. |
|
523 | string. The match is case-insensitive. | |
523 | """ |
|
524 | """ | |
524 | # i18n: "keyword" is a keyword |
|
525 | # i18n: "keyword" is a keyword | |
525 |
kw = getstring(x, _("keyword requires a string")) |
|
526 | kw = encoding.lower(getstring(x, _("keyword requires a string"))) | |
526 | l = [] |
|
527 | l = [] | |
527 | for r in subset: |
|
528 | for r in subset: | |
528 | c = repo[r] |
|
529 | c = repo[r] | |
529 | t = " ".join(c.files() + [c.user(), c.description()]) |
|
530 | t = " ".join(c.files() + [c.user(), c.description()]) | |
530 |
if kw in |
|
531 | if kw in encoding.lower(t): | |
531 | l.append(r) |
|
532 | l.append(r) | |
532 | return l |
|
533 | return l | |
533 |
|
534 |
@@ -475,3 +475,61 b' issue2549 - correct optimizations' | |||||
475 | $ log 'max(1 or 2) and not 2' |
|
475 | $ log 'max(1 or 2) and not 2' | |
476 | $ log 'min(1 or 2) and not 1' |
|
476 | $ log 'min(1 or 2) and not 1' | |
477 | $ log 'last(1 or 2, 1) and not 2' |
|
477 | $ log 'last(1 or 2, 1) and not 2' | |
|
478 | ||||
|
479 | $ cd .. | |||
|
480 | ||||
|
481 | test author/desc/keyword in problematic encoding | |||
|
482 | # unicode: cp932: | |||
|
483 | # u30A2 0x83 0x41(= 'A') | |||
|
484 | # u30C2 0x83 0x61(= 'a') | |||
|
485 | ||||
|
486 | $ hg init problematicencoding | |||
|
487 | $ cd problematicencoding | |||
|
488 | ||||
|
489 | $ python > setup.sh <<EOF | |||
|
490 | > print u''' | |||
|
491 | > echo a > text | |||
|
492 | > hg add text | |||
|
493 | > hg --encoding utf-8 commit -u '\u30A2' -m none | |||
|
494 | > echo b > text | |||
|
495 | > hg --encoding utf-8 commit -u '\u30C2' -m none | |||
|
496 | > echo c > text | |||
|
497 | > hg --encoding utf-8 commit -u none -m '\u30A2' | |||
|
498 | > echo d > text | |||
|
499 | > hg --encoding utf-8 commit -u none -m '\u30C2' | |||
|
500 | > '''.encode('utf-8') | |||
|
501 | > EOF | |||
|
502 | $ sh < setup.sh | |||
|
503 | ||||
|
504 | test in problematic encoding | |||
|
505 | $ python > test.sh <<EOF | |||
|
506 | > print u''' | |||
|
507 | > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30A2)' | |||
|
508 | > echo ==== | |||
|
509 | > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30C2)' | |||
|
510 | > echo ==== | |||
|
511 | > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30A2)' | |||
|
512 | > echo ==== | |||
|
513 | > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30C2)' | |||
|
514 | > echo ==== | |||
|
515 | > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30A2)' | |||
|
516 | > echo ==== | |||
|
517 | > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30C2)' | |||
|
518 | > '''.encode('cp932') | |||
|
519 | > EOF | |||
|
520 | $ sh < test.sh | |||
|
521 | 0 | |||
|
522 | ==== | |||
|
523 | 1 | |||
|
524 | ==== | |||
|
525 | 2 | |||
|
526 | ==== | |||
|
527 | 3 | |||
|
528 | ==== | |||
|
529 | 0 | |||
|
530 | 2 | |||
|
531 | ==== | |||
|
532 | 1 | |||
|
533 | 3 | |||
|
534 | ||||
|
535 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now