comparison mercurial/revset.py @ 30800:cd23879cbac7

revset: rename rev argument of followlines() to startrev The rev argument has the same meaning as startrev of follow(), and I think startrev is more informative. followlines() is new function, we can make BC now.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 09 Jan 2017 16:16:26 +0900
parents 0b49449a01f4
children 67ee7874e53b
comparison
equal deleted inserted replaced
30799:0b49449a01f4 30800:cd23879cbac7
1064 # ``followfirst([pattern[, startrev]])`` 1064 # ``followfirst([pattern[, startrev]])``
1065 # Like ``follow([pattern[, startrev]])`` but follows only the first parent 1065 # Like ``follow([pattern[, startrev]])`` but follows only the first parent
1066 # of every revisions or files revisions. 1066 # of every revisions or files revisions.
1067 return _follow(repo, subset, x, '_followfirst', followfirst=True) 1067 return _follow(repo, subset, x, '_followfirst', followfirst=True)
1068 1068
1069 @predicate('followlines(file, fromline, toline[, rev=.])', safe=True) 1069 @predicate('followlines(file, fromline, toline[, startrev=.])', safe=True)
1070 def followlines(repo, subset, x): 1070 def followlines(repo, subset, x):
1071 """Changesets modifying `file` in line range ('fromline', 'toline'). 1071 """Changesets modifying `file` in line range ('fromline', 'toline').
1072 1072
1073 Line range corresponds to 'file' content at 'rev' and should hence be 1073 Line range corresponds to 'file' content at 'startrev' and should hence be
1074 consistent with file size. If rev is not specified, working directory's 1074 consistent with file size. If startrev is not specified, working directory's
1075 parent is used. 1075 parent is used.
1076 """ 1076 """
1077 from . import context # avoid circular import issues 1077 from . import context # avoid circular import issues
1078 1078
1079 args = getargsdict(x, 'followlines', 'file *lines rev') 1079 args = getargsdict(x, 'followlines', 'file *lines startrev')
1080 if len(args['lines']) != 2: 1080 if len(args['lines']) != 2:
1081 raise error.ParseError(_("followlines takes at least three arguments")) 1081 raise error.ParseError(_("followlines takes at least three arguments"))
1082 1082
1083 rev = '.' 1083 rev = '.'
1084 if 'rev' in args: 1084 if 'startrev' in args:
1085 revs = getset(repo, fullreposet(repo), args['rev']) 1085 revs = getset(repo, fullreposet(repo), args['startrev'])
1086 if len(revs) != 1: 1086 if len(revs) != 1:
1087 raise error.ParseError( 1087 raise error.ParseError(
1088 _("followlines expects exactly one revision")) 1088 _("followlines expects exactly one revision"))
1089 rev = revs.last() 1089 rev = revs.last()
1090 1090