Mercurial > hg-stable
comparison mercurial/revset.py @ 17259:e96ad092fb18 stable
i18n: add/relocate "i18n keyword" comments for i18n messages in revset.py
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Thu, 26 Jul 2012 13:58:43 +0900 |
parents | 5822345e9e46 |
children | c30307eeec4b |
comparison
equal
deleted
inserted
replaced
17258:5822345e9e46 | 17259:e96ad092fb18 |
---|---|
340 - ``pruned`` : csets that are goods, bads or skipped | 340 - ``pruned`` : csets that are goods, bads or skipped |
341 - ``untested`` : csets whose fate is yet unknown | 341 - ``untested`` : csets whose fate is yet unknown |
342 - ``ignored`` : csets ignored due to DAG topology | 342 - ``ignored`` : csets ignored due to DAG topology |
343 - ``current`` : the cset currently being bisected | 343 - ``current`` : the cset currently being bisected |
344 """ | 344 """ |
345 # i18n: "bisect" is a keyword | |
345 status = getstring(x, _("bisect requires a string")).lower() | 346 status = getstring(x, _("bisect requires a string")).lower() |
346 state = set(hbisect.get(repo, status)) | 347 state = set(hbisect.get(repo, status)) |
347 return [r for r in subset if r in state] | 348 return [r for r in subset if r in state] |
348 | 349 |
349 # Backward-compatibility | 350 # Backward-compatibility |
507 """ | 508 """ |
508 | 509 |
509 # There is exactly no chance of resolving the revision, so do a simple | 510 # There is exactly no chance of resolving the revision, so do a simple |
510 # string compare and hope for the best | 511 # string compare and hope for the best |
511 | 512 |
513 rev = None | |
512 # i18n: "converted" is a keyword | 514 # i18n: "converted" is a keyword |
513 rev = None | |
514 l = getargs(x, 0, 1, _('converted takes one or no arguments')) | 515 l = getargs(x, 0, 1, _('converted takes one or no arguments')) |
515 if l: | 516 if l: |
517 # i18n: "converted" is a keyword | |
516 rev = getstring(l[0], _('converted requires a revision')) | 518 rev = getstring(l[0], _('converted requires a revision')) |
517 | 519 |
518 def _matchvalue(r): | 520 def _matchvalue(r): |
519 source = repo[r].extra().get('convert_revision', None) | 521 source = repo[r].extra().get('convert_revision', None) |
520 return source is not None and (rev is None or source.startswith(rev)) | 522 return source is not None and (rev is None or source.startswith(rev)) |
606 return [r for r in subset if r in dests] | 608 return [r for r in subset if r in dests] |
607 | 609 |
608 def draft(repo, subset, x): | 610 def draft(repo, subset, x): |
609 """``draft()`` | 611 """``draft()`` |
610 Changeset in draft phase.""" | 612 Changeset in draft phase.""" |
613 # i18n: "draft" is a keyword | |
611 getargs(x, 0, 0, _("draft takes no arguments")) | 614 getargs(x, 0, 0, _("draft takes no arguments")) |
612 pc = repo._phasecache | 615 pc = repo._phasecache |
613 return [r for r in subset if pc.phase(repo, r) == phases.draft] | 616 return [r for r in subset if pc.phase(repo, r) == phases.draft] |
614 | 617 |
615 def extinct(repo, subset, x): | 618 def extinct(repo, subset, x): |
616 """``extinct()`` | 619 """``extinct()`` |
617 obsolete changeset with obsolete descendant only.""" | 620 obsolete changeset with obsolete descendant only.""" |
621 # i18n: "extinct" is a keyword | |
618 getargs(x, 0, 0, _("extinct takes no arguments")) | 622 getargs(x, 0, 0, _("extinct takes no arguments")) |
619 extinctset = set(repo.revs('(obsolete()::) - (::(not obsolete()))')) | 623 extinctset = set(repo.revs('(obsolete()::) - (::(not obsolete()))')) |
620 return [r for r in subset if r in extinctset] | 624 return [r for r in subset if r in extinctset] |
621 | 625 |
622 def extra(repo, subset, x): | 626 def extra(repo, subset, x): |
627 If `value` starts with `re:`, the remainder of the value is treated as | 631 If `value` starts with `re:`, the remainder of the value is treated as |
628 a regular expression. To match a value that actually starts with `re:`, | 632 a regular expression. To match a value that actually starts with `re:`, |
629 use the prefix `literal:`. | 633 use the prefix `literal:`. |
630 """ | 634 """ |
631 | 635 |
636 # i18n: "extra" is a keyword | |
632 l = getargs(x, 1, 2, _('extra takes at least 1 and at most 2 arguments')) | 637 l = getargs(x, 1, 2, _('extra takes at least 1 and at most 2 arguments')) |
638 # i18n: "extra" is a keyword | |
633 label = getstring(l[0], _('first argument to extra must be a string')) | 639 label = getstring(l[0], _('first argument to extra must be a string')) |
634 value = None | 640 value = None |
635 | 641 |
636 if len(l) > 1: | 642 if len(l) > 1: |
643 # i18n: "extra" is a keyword | |
637 value = getstring(l[1], _('second argument to extra must be a string')) | 644 value = getstring(l[1], _('second argument to extra must be a string')) |
638 kind, value, matcher = _stringmatcher(value) | 645 kind, value, matcher = _stringmatcher(value) |
639 | 646 |
640 def _matchvalue(r): | 647 def _matchvalue(r): |
641 extra = repo[r].extra() | 648 extra = repo[r].extra() |
650 If you want to get all changesets affecting matched files exactly, | 657 If you want to get all changesets affecting matched files exactly, |
651 use ``file()`` predicate, because ``filelog()`` may omit some changesets | 658 use ``file()`` predicate, because ``filelog()`` may omit some changesets |
652 for performance reasons: see :hg:`help log` for detail. | 659 for performance reasons: see :hg:`help log` for detail. |
653 """ | 660 """ |
654 | 661 |
662 # i18n: "filelog" is a keyword | |
655 pat = getstring(x, _("filelog requires a pattern")) | 663 pat = getstring(x, _("filelog requires a pattern")) |
656 m = matchmod.match(repo.root, repo.getcwd(), [pat], default='relpath', | 664 m = matchmod.match(repo.root, repo.getcwd(), [pat], default='relpath', |
657 ctx=repo[None]) | 665 ctx=repo[None]) |
658 s = set() | 666 s = set() |
659 | 667 |
753 l = getargs(x, 1, -1, _("_matchfiles requires at least one argument")) | 761 l = getargs(x, 1, -1, _("_matchfiles requires at least one argument")) |
754 pats, inc, exc = [], [], [] | 762 pats, inc, exc = [], [], [] |
755 hasset = False | 763 hasset = False |
756 rev, default = None, None | 764 rev, default = None, None |
757 for arg in l: | 765 for arg in l: |
766 # i18n: "_matchfiles" is a keyword | |
758 s = getstring(arg, _("_matchfiles requires string arguments")) | 767 s = getstring(arg, _("_matchfiles requires string arguments")) |
759 prefix, value = s[:2], s[2:] | 768 prefix, value = s[:2], s[2:] |
760 if prefix == 'p:': | 769 if prefix == 'p:': |
761 pats.append(value) | 770 pats.append(value) |
762 elif prefix == 'i:': | 771 elif prefix == 'i:': |
763 inc.append(value) | 772 inc.append(value) |
764 elif prefix == 'x:': | 773 elif prefix == 'x:': |
765 exc.append(value) | 774 exc.append(value) |
766 elif prefix == 'r:': | 775 elif prefix == 'r:': |
767 if rev is not None: | 776 if rev is not None: |
777 # i18n: "_matchfiles" is a keyword | |
768 raise error.ParseError(_('_matchfiles expected at most one ' | 778 raise error.ParseError(_('_matchfiles expected at most one ' |
769 'revision')) | 779 'revision')) |
770 rev = value | 780 rev = value |
771 elif prefix == 'd:': | 781 elif prefix == 'd:': |
772 if default is not None: | 782 if default is not None: |
783 # i18n: "_matchfiles" is a keyword | |
773 raise error.ParseError(_('_matchfiles expected at most one ' | 784 raise error.ParseError(_('_matchfiles expected at most one ' |
774 'default mode')) | 785 'default mode')) |
775 default = value | 786 default = value |
776 else: | 787 else: |
788 # i18n: "_matchfiles" is a keyword | |
777 raise error.ParseError(_('invalid _matchfiles prefix: %s') % prefix) | 789 raise error.ParseError(_('invalid _matchfiles prefix: %s') % prefix) |
778 if not hasset and matchmod.patkind(value) == 'set': | 790 if not hasset and matchmod.patkind(value) == 'set': |
779 hasset = True | 791 hasset = True |
780 if not default: | 792 if not default: |
781 default = 'glob' | 793 default = 'glob' |
934 return [r for r in subset if r == rn] | 946 return [r for r in subset if r == rn] |
935 | 947 |
936 def obsolete(repo, subset, x): | 948 def obsolete(repo, subset, x): |
937 """``obsolete()`` | 949 """``obsolete()`` |
938 Mutable changeset with a newer version.""" | 950 Mutable changeset with a newer version.""" |
951 # i18n: "obsolete" is a keyword | |
939 getargs(x, 0, 0, _("obsolete takes no arguments")) | 952 getargs(x, 0, 0, _("obsolete takes no arguments")) |
940 return [r for r in subset if repo[r].obsolete()] | 953 return [r for r in subset if repo[r].obsolete()] |
941 | 954 |
942 def origin(repo, subset, x): | 955 def origin(repo, subset, x): |
943 """``origin([set])`` | 956 """``origin([set])`` |
1076 return [] | 1089 return [] |
1077 | 1090 |
1078 def public(repo, subset, x): | 1091 def public(repo, subset, x): |
1079 """``public()`` | 1092 """``public()`` |
1080 Changeset in public phase.""" | 1093 Changeset in public phase.""" |
1094 # i18n: "public" is a keyword | |
1081 getargs(x, 0, 0, _("public takes no arguments")) | 1095 getargs(x, 0, 0, _("public takes no arguments")) |
1082 pc = repo._phasecache | 1096 pc = repo._phasecache |
1083 return [r for r in subset if pc.phase(repo, r) == phases.public] | 1097 return [r for r in subset if pc.phase(repo, r) == phases.public] |
1084 | 1098 |
1085 def remote(repo, subset, x): | 1099 def remote(repo, subset, x): |
1162 (i.e. it matches the main metadata fields). | 1176 (i.e. it matches the main metadata fields). |
1163 | 1177 |
1164 ``metadata`` is the default field which is used when no fields are | 1178 ``metadata`` is the default field which is used when no fields are |
1165 specified. You can match more than one field at a time. | 1179 specified. You can match more than one field at a time. |
1166 """ | 1180 """ |
1181 # i18n: "matching" is a keyword | |
1167 l = getargs(x, 1, 2, _("matching takes 1 or 2 arguments")) | 1182 l = getargs(x, 1, 2, _("matching takes 1 or 2 arguments")) |
1168 | 1183 |
1169 revs = getset(repo, xrange(len(repo)), l[0]) | 1184 revs = getset(repo, xrange(len(repo)), l[0]) |
1170 | 1185 |
1171 fieldlist = ['metadata'] | 1186 fieldlist = ['metadata'] |
1172 if len(l) > 1: | 1187 if len(l) > 1: |
1173 fieldlist = getstring(l[1], | 1188 fieldlist = getstring(l[1], |
1189 # i18n: "matching" is a keyword | |
1174 _("matching requires a string " | 1190 _("matching requires a string " |
1175 "as its second argument")).split() | 1191 "as its second argument")).split() |
1176 | 1192 |
1177 # Make sure that there are no repeated fields, | 1193 # Make sure that there are no repeated fields, |
1178 # expand the 'special' 'metadata' field type | 1194 # expand the 'special' 'metadata' field type |
1226 } | 1242 } |
1227 for info in fields: | 1243 for info in fields: |
1228 getfield = _funcs.get(info, None) | 1244 getfield = _funcs.get(info, None) |
1229 if getfield is None: | 1245 if getfield is None: |
1230 raise error.ParseError( | 1246 raise error.ParseError( |
1247 # i18n: "matching" is a keyword | |
1231 _("unexpected field name passed to matching: %s") % info) | 1248 _("unexpected field name passed to matching: %s") % info) |
1232 getfieldfuncs.append(getfield) | 1249 getfieldfuncs.append(getfield) |
1233 # convert the getfield array of functions into a "getinfo" function | 1250 # convert the getfield array of functions into a "getinfo" function |
1234 # which returns an array of field values (or a single value if there | 1251 # which returns an array of field values (or a single value if there |
1235 # is only one field to match) | 1252 # is only one field to match) |
1268 return [r for r in subset if r not in cs] | 1285 return [r for r in subset if r not in cs] |
1269 | 1286 |
1270 def secret(repo, subset, x): | 1287 def secret(repo, subset, x): |
1271 """``secret()`` | 1288 """``secret()`` |
1272 Changeset in secret phase.""" | 1289 Changeset in secret phase.""" |
1290 # i18n: "secret" is a keyword | |
1273 getargs(x, 0, 0, _("secret takes no arguments")) | 1291 getargs(x, 0, 0, _("secret takes no arguments")) |
1274 pc = repo._phasecache | 1292 pc = repo._phasecache |
1275 return [r for r in subset if pc.phase(repo, r) == phases.secret] | 1293 return [r for r in subset if pc.phase(repo, r) == phases.secret] |
1276 | 1294 |
1277 def sort(repo, subset, x): | 1295 def sort(repo, subset, x): |
1289 """ | 1307 """ |
1290 # i18n: "sort" is a keyword | 1308 # i18n: "sort" is a keyword |
1291 l = getargs(x, 1, 2, _("sort requires one or two arguments")) | 1309 l = getargs(x, 1, 2, _("sort requires one or two arguments")) |
1292 keys = "rev" | 1310 keys = "rev" |
1293 if len(l) == 2: | 1311 if len(l) == 2: |
1312 # i18n: "sort" is a keyword | |
1294 keys = getstring(l[1], _("sort spec must be a string")) | 1313 keys = getstring(l[1], _("sort spec must be a string")) |
1295 | 1314 |
1296 s = l[0] | 1315 s = l[0] |
1297 keys = keys.split() | 1316 keys = keys.split() |
1298 l = [] | 1317 l = [] |
1404 return tag(repo, subset, x) | 1423 return tag(repo, subset, x) |
1405 | 1424 |
1406 def unstable(repo, subset, x): | 1425 def unstable(repo, subset, x): |
1407 """``unstable()`` | 1426 """``unstable()`` |
1408 Unstable changesets are non-obsolete with obsolete descendants.""" | 1427 Unstable changesets are non-obsolete with obsolete descendants.""" |
1428 # i18n: "unstable" is a keyword | |
1409 getargs(x, 0, 0, _("unstable takes no arguments")) | 1429 getargs(x, 0, 0, _("unstable takes no arguments")) |
1410 unstableset = set(repo.revs('(obsolete()::) - obsolete()')) | 1430 unstableset = set(repo.revs('(obsolete()::) - obsolete()')) |
1411 return [r for r in subset if r in unstableset] | 1431 return [r for r in subset if r in unstableset] |
1412 | 1432 |
1413 | 1433 |