[PATCH 1 of 5] revset: rename rev argument of followlines() to startrev

Yuya Nishihara yuya at tcha.org
Fri Jan 13 15:15:50 UTC 2017


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1483946186 -32400
#      Mon Jan 09 16:16:26 2017 +0900
# Node ID 3f185500ff851abf3f5556a887d0a2ed9c26c2c6
# Parent  9fb57b8cbe55d0b7f7171e24e88b24c05085ccfa
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.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -1066,23 +1066,23 @@ def _followfirst(repo, subset, x):
     # of every revisions or files revisions.
     return _follow(repo, subset, x, '_followfirst', followfirst=True)
 
- at predicate('followlines(file, fromline, toline[, rev=.])', safe=True)
+ at predicate('followlines(file, fromline, toline[, startrev=.])', safe=True)
 def followlines(repo, subset, x):
     """Changesets modifying `file` in line range ('fromline', 'toline').
 
-    Line range corresponds to 'file' content at 'rev' and should hence be
-    consistent with file size. If rev is not specified, working directory's
+    Line range corresponds to 'file' content at 'startrev' and should hence be
+    consistent with file size. If startrev is not specified, working directory's
     parent is used.
     """
     from . import context  # avoid circular import issues
 
-    args = getargsdict(x, 'followlines', 'file *lines rev')
+    args = getargsdict(x, 'followlines', 'file *lines startrev')
     if len(args['lines']) != 2:
         raise error.ParseError(_("followlines takes at least three arguments"))
 
     rev = '.'
-    if 'rev' in args:
-        revs = getset(repo, fullreposet(repo), args['rev'])
+    if 'startrev' in args:
+        revs = getset(repo, fullreposet(repo), args['startrev'])
         if len(revs) != 1:
             raise error.ParseError(
                 _("followlines expects exactly one revision"))
diff --git a/tests/test-annotate.t b/tests/test-annotate.t
--- a/tests/test-annotate.t
+++ b/tests/test-annotate.t
@@ -490,11 +490,11 @@ Test followlines() revset
   16: baz:0
   19: baz:3
   20: baz:4
-  $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3, 5, rev=20)'
+  $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3, 5, startrev=20)'
   16: baz:0
   19: baz:3
   20: baz:4
-  $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3, 5, rev=.^)'
+  $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3, 5, startrev=.^)'
   16: baz:0
   19: baz:3
   $ printf "0\n0\n" | cat - baz > baz1
@@ -591,7 +591,7 @@ check error cases
   $ hg log -r 'followlines(baz, 1)'
   hg: parse error: followlines takes at least three arguments
   [255]
-  $ hg log -r 'followlines(baz, 1, 2, rev=desc("b"))'
+  $ hg log -r 'followlines(baz, 1, 2, startrev=desc("b"))'
   hg: parse error: followlines expects exactly one revision
   [255]
   $ hg log -r 'followlines("glob:*", 1, 2)'


More information about the Mercurial-devel mailing list