changeset 12:d474c4216b3b

First steps with Mercurial.
author Martin Geisler <mg@lazybytes.net>
date Sun, 16 Aug 2009 12:07:47 +0200
parents 4e7064117f64
children 60b3fbefbd0e
files mercurial.tex
diffstat 1 files changed, 106 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial.tex
+++ b/mercurial.tex
@@ -1,5 +1,22 @@
 \documentclass[t,noamsthm]{beamer}
 
+\usepackage{listings}
+
+\lstdefinelanguage{hgshell}{
+  moredelim=[l][\bfseries\color{green!50!black}]{\%},
+}
+
+\lstset{
+  language=hgshell,
+  basicstyle=\footnotesize\ttfamily,
+  columns=fixed,
+  showstringspaces=false,
+  frame=single,
+  framerule=0.8pt,
+  rulecolor=\color{white!50!black},
+  %backgroundcolor=\color{white},
+}
+
 \usepackage{tikz}
 \usetikzlibrary{chains,positioning,shapes}
 \tikzstyle{every picture}=[thick]
@@ -45,7 +62,7 @@
 \title{Mercurial}
 \author{Martin Geisler}
 
-\newcommand{\hgcmd}[1]{\texttt{#1}}
+\newcommand{\hgcmd}[1]{\texttt{\color{green!50!black}#1}}
 \newcommand{\hgext}[1]{\texttt{#1}}
 
 \begin{document}
@@ -350,9 +367,95 @@
 
 \subsection{Getting Started}
 
-\begin{frame}{Creating a Repository}
+\begin{frame}
+  \begin{center}
+    \vfill
+    \huge\bfseries Live Demo!
+    \vfill
+    \hyperlink{after-basics}{\beamerskipbutton{continue}}
+  \end{center}
+\end{frame}
+
+\begin{frame}[fragile]{Getting Started}
+  We will create a \path{hello-world} project:
+\begin{lstlisting}
+% hg init hello-world
+% cd hello-world
+\end{lstlisting}
+
+A new repository is of course empty:
+\begin{lstlisting}
+% hg log
+\end{lstlisting}
+and has a clean status:
+\begin{lstlisting}
+% hg status
+\end{lstlisting}
 \end{frame}
 
+\begin{frame}[fragile]{Adding Files}
+  We copy some ready-made files into the working coyp:
+\begin{lstlisting}
+% cp ../hello-files/* .
+% hg status
+? Makefile
+? hello.c
+\end{lstlisting}
+
+Put the new files under revision control:
+\begin{lstlisting}
+% hg add
+adding Makefile
+adding hello.c
+% hg status
+A Makefile
+A hello.c
+\end{lstlisting}
+\end{frame}
+
+\begin{frame}[fragile]{Making a Commit}
+We can now commit the changes shown by \hgcmd{hg status}:
+\begin{lstlisting}
+% hg commit -m "Imported source code."
+\end{lstlisting}
+
+The changeset is shown in \hgcmd{hg log}:
+\begin{lstlisting}
+% hg log
+changeset:   0:9cef08a0e941
+tag:         tip
+user:        Martin Geisler <mg@lazybytes.net>
+date:        Sun Aug 16 00:22:11 2009 +0200
+summary:     Imported source code.
+\end{lstlisting}
+\end{frame}
+
+\begin{frame}[fragile]{Examining Differences}
+Change the output from ``hello, world'' to ``Hello World!''.
+
+Mercurial will list the file as changed:
+\begin{lstlisting}
+% hg stat
+M hello.c
+\end{lstlisting}
+and can list the change:
+\begin{lstlisting}
+% hg diff
+diff -r 9cef08a0e941 hello.c
+--- a/hello.c   Sun Aug 16 00:22:11 2009 +0200
++++ b/hello.c   Sun Aug 16 01:21:15 2009 +0200
+@@ -1,5 +1,5 @@
+ #include <stdio.h>
+ 
+ int main(void) {
+-    printf("hello, world\n");
++    printf("Hello World!\n");
+ }
+\end{lstlisting}
+
+\end{frame}
+
+
 \begin{frame}{Settings}
 \end{frame}
 
@@ -369,7 +472,7 @@
 \begin{frame}{Merging}
 \end{frame}
 
-\begin{frame}{Consistency and Subversion}
+\begin{frame}[label=after-basics]{Consistency and Subversion}
 \end{frame}
 
 \section{Cool Extensions}