Show More
@@ -1078,19 +1078,19 b' def followlines(repo, subset, x):' | |||||
1078 | """ |
|
1078 | """ | |
1079 | from . import context # avoid circular import issues |
|
1079 | from . import context # avoid circular import issues | |
1080 |
|
1080 | |||
1081 | args = getargs(x, 3, 4, _("followlines takes at least three arguments")) |
|
1081 | args = getargsdict(x, 'followlines', 'file *lines rev') | |
|
1082 | if len(args['lines']) != 2: | |||
|
1083 | raise error.ParseError(_("followlines takes at least three arguments")) | |||
1082 |
|
1084 | |||
1083 | rev = '.' |
|
1085 | rev = '.' | |
1084 |
if |
|
1086 | if 'rev' in args: | |
1085 | revarg = getargsdict(args[3], 'followlines', 'rev') |
|
1087 | revs = getset(repo, fullreposet(repo), args['rev']) | |
1086 |
if |
|
1088 | if len(revs) != 1: | |
1087 | revs = getset(repo, fullreposet(repo), revarg['rev']) |
|
1089 | raise error.ParseError( | |
1088 | if len(revs) != 1: |
|
1090 | _("followlines expects exactly one revision")) | |
1089 | raise error.ParseError( |
|
1091 | rev = revs.last() | |
1090 | _("followlines expects exactly one revision")) |
|
1092 | ||
1091 | rev = revs.last() |
|
1093 | pat = getstring(args['file'], _("followlines requires a pattern")) | |
1092 |
|
||||
1093 | pat = getstring(args[0], _("followlines requires a pattern")) |
|
|||
1094 | if not matchmod.patkind(pat): |
|
1094 | if not matchmod.patkind(pat): | |
1095 | fname = pathutil.canonpath(repo.root, repo.getcwd(), pat) |
|
1095 | fname = pathutil.canonpath(repo.root, repo.getcwd(), pat) | |
1096 | else: |
|
1096 | else: | |
@@ -1101,7 +1101,7 b' def followlines(repo, subset, x):' | |||||
1101 | fname = files[0] |
|
1101 | fname = files[0] | |
1102 |
|
1102 | |||
1103 | try: |
|
1103 | try: | |
1104 |
fromline, toline = [int(getsymbol(a)) for a in args[ |
|
1104 | fromline, toline = [int(getsymbol(a)) for a in args['lines']] | |
1105 | except ValueError: |
|
1105 | except ValueError: | |
1106 | raise error.ParseError(_("line range bounds must be integers")) |
|
1106 | raise error.ParseError(_("line range bounds must be integers")) | |
1107 | if toline - fromline < 0: |
|
1107 | if toline - fromline < 0: |
@@ -582,6 +582,15 b' merge' | |||||
582 | $ hg up 23 --quiet |
|
582 | $ hg up 23 --quiet | |
583 |
|
583 | |||
584 | check error cases |
|
584 | check error cases | |
|
585 | $ hg log -r 'followlines()' | |||
|
586 | hg: parse error: followlines takes at least 1 positional arguments | |||
|
587 | [255] | |||
|
588 | $ hg log -r 'followlines(baz)' | |||
|
589 | hg: parse error: followlines takes at least three arguments | |||
|
590 | [255] | |||
|
591 | $ hg log -r 'followlines(baz, 1)' | |||
|
592 | hg: parse error: followlines takes at least three arguments | |||
|
593 | [255] | |||
585 | $ hg log -r 'followlines(baz, 1, 2, rev=desc("b"))' |
|
594 | $ hg log -r 'followlines(baz, 1, 2, rev=desc("b"))' | |
586 | hg: parse error: followlines expects exactly one revision |
|
595 | hg: parse error: followlines expects exactly one revision | |
587 | [255] |
|
596 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now