view mercurial.tex @ 157:8f625aa11c10

Split off slides on centralized/distributed VCS.
author Martin Geisler <mg@aragost.com>
date Tue, 27 Apr 2010 09:19:16 +0200
parents 8e2b0c9522f5
children 1def7cfae69f
line wrap: on
line source

\documentclass[t,noamsthm,xcolor=dvipsnames]{beamer}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{pxfonts}

\usepackage{listings}
\lstdefinelanguage{hgshell}{
  moredelim=[l][\bfseries]{\%},
  moredelim=[il][\bfseries\color{red}]{|red>},
}
\lstset{
  language=hgshell,
  basicstyle=\footnotesize\ttfamily,
  columns=fixed,
  showstringspaces=false,
  frame=single,
  framerule=0.4pt,
  rulecolor=\color{white!50!black},
  %backgroundcolor=\color{white},
}

\usepackage{tikz}
\usetikzlibrary{chains,positioning,shapes,fit}
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}

\tikzstyle{branch}=[blue!60, ->, >=latex, line join=round]
\tikzstyle{tag}=[below, thick, draw=yellow!50!orange, fill=yellow!50]
\tikzstyle{timeline}=[thick, ->]
\tikzstyle{rev}=[rounded corners=1pt, minimum size=3mm,
  draw=red!50!black!50, top color=white, bottom color = red!50!black!20]
\tikzstyle{repository}=[cylinder,shape border rotate=90, draw=structure,
  shade, left color=structure!50, right color=structure!50,
  middle color=structure!10, aspect=0.15, minimum height=20mm,
  text width=20mm, text centered]
\tikzstyle{working copy}=[rounded corners, text width=15mm, inner sep=5pt,
  draw=yellow!40!red,
  top color=yellow!10!white,
  bottom color=yellow!20!white]
\tikzstyle{invisible}=[draw,opacity=0]
\tikzstyle{highlight}=[draw=structure, thick, inner sep=6pt, rounded corners]
\tikzstyle{short}=[shorten <=3pt, shorten >=3pt]
\tikzstyle{every join}=[->]

\mode<presentation>{
  \usefonttheme{structuresmallcapsserif}
  \setbeamercolor{structure}{fg=green!30!black}
  \setbeamertemplate{navigation symbols}{}
  \setbeamertemplate{footline}[frame number]
  \setbeamertemplate{background}{
    \begin{tikzpicture}<0->[overlay, remember picture]
      \node at (current page.center) {
        \includegraphics[height=0.9\textheight]{hg-droplets}
      };
      \fill[white,opacity=0.95] (current page.north west)
                      rectangle (current page.south east);

      \ifnum\thepage>1
      \usebeamercolor{page number in head/foot}
      \node[above right, color=fg, font=\tiny] at (current page.south west)
           {\includegraphics[height=2cm]{pixelman} aragost Trifork};
      \fi
    \end{tikzpicture}
  }
}
\mode<handout>{
  \usepackage{pgfpages}
  \pgfpagesuselayout{4 on 1}[a4paper,landscape,border shrink=5mm]
}

\AtBeginSection[]{
  \begin{frame}<beamer>{Outline}
    \tableofcontents[currentsection]
  \end{frame}
}

\title{Fast, Flexible and Fun:\\ Revision Control with Mercurial}
\author{Martin Geisler
  \texorpdfstring{\\$\langle$\texttt{mg@aragost.com}$\rangle$}
                 {<mg@aragost.com>}}
\date{UBS GeekNight\\ April 27, 2010}

\newcommand{\cmd}[1]{\texttt{\color{green!40!black}#1}}
\newcommand{\ext}[1]{\texttt{\color{orange!50!red}#1}}
\newcommand{\curl}[1]{\textcolor{CornflowerBlue!60!black}{\url{#1}}}

\begin{document}

\begin{frame}[plain]
  \maketitle
  \begin{tikzpicture}[overlay, remember picture]
    \node[above right] at (current page.south west)
         {\includegraphics[height=3cm]{pixelman-front}};
  \end{tikzpicture}
\end{frame}

\include{mg}

\begin{frame}{Outline}
  \tableofcontents
\end{frame}

\section{Introduction}

\include{features}

\include{why-distributed}

\include{mercurial-users}

\include{testimonials}

\include{branches}

\include{merging}

\include{key-commands}

\include{key-concepts}

\include{centralized}
\include{distributed}

\include{workflow-department}
\include{workflow-divisions}
\include{workflow-yourself}

\include{svn-branching}
\include{svn-merging}


\section{Using Mercurial}

\subsection{The Underlying Model}

\begin{frame}{The Underlying Model}
  A Mercurial changeset conceptually consist of:
  \begin{itemize}
  \item 0--2 parent changeset IDs:
    \begin{itemize}
    \item root changeset has no parents
    \item normal changesets have one parent
    \item merge changesets have two parents
    \end{itemize}
  \item date, username, commit message
  \item difference from first parent changeset
  \item changeset ID is computed as SHA-1 hash of the above
  \item makes it impossible to inject \alert{malicious code} on server
  \end{itemize}

  \begin{center}
    \begin{tikzpicture}[start chain]
      \tikzstyle{rev}+=[on chain, minimum size=5mm, font=\small]
      \tikzset{node distance=8mm and 10mm, on grid}

      \node[rev,join] {};
      \node[rev,join] {};
      \node[rev,join] (x) {};
      \node[rev,join, above right=of x] (y) {};
      \node[rev,join] (a) {};
      \node[rev,join=with x, below right=of x] (z) {};
      \node[rev,join] {};
      \node[rev,join] {};
      \node[rev,join] (w) {};
      \node[rev,join, above right=of w] (b) {};
      \node[rev,join] {};
      \draw[->] (a) to[out=0, in=150] (b);
    \end{tikzpicture}
  \end{center}
\end{frame}

\begin{frame}{Immutable History}
  SHA-1 hashes as changeset IDs have some consequences:
  \begin{itemize}
  \item a changeset ID is a hash of the entire history
  \item changing history changes subsequent changesets
  \item history is immutable, you can only make new history:
    \bigskip

    \begin{tikzpicture}[start chain]
      \tikzstyle{rev}+=[on chain, join, minimum size=6mm]
      \tikzset{node distance=10mm and 12mm, on grid}
      \node[rev] {$A$};
      \node[rev] {$B$};

      \begin{scope}[start branch=changed]
        \node<2->[rev,on chain=going below right] {$C'$};
        \node<2->[rev] {$D'$};
        \node<2->[rev] {$E'$};
      \end{scope}

      \only<3>{\tikzstyle{rev}+=[join=by {black!30!white},opacity=0.3]}
      \node[rev] {$C$};
      \node[rev] {$D$};
      \node[rev] {$E$};
    \end{tikzpicture}
  \end{itemize}
\end{frame}

\subsection{Workflows}

\include{central-workflow}

\subsection{Using History}

\begin{frame}{Browsing the History of a File}
  The \cmd{hg annotate} command is invaluable:
  \begin{itemize}
  \item you see when each line was introduced
  \item you can quickly jump back to earlier versions
  \end{itemize}
\end{frame}

\begin{frame}{Searching File Content}
  Ever wondered when a function was introduced?
  \begin{itemize}
  \item \cmd{hg grep} can help you!
  \item local access makes searching feasible
  \end{itemize}
\end{frame}

\include{bisect}

\section{Cool Extensions}

\begin{frame}[label=after-basics]{Mercurial is Extensible}
  You can add new functionality to Mercurial:
  \begin{itemize}
  \item ships with 30+ extensions
  \item wiki lists 75+ extensions
  \item extensions can change basically everything
  \item helps to keep the core small and focused
  \end{itemize}

  % \begin{itemize}
  % \item \ext{bugzilla} integrates with Bugzilla
  % \item \ext{color} enables  color output in terminals
  % \item \ext{gpg} manages GnuPG digital signatures
  % \item \ext{inotify} gives instant file status on Linux 2.6
  % \item \ext{keyword} expands keywords in working copy
  % \item \ext{parentrevspec} changes syntax for revisions
  % \end{itemize}
\end{frame}

\subsection{Changing History}

\include{rebase}

\include{mq}

\include{histedit}

\subsection{Talking to Other Systems}

\begin{frame}{Migrating History}
  The \ext{convert} extension can import history:
  \begin{itemize}
    \item CVS, SVN, Git, Bazaar, Darcs, \dots
    \item incremental conversion
    \item many options for fiddling with branches, authors, \dots
  \end{itemize}
  \pause

  Interestingly, \ext{convert} can import from Mercurial:
  \begin{itemize}
    % Break "--" to avoid them forming an en-dash...
  \item \cmd{-{}-filemap} lets you exclude and rename files
  \item \cmd{-{}-branchmap} lets you rename branches
  \end{itemize}
\end{frame}

\include{hgsubversion}

\include{hg-git}

\subsection{Third-Party Tools}

\begin{frame}{Third-Party Tools}
  Tools with Mercurial support:
  \begin{itemize}
  \item Shell integration: TortoiseHg (Windows, Mac, Linux)
  \item IDEs: Eclipse, NetBeans, IntelliJ, Visual Studio, Emacs\dots
  \item Project Support: Trac, JIRA, Maven, Hudson, BuildBot\dots
  \end{itemize}
\end{frame}

\include{demo}

\section{Wrapping Up}

\begin{frame}{Mercurial in a Nutshell}
  Mercurial changes the way you develop:
  \begin{itemize}
  \item simple yet strong model for \alert{both} branching and merging
  \item power tool instead of necessary evil
  \item light-weight and snappy
  \end{itemize}
\end{frame}

\begin{frame}{More Information}
  \begin{itemize}
  \item Mercurial homepage:\\
    \curl{http://mercurial.selenic.com/}
  \item \textsl{Mercurial: The Definitive Guide}:\\
    \curl{http://hgbook.red-bean.com/}
  \item Getting Started:\\
    \curl{http://mercurial.ch/}\\
    \curl{http://hginit.com/}
  \item Some free Mercurial hosting sites:\\
    \curl{http://bitbucket.org/}\\
    \curl{http://code.google.com/} \\
    \curl{http://sourceforge.net/}\\
    \curl{http://www.codeplex.com/} (Microsoft)
  \end{itemize}
\end{frame}

\begin{frame}{Contact}
  Please get in touch if you have more questions or have considered
  using Mercurial in your organization:
  \begin{itemize}
  \item Email: \curl{mg@aragost.com}
  \item IRC: \curl{mg} in \curl{\#mercurial} on \curl{irc.freenode.net}
  \end{itemize}

  \vfill

  \begin{center}
    \begin{tikzpicture}
      \node<2>[font=\Huge\bfseries, orange!50!red] {Thank you!};
    \end{tikzpicture}
  \end{center}
\end{frame}

% Send mail

\end{document}

% LocalWords:  SVN Makefile RCS CVS changeset changesets Changeset Changesets