Mercurial > hg > mercurial-talk
changeset 298:6420e2bdb651
More rough slides on revsets
author | Martin Geisler <mg@aragost.com> |
---|---|
date | Tue, 07 Jun 2011 17:37:10 +0200 |
parents | ea1ac2e3a637 |
children | 014624bcbac4 |
files | revset-talk.tex |
diffstat | 1 files changed, 109 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/revset-talk.tex +++ b/revset-talk.tex @@ -26,48 +26,101 @@ \subsection{Predicates} -\begin{frame}{Predicates} - all() - closed() - head() - merge() - author(string) - date(interval) +\begin{frame}[fragile]{Predicates} + Predicates select changesets for inclusion in the resulting set: + \begin{itemize} + \item Changeset metadata: \cmd{closed()}, \cmd{head()}, + \cmd{merge()}, \cmd{author(string)}, \cmd{date(interval)}, + +Closed heads: +\begin{lstlisting} +$ hg log -r "head() and closed()" +\end{lstlisting} + +Reopened branches: +\begin{lstlisting} +$ hg log -r "closed() and not head()" +\end{lstlisting} + +\begin{lstlisting} +$ hg log -r "author('Martin') and merge()" +\end{lstlisting} + + \end{itemize} + bisected(string) - branch(string or set) grep(regex) keyword(string) - adds(pattern) - contains(pattern) - file(pattern) - filelog(pattern) - modifies(pattern) - removes(pattern) - tag([name]) + + \cmd{adds(pattern)} + \cmd{contains(pattern)} + \cmd{file(pattern)} + \cmd{filelog(pattern)} + \cmd{modifies(pattern)} + \cmd{removes(pattern)} + + \end{frame} + + \begin{frame}{Functions} ancestor(single, single) ancestors(set) - bookmark([name]) children(set) descendants(set) follow([file]) + heads(set) - id(string) - last(set, n) - limit(set, n) - max(set) - min(set) + outgoing([path]) + p1([set]) p2([set]) parents([set]) present(set) - rev(number) - reverse(set) roots(set) - sort(set[, [-]key...]) +\end{frame} + +\begin{frame}{Final Touches on Your Query} + Trimming, cutting, manipulating the set: + \begin{itemize}[<+->] + \item \cmd{max(set)}, \cmd{min(set)}: the changeset with + minimum/maximum revision number in the set + \item \cmd{reverse(set)}: the set is an ordered set; this reverses + it + \item \cmd{limit(set, n)}, \cmd{last(set, n)}: the first/last + $n$ changesets + \item \cmd{sort(set[, [-]key...])}: sorting the set by revision + number, branch name, changeset message, user name, or date + \end{itemize} +\end{frame} + +\begin{frame}[fragile]{Solving Ambiguities} + When you do \cmd{hg log -r "foo"}, Mercurial checks + \begin{enumerate} + %\item revision number + %\item full changeset ID + \item is \cmd{foo} a bookmark? + \item is \cmd{foo} a tag? + \item is \cmd{foo} a branch name? + %\item partial changeset ID + \end{enumerate} + First match wins. + + You can override this using predicates: + \begin{itemize}[<+->] + %\item \cmd{rev(number)} + %\item \cmd{id(hash)} + \item \cmd{bookmark([name])}, \cmd{tag([name])}: the changeset with + the given bookmark or tag, or all bookmarked/tagged changesets + \item \cmd{branch(name)}: changesets on the given branch + \item \cmd{branch(set)}: changesets on the branches of the given set, + normally used with a single changeset: +\begin{lstlisting} +$ hg log -r "branch(tip)" +\end{lstlisting} + \end{itemize} \end{frame} \subsection{Operators} @@ -76,6 +129,33 @@ \end{frame} +\begin{frame}[fragile]{Examples} + \begin{itemize} + \item Changes that need to be merged into the default branch: +\begin{lstlisting} +$ hg log -r "ancestors(stable) - ancestors(default)" +$ hg log -r "::stable - ::default" +\end{lstlisting} + +\item Heads on the current branch: +\begin{lstlisting} +$ hg log -r "head() and branch(.)" +\end{lstlisting} + +\item Open heads on the current branch: +\begin{lstlisting} +$ hg log -r "head() and branch(.) and not closed()" +\end{lstlisting} + +\item Bugfixes that are not in a tagged release: +\begin{lstlisting} +$ hg log -r "keyword(bug) and not ::tagged()" +\end{lstlisting} + + + \end{itemize} +\end{frame} + \section{File Sets} @@ -101,8 +181,8 @@ A logo.png \end{lstlisting} -How do you see the change to \path{index.html} without seeing the -(binary) diff of \path{logo.png}? You do: +How do you see the change to \path{index.html} without seeing the diff +of the added \path{logo.png} file? You do: \begin{lstlisting} $ hg diff $(hg status --no-status --modified) \end{lstlisting} @@ -142,7 +222,7 @@ \end{itemize} Remember that this also works on old revisions: \begin{lstlisting} -$ hg status -r 1.0:2.0 "set:glob(src/*.h)" +$ hg status -r 1.0::2.0 "set:glob(src/*.h)" A src/foo.h M src/bar.h \end{lstlisting} @@ -225,3 +305,5 @@ \setcounter{framenumber}{\value{finalframe}} \end{document} + +% LocalWords: changeset changesets