[PATCH] help: clarify distinction among `contains`/`file`/`filelog`

Greg Hurrell greg at hurrell.net
Mon Apr 28 17:22:05 CDT 2014


# HG changeset patch
# User Greg Hurrell <glh at fb.com>
# Date 1398722963 25200
#      Mon Apr 28 15:09:23 2014 -0700
# Branch stable
# Node ID 0636a785b24d45923b50d694ba2937cddd4d3af5
# Parent  bcfd44abad933390b1b21d7ffcd107fca0023dd2
help: clarify distinction among `contains`/`file`/`filelog`

For a Mercurial new-comer, the distinction between `contains(x)`, `file(x)`, and
`filelog(x)` in the "revsets" help page may not be obvious. This commit tries to
make things more obvious (text based on an explanation from Matt in an FB group
thread).

diff -r bcfd44abad93 -r 0636a785b24d mercurial/revset.py
--- a/mercurial/revset.py	Mon Apr 21 16:13:15 2014 -0700
+++ b/mercurial/revset.py	Mon Apr 28 15:09:23 2014 -0700
@@ -585,8 +585,8 @@
 
 def contains(repo, subset, x):
     """``contains(pattern)``
-    Revision contains a file matching pattern. See :hg:`help patterns`
-    for information about file patterns.
+    The revision's manifest contains a file matching pattern (but might not
+    modify it). See :hg:`help patterns` for information about file patterns.
 
     The pattern without explicit kind like ``glob:`` is expected to be
     relative to the current directory and match against a file exactly
@@ -784,9 +784,10 @@
     """``filelog(pattern)``
     Changesets connected to the specified filelog.
 
-    For performance reasons, ``filelog()`` does not show every changeset
-    that affects the requested file(s). See :hg:`help log` for details. For
-    a slower, more accurate result, use ``file()``.
+    For performance reasons, visits only revisions mentioned in the file-level
+    filelog, rather than filtering through all changesets (much faster, but
+    doesn't include deletes or duplicate changes). For a slower, more accurate
+    result, use ``file()``.
 
     The pattern without explicit kind like ``glob:`` is expected to be
     relative to the current directory and match against a file exactly


More information about the Mercurial-devel mailing list