Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 24419:0e41f110e69e
revset: add wdir() function to specify workingctx revision by command
The main purpose of wdir() is to annotate working-directory files.
Currently many commands and revsets cannot handle workingctx and may raise
exception. For example, -r ":wdir()" results in TypeError. This problem will
be addressed by future patches.
We could add "wdir" symbol instead, but it would conflict with the existing
tag, bookmark or branch. So I decided not to.
List of commands that will potentially support workingctx revision:
command default remarks
-------- ------- -----------------------------------------------------
annotate p1 useful
archive p1 might be useful
cat p1 might be useful on Windows (no cat)
diff p1:wdir (default)
export p1 might be useful if wctx can have draft commit message
files wdir (default)
grep tip:0 might be useful
identify wdir (default)
locate wdir (default)
log tip:0 might be useful with -p or -G option
parents wdir (default)
status wdir (default)
This patch includes minimal test of "hg status" that should be able to handle
the workingctx revision.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 16 Aug 2014 13:44:16 +0900 |
parents | 77fd1fb538cd |
children | 582cfcc843c7 |
comparison
equal
deleted
inserted
replaced
24417:f2e1e097cda1 | 24419:0e41f110e69e |
---|---|
1850 a regular expression. To match a user that actually contains `re:`, use | 1850 a regular expression. To match a user that actually contains `re:`, use |
1851 the prefix `literal:`. | 1851 the prefix `literal:`. |
1852 """ | 1852 """ |
1853 return author(repo, subset, x) | 1853 return author(repo, subset, x) |
1854 | 1854 |
1855 def wdir(repo, subset, x): | |
1856 """``wdir()`` | |
1857 Working directory. | |
1858 """ | |
1859 # i18n: "wdir" is a keyword | |
1860 getargs(x, 0, 0, _("wdir takes no arguments")) | |
1861 if None in subset: | |
1862 return baseset([None]) | |
1863 return baseset() | |
1864 | |
1855 # for internal use | 1865 # for internal use |
1856 def _list(repo, subset, x): | 1866 def _list(repo, subset, x): |
1857 s = getstring(x, "internal error") | 1867 s = getstring(x, "internal error") |
1858 if not s: | 1868 if not s: |
1859 return baseset() | 1869 return baseset() |
1945 "matching": matching, | 1955 "matching": matching, |
1946 "tag": tag, | 1956 "tag": tag, |
1947 "tagged": tagged, | 1957 "tagged": tagged, |
1948 "user": user, | 1958 "user": user, |
1949 "unstable": unstable, | 1959 "unstable": unstable, |
1960 "wdir": wdir, | |
1950 "_list": _list, | 1961 "_list": _list, |
1951 "_intlist": _intlist, | 1962 "_intlist": _intlist, |
1952 "_hexlist": _hexlist, | 1963 "_hexlist": _hexlist, |
1953 } | 1964 } |
1954 | 1965 |
2017 "matching", | 2028 "matching", |
2018 "tag", | 2029 "tag", |
2019 "tagged", | 2030 "tagged", |
2020 "user", | 2031 "user", |
2021 "unstable", | 2032 "unstable", |
2033 "wdir", | |
2022 "_list", | 2034 "_list", |
2023 "_intlist", | 2035 "_intlist", |
2024 "_hexlist", | 2036 "_hexlist", |
2025 ]) | 2037 ]) |
2026 | 2038 |