%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Version Control Systems % % Author: FOSSEE % Copyright (c) 2012, FOSSEE, IIT Bombay %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass[14pt,compress]{beamer} \mode { \usetheme{Warsaw} \useoutertheme{infolines} \setbeamercovered{transparent} } \usepackage[english]{babel} \usepackage[latin1]{inputenc} %\usepackage{times} \usepackage[T1]{fontenc} % Taken from Fernando's slides. \usepackage{ae,aecompl} \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet} \definecolor{darkgreen}{rgb}{0,0.5,0} \usepackage{listings} \lstset{language=bash, basicstyle=\ttfamily\bfseries, commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, showstringspaces=false, keywordstyle=\color{blue}\bfseries} \newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}} \newcommand{\typ}[1]{\lstinline{#1}} \newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} } \setbeamercolor{emphbar}{bg=blue!20, fg=black} \newcommand{\emphbar}[1] \author[Primal Pappachan] {} \institute[FOSSEE group] {} \date[IIT Bombay] {} \begin{document} \begin{frame} \begin{center} \vspace{15pt} \textcolor{blue}{\large Version Control Using Mercurial} \\ \textcolor{blue}{\huge Let there be a Repo!} \end{center} \vspace{15pt} \begin{center} \includegraphics[scale=0.95]{../images/fossee-logo.png}\\ \vspace{5pt} \scriptsize Developed by FOSSEE Team, IIT-Bombay. \\ \scriptsize Funded by National Mission on Education through ICT\\ \scriptsize MHRD, Govt. of India\\ \includegraphics[scale=0.15]{../images/iitb-logo.jpg}\\ \end{center} \end{frame} \begin{frame} \frametitle{Prerequisite} \begin{itemize} \item \textbf{Version Control Using Mercurial} \end{itemize} \end{frame} \begin{frame} \frametitle{Objectives} At the end of this tutorial, you will be able to do the following to a repository: \begin{itemize} \item Initialize it \item Obtain the status, \item Add new files to it, \item Take snapshots, \item View the history, \item \textcolor{blue}{And also} Set your user information for hg \end{itemize} \end{frame} \section{Let there be a Repo!} % init, status, commit, log, [ui] \begin{frame} \frametitle{We need a repo!} \begin{itemize} \item A Repository (repo) is where all the action is! \item Project files along with a special directory that stores all the changes \item We take snapshots of the whole repository; not individual files. \end{itemize} \end{frame} \begin{frame} \frametitle{Initializing a repo} \begin{itemize} \item \typ{\$ hg init} \item Creates a fresh repository \item Adds a \typ{.hg} directory to our \emph{working directory} \end{itemize} \emphbar{\typ{.hg} directory keeps log of changes made henceforth} \end{frame} \begin{frame} \frametitle{Status report} \begin{itemize} \item \typ{hg status} gives the status of our repo \item Use it often; at least as a beginner \item \typ{hg help command} gives us help about \typ{command} \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{Status codes} \begin{lstlisting} M = modified A = added R = removed C = clean ! = missing ? = not tracked I = ignored \end{lstlisting} \end{frame} \begin{frame} \frametitle{Adding files} \begin{itemize} \item From \typ{hg status} we know, none of the files are being tracked, yet. \item \typ{hg add} --- asking \typ{hg} to track these files \item As expected \typ{hg status} prepends an \typ{A} to the file names. \item \typ{? --> A} \item \typ{! --> R} (\typ{hg remove}) \end{itemize} \end{frame} \begin{frame} \frametitle{Taking Snapshots} \begin{itemize} \item \typ{hg commit} \item Asking Mercurial to take a snapshot; remember the changes made to the repository. \item \typ{-u FirstName LastName } \item \typ{-m ``Commit message''} -- a description of changes committed. \end{itemize} \end{frame} \begin{frame} \frametitle{Thumbnail views} \begin{itemize} \item \typ{hg log}~ gives the log of the changes made \item A \typ{changeset} is an atomic collection of changes to the files (between successive commits) \end{itemize} \begin{block}{Log information} \begin{itemize} \item \alert{changeset}: Identifier for the changeset \item \alert{user}: Details of user who created the changeset \item \alert{date}: Date and time of creation \item \alert{summary}: One line description \end{itemize} \end{block} \end{frame} \begin{frame} \frametitle{User information} \begin{itemize} \item User information is set in the \typ{hgrc} file \item It can be set globally or local to the project \item Global \typ{hgrc} \begin{itemize} \item \typ{\$HOME/.hgrc} -- Unix like systems \item \typ{\%HOME\%\\.hgrc} -- Windows \end{itemize} \end{itemize} \end{frame} \begin{frame} \frametitle{\alert{Advice}: \typ{commits}, messages} \begin{itemize} \item Atomic changes; one change with one \typ{commit} \item Single line summary --- 60 to 65 characters long \item Followed by paragraphs of detailed description \begin{itemize} \item Why the change? \item What does it effect? \item Known bugs/issues? \item etc. \end{itemize} \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{Summary...} \begin{itemize} \item How to initialize a new repository using hg init, \item Get the status of a repository using hg status and meaning of it's status codes \item Make commits of changes to files, using hg commit \item View the history of the repository using the hg log command, \item Set our user information in the global hgrc file. \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{Evaluation} \begin{enumerate} \item \small{How can you tell hg to stop tracking deleted files?} \item \small{What happens when 'hg commit' command is run first time without specifying username as parameter or creating the hg configuration file?} \item \small{ Here's a part of the output that is printed in 'hg log'.\\} \tiny{ changeset: 1:2278160e78d4 \\ tag: tip \\ user: Primal Pappachan \\ date: Sat Jan 26 22:16:53 2012 +0530 \\ summary: Added Readme \\} \small{Try to identify each component of this changeset and it's meaning. In the changeset, what is the significance of the number as well as hexadecimal string?} \end{enumerate} \end{frame} \begin{frame} \frametitle{Solutions} \begin{enumerate} \item \small{hg remove} \item \small{Initially it looks for the EMAIL environment variable, if it does not exist it tries to use a combination of local user name and host name. If both mechanisms fails, an error message will be printed and user will not be allowed to commit.} \item \small{The revision number is a handy notation that is only valid in that repository. The hexadecimal string is the permanent, unchanging identifier that will always identify that exact changeset in every copy of the repository} \end{enumerate} \end{frame} \begin{frame} \begin{block}{} \begin{center} \textcolor{blue}{\Large THANK YOU!} \end{center} \end{block} \begin{block}{} \begin{center} For more Information, visit our website\\ \url{http://fossee.in/} \end{center} \end{block} \end{frame} \end{document}