Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 20289:96be25f1da45
revset: add explanation about the pattern without explicit kind
Before this patch, online help of "adds()", "contains()", "filelog()",
"file()", "modifies()" and "removes()" predicates doesn't explain
about how the pattern without explicit kind like "glob:" is treated,
even though each predicates treat it differently:
- as "relpath:" by "adds()", "modifies()" and "removes()"
- as "glob:" by "file()"
- as special by "contains()" and "filelog()"
- be relative to cwd, and
- match against a file exactly
("relpath:" matches also against a directory)
This may confuse users.
This patch adds explanation about the pattern without explicit kind
to these predicates.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Fri, 17 Jan 2014 23:55:11 +0900 |
parents | b61ad01c4e73 |
children | a6cf48b2880d c57c9cece645 |
comparison
equal
deleted
inserted
replaced
20288:b61ad01c4e73 | 20289:96be25f1da45 |
---|---|
268 # functions | 268 # functions |
269 | 269 |
270 def adds(repo, subset, x): | 270 def adds(repo, subset, x): |
271 """``adds(pattern)`` | 271 """``adds(pattern)`` |
272 Changesets that add a file matching pattern. | 272 Changesets that add a file matching pattern. |
273 | |
274 The pattern without explicit kind like ``glob:`` is expected to be | |
275 relative to the current directory and match against a file or a | |
276 directory. | |
273 """ | 277 """ |
274 # i18n: "adds" is a keyword | 278 # i18n: "adds" is a keyword |
275 pat = getstring(x, _("adds requires a pattern")) | 279 pat = getstring(x, _("adds requires a pattern")) |
276 return checkstatus(repo, subset, pat, 1) | 280 return checkstatus(repo, subset, pat, 1) |
277 | 281 |
524 | 528 |
525 def contains(repo, subset, x): | 529 def contains(repo, subset, x): |
526 """``contains(pattern)`` | 530 """``contains(pattern)`` |
527 Revision contains a file matching pattern. See :hg:`help patterns` | 531 Revision contains a file matching pattern. See :hg:`help patterns` |
528 for information about file patterns. | 532 for information about file patterns. |
533 | |
534 The pattern without explicit kind like ``glob:`` is expected to be | |
535 relative to the current directory and match against a file exactly | |
536 for efficiency. | |
529 """ | 537 """ |
530 # i18n: "contains" is a keyword | 538 # i18n: "contains" is a keyword |
531 pat = getstring(x, _("contains requires a pattern")) | 539 pat = getstring(x, _("contains requires a pattern")) |
532 s = [] | 540 s = [] |
533 if not matchmod.patkind(pat): | 541 if not matchmod.patkind(pat): |
711 Changesets connected to the specified filelog. | 719 Changesets connected to the specified filelog. |
712 | 720 |
713 For performance reasons, ``filelog()`` does not show every changeset | 721 For performance reasons, ``filelog()`` does not show every changeset |
714 that affects the requested file(s). See :hg:`help log` for details. For | 722 that affects the requested file(s). See :hg:`help log` for details. For |
715 a slower, more accurate result, use ``file()``. | 723 a slower, more accurate result, use ``file()``. |
724 | |
725 The pattern without explicit kind like ``glob:`` is expected to be | |
726 relative to the current directory and match against a file exactly | |
727 for efficiency. | |
716 """ | 728 """ |
717 | 729 |
718 # i18n: "filelog" is a keyword | 730 # i18n: "filelog" is a keyword |
719 pat = getstring(x, _("filelog requires a pattern")) | 731 pat = getstring(x, _("filelog requires a pattern")) |
720 s = set() | 732 s = set() |
866 """``file(pattern)`` | 878 """``file(pattern)`` |
867 Changesets affecting files matched by pattern. | 879 Changesets affecting files matched by pattern. |
868 | 880 |
869 For a faster but less accurate result, consider using ``filelog()`` | 881 For a faster but less accurate result, consider using ``filelog()`` |
870 instead. | 882 instead. |
883 | |
884 This predicate uses ``glob:`` as the default kind of pattern. | |
871 """ | 885 """ |
872 # i18n: "file" is a keyword | 886 # i18n: "file" is a keyword |
873 pat = getstring(x, _("file requires a pattern")) | 887 pat = getstring(x, _("file requires a pattern")) |
874 return _matchfiles(repo, subset, ('string', 'p:' + pat)) | 888 return _matchfiles(repo, subset, ('string', 'p:' + pat)) |
875 | 889 |
1001 return [] | 1015 return [] |
1002 | 1016 |
1003 def modifies(repo, subset, x): | 1017 def modifies(repo, subset, x): |
1004 """``modifies(pattern)`` | 1018 """``modifies(pattern)`` |
1005 Changesets modifying files matched by pattern. | 1019 Changesets modifying files matched by pattern. |
1020 | |
1021 The pattern without explicit kind like ``glob:`` is expected to be | |
1022 relative to the current directory and match against a file or a | |
1023 directory. | |
1006 """ | 1024 """ |
1007 # i18n: "modifies" is a keyword | 1025 # i18n: "modifies" is a keyword |
1008 pat = getstring(x, _("modifies requires a pattern")) | 1026 pat = getstring(x, _("modifies requires a pattern")) |
1009 return checkstatus(repo, subset, pat, 0) | 1027 return checkstatus(repo, subset, pat, 0) |
1010 | 1028 |
1214 return [] | 1232 return [] |
1215 | 1233 |
1216 def removes(repo, subset, x): | 1234 def removes(repo, subset, x): |
1217 """``removes(pattern)`` | 1235 """``removes(pattern)`` |
1218 Changesets which remove files matching pattern. | 1236 Changesets which remove files matching pattern. |
1237 | |
1238 The pattern without explicit kind like ``glob:`` is expected to be | |
1239 relative to the current directory and match against a file or a | |
1240 directory. | |
1219 """ | 1241 """ |
1220 # i18n: "removes" is a keyword | 1242 # i18n: "removes" is a keyword |
1221 pat = getstring(x, _("removes requires a pattern")) | 1243 pat = getstring(x, _("removes requires a pattern")) |
1222 return checkstatus(repo, subset, pat, 2) | 1244 return checkstatus(repo, subset, pat, 2) |
1223 | 1245 |