Mercurial > hg
comparison mercurial/revset.py @ 32085:2a2744dffecf stable
revset: add i18n comments to error messages for followlines predicate
This patch also includes un-quoting "descend" keyword for similarity
to other error messages (this seems too trivial as a separated patch).
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Mon, 01 May 2017 05:52:36 +0900 |
parents | 83527d9f1f13 |
children | bd872f64a8ba |
comparison
equal
deleted
inserted
replaced
32084:091d6b9157da | 32085:2a2744dffecf |
---|---|
924 rev = '.' | 924 rev = '.' |
925 if 'startrev' in args: | 925 if 'startrev' in args: |
926 revs = getset(repo, fullreposet(repo), args['startrev']) | 926 revs = getset(repo, fullreposet(repo), args['startrev']) |
927 if len(revs) != 1: | 927 if len(revs) != 1: |
928 raise error.ParseError( | 928 raise error.ParseError( |
929 # i18n: "followlines" is a keyword | |
929 _("followlines expects exactly one revision")) | 930 _("followlines expects exactly one revision")) |
930 rev = revs.last() | 931 rev = revs.last() |
931 | 932 |
932 pat = getstring(args['file'], _("followlines requires a pattern")) | 933 pat = getstring(args['file'], _("followlines requires a pattern")) |
933 if not matchmod.patkind(pat): | 934 if not matchmod.patkind(pat): |
934 fname = pathutil.canonpath(repo.root, repo.getcwd(), pat) | 935 fname = pathutil.canonpath(repo.root, repo.getcwd(), pat) |
935 else: | 936 else: |
936 m = matchmod.match(repo.root, repo.getcwd(), [pat], ctx=repo[rev]) | 937 m = matchmod.match(repo.root, repo.getcwd(), [pat], ctx=repo[rev]) |
937 files = [f for f in repo[rev] if m(f)] | 938 files = [f for f in repo[rev] if m(f)] |
938 if len(files) != 1: | 939 if len(files) != 1: |
940 # i18n: "followlines" is a keyword | |
939 raise error.ParseError(_("followlines expects exactly one file")) | 941 raise error.ParseError(_("followlines expects exactly one file")) |
940 fname = files[0] | 942 fname = files[0] |
941 | 943 |
944 # i18n: "followlines" is a keyword | |
942 lr = getrange(args['lines'][0], _("followlines expects a line range")) | 945 lr = getrange(args['lines'][0], _("followlines expects a line range")) |
943 fromline, toline = [getinteger(a, _("line range bounds must be integers")) | 946 fromline, toline = [getinteger(a, _("line range bounds must be integers")) |
944 for a in lr] | 947 for a in lr] |
945 fromline, toline = util.processlinerange(fromline, toline) | 948 fromline, toline = util.processlinerange(fromline, toline) |
946 | 949 |
947 fctx = repo[rev].filectx(fname) | 950 fctx = repo[rev].filectx(fname) |
948 descend = False | 951 descend = False |
949 if 'descend' in args: | 952 if 'descend' in args: |
950 descend = getboolean(args['descend'], | 953 descend = getboolean(args['descend'], |
951 _("'descend' argument must be a boolean")) | 954 # i18n: "descend" is a keyword |
955 _("descend argument must be a boolean")) | |
952 if descend: | 956 if descend: |
953 rs = generatorset( | 957 rs = generatorset( |
954 (c.rev() for c, _linerange | 958 (c.rev() for c, _linerange |
955 in context.blockdescendants(fctx, fromline, toline)), | 959 in context.blockdescendants(fctx, fromline, toline)), |
956 iterasc=True) | 960 iterasc=True) |