versionControl/vcs.tex
changeset 138 a201667fa696
parent 95 958396664d34
child 143 fde473906aac
equal deleted inserted replaced
137:bec9a89f3b60 138:a201667fa696
    25 \usepackage[scaled=.95]{helvet}
    25 \usepackage[scaled=.95]{helvet}
    26 
    26 
    27 \definecolor{darkgreen}{rgb}{0,0.5,0}
    27 \definecolor{darkgreen}{rgb}{0,0.5,0}
    28 
    28 
    29 \usepackage{listings}
    29 \usepackage{listings}
    30 \lstset{language=Python,
    30 \lstset{language=bash,
    31     basicstyle=\ttfamily\bfseries,
    31     basicstyle=\ttfamily\bfseries,
    32     commentstyle=\color{red}\itshape,
    32     commentstyle=\color{red}\itshape,
    33   stringstyle=\color{darkgreen},
    33   stringstyle=\color{darkgreen},
    34   showstringspaces=false,
    34   showstringspaces=false,
    35   keywordstyle=\color{blue}\bfseries}
    35   keywordstyle=\color{blue}\bfseries}
    48 
    48 
    49 \newcommand{\typ}[1]{\lstinline{#1}}
    49 \newcommand{\typ}[1]{\lstinline{#1}}
    50 
    50 
    51 \newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
    51 \newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
    52 
    52 
    53 %%% This is from Fernando's setup.
       
    54 % \usepackage{color}
       
    55 % \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
       
    56 % % Use and configure listings package for nicely formatted code
       
    57 % \usepackage{listings}
       
    58 % \lstset{
       
    59 %    language=Python,
       
    60 %    basicstyle=\small\ttfamily,
       
    61 %    commentstyle=\ttfamily\color{blue},
       
    62 %    stringstyle=\ttfamily\color{orange},
       
    63 %    showstringspaces=false,
       
    64 %    breaklines=true,
       
    65 %    postbreak = \space\dots
       
    66 % }
       
    67 
       
    68 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
    69 % Title page
    53 % Title page
    70 \title[Version Control Systems]{SEES: Version Control Systems}
    54 \title[Version Control Systems]{SEES: Version Control Systems}
    71 
    55 
    72 \author[FOSSEE] {FOSSEE}
    56 \author[FOSSEE] {FOSSEE}
    73 
    57 
    74 \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
    58 \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
    75 \date[]{}
    59 \date[]{}
    76 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
    77 
       
    78 %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
       
    79 %\logo{\pgfuseimage{iitmlogo}}
       
    80 
       
    81 
       
    82 %% Delete this, if you do not want the table of contents to pop up at
       
    83 %% the beginning of each subsection:
       
    84 \AtBeginSubsection[]
       
    85 {
       
    86   \begin{frame}<beamer>
       
    87     \frametitle{Outline}
       
    88     \tableofcontents[currentsection,currentsubsection]
       
    89   \end{frame}
       
    90 }
       
    91 
    60 
    92 \AtBeginSection[]
    61 \AtBeginSection[]
    93 {
    62 {
    94   \begin{frame}<beamer>
    63   \begin{frame}<beamer>
    95     \frametitle{Outline}
    64     \frametitle{Outline}
    96     \tableofcontents[currentsection,currentsubsection]
    65     \tableofcontents[currentsection,currentsubsection]
    97   \end{frame}
    66   \end{frame}
    98 }
    67 }
    99 
    68 
   100 % If you wish to uncover everything in a step-wise fashion, uncomment
       
   101 % the following command: 
       
   102 %\beamerdefaultoverlayspecification{<+->}
       
   103 
       
   104 %%\includeonlyframes{current,current1,current2,current3,current4,current5,current6}
       
   105 
       
   106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    69 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   107 % DOCUMENT STARTS
    70 % DOCUMENT STARTS
   108 \begin{document}
    71 \begin{document}
   109 
    72 
   110 \begin{frame}
    73 \begin{frame}
   116   \frametitle{Outline}
    79   \frametitle{Outline}
   117   \tableofcontents
    80   \tableofcontents
   118   % You might wish to add the option [pausesections]
    81   % You might wish to add the option [pausesections]
   119 \end{frame}
    82 \end{frame}
   120 
    83 
   121 %% There are some %$ used just to minimise the effect of $ sign used in lstlisting. In emacs it looks unhealthy.
    84 %% There are some %$ used just to minimise the effect of $ sign used
       
    85 %% in lstlisting. In emacs it looks dirty. 
   122 
    86 
   123 % Introduction to course-need of version control, history, options available.
    87 % Introduction to course-need of version control, history, options available.
   124 \section{Introduction}
    88 \section{Introduction}
   125 
    89 
       
    90 \begin{frame}
       
    91   \frametitle{What is Version Control?}
       
    92   \begin{block}{}
       
    93     A way to track changes made to files over time, by keeping copies
       
    94     of files as we change them.
       
    95   \end{block}
       
    96 \end{frame}
       
    97 
   126 %% Home made version control system?
    98 %% Home made version control system?
   127 \begin{frame}[fragile]
    99 \begin{frame}[fragile]
   128   \frametitle{Home-brew}
   100   \frametitle{Home-brewed}
   129   \begin{center}
   101   \begin{center}
   130     \includegraphics[height=1.8in,width=4.2in]{folder.png}
   102     An example of a \typ{home-brew} Version Control system
       
   103     \includegraphics[height=1.8in,width=4.2in]{images/folder.png}
   131   \end{center}
   104   \end{center}
   132   \begin{lstlisting}
   105   \begin{lstlisting} 
   133 $ ls
   106 $ ls
   134 a.out  id1.txt  id2.txt  identifier.cpp  id.txt  lex  pda1.cpp  pda2.cpp  pda.cpp  pda.txt  string.txt
   107 a.out  id1.txt  id2.txt  identifier.cpp  id.txt  lex  pda1.cpp  pda2.cpp  pda.cpp  pda.txt  string.txt
   135   \end{lstlisting} %%$
   108   \end{lstlisting} %%$
   136     %%a screen-shot of folder with all crazy names.  
   109     %%a screen-shot of folder with all crazy names.
   137 \end{frame}
   110 \end{frame}
   138 
   111 
   139 \begin{frame}[fragile]
   112 \begin{frame}[fragile]
   140   \frametitle{Problems with such nomenclature}  
   113   \frametitle{Problems}  
   141   \begin{block}{}    
   114   \begin{block}{}    
   142   \begin{itemize}
   115   \begin{itemize}
   143   \item Difficult to relate to content of file.
   116   \item Name and changes made are not related or linked. 
   144   \item Cant track changes done to file.
   117   \item Can't track sequence of changes made to a file. 
   145   \item It wont scale.
   118   \item Does not scale. 
   146   \end{itemize}
   119   \end{itemize}
   147     \end{block}
   120     \end{block}
   148 \end{frame}
   121 \end{frame}
   149 
   122 
   150 \begin{frame}
   123 \begin{frame}[fragile]
   151   \frametitle{What is version control}
   124   \frametitle{The need for Version Control}
   152   \begin{block}{From a blog post}
   125   \begin{itemize}
   153     ``Version control (or source control) is nothing more than keeping copies of work as we make changes to it.''
   126   \item \alert{To err is Human} \ldots 
   154   \end{block}
   127   \item Tracking the history and evolution of a project
   155 \end{frame}
   128   \item To collaborate effectively on a project
   156 
   129   \item To efficiently track down bugs and pin-point the changes that
   157 \begin{frame}[fragile]
   130     caused it 
   158   \frametitle{Need of Version Control}
       
   159   \begin{itemize}
       
   160   \item Track the history and evolution of a program.
       
   161   \item To collaborate effectively on a project.
       
   162   \item \begin{color}{red}``To err is Human''\end{color} for recovery we have ...
       
   163   \end{itemize}
   131   \end{itemize}
   164 \end{frame}
   132 \end{frame}
   165 
   133 
   166 %% Introduction to how logs are managed in VCS.
   134 %% Introduction to how logs are managed in VCS.
   167 %% A analogy in logs and day-to-day life?
   135 %% A analogy in logs and day-to-day life?
   168 \begin{frame}[fragile]
   136 \begin{frame}[fragile]
   169   \frametitle{How does it work? Analogy}
   137   \frametitle{How does it work? --- Analogy}
   170   It can roughly be related to Computer/Video Games.
   138   It is, in some ways, similar to playing an Video game.
   171   \begin{itemize}
   139   \begin{itemize}
   172   \item We play games in stages.
   140   \item We play games in stages
   173   \item We pass a stage/task- \begin{color}{red}we SAVE the game.\end{color}
   141   \item Once we finish a stage or a task -- \alert{we SAVE}
   174   \item We resume playing from there onwards.
   142   \item We continue playing
   175   \item In-case we want to replay or revisit some particular stage, we start from position we saved earlier.
   143   \item But, if necessary, we could choose from one of the saved
   176   \item Even we can change the course of play henceforth.
   144     states and start from there
   177   \end{itemize}
   145   \item We could alter the course of the game
   178 \end{frame}
   146   \end{itemize}
   179 
   147 \end{frame}
   180 \begin{frame}[fragile]
   148 
   181   \frametitle{Better way to say:}
   149 
       
   150 \begin{frame}
       
   151   \frametitle{Mercurial or \typ{hg}}
   182   \begin{center}
   152   \begin{center}
   183     \includegraphics[height=2.5in,width=2.5in, interpolate=true]{mario}
   153     \includegraphics[height=.75in,interpolate=true]{images/mercurial_logo}
   184   \end{center}  
   154   \end{center}
   185   \emphbar{VCS provides power to save and resume from a stage.}
   155   \begin{itemize}
   186 \end{frame}
   156   \item Easy to learn and use
   187 
   157   \item Lightweight
   188 \begin{frame}
   158   \item Scales excellently
   189   \frametitle{How is it done?}
   159   \item Written in Python
   190   \begin{itemize}
   160   \end{itemize}
   191   \item It keeps track of changes you make to a file. You can improve, revisit, and amend.
   161 \end{frame}
   192   \item All changes are logged/recorded, so you and others can follow the development cycle.
   162 
   193   \end{itemize}  
   163 \begin{frame}
   194 \end{frame}
   164   \frametitle{Installation}
   195 
   165   \begin{itemize}
   196 
   166   \item \typ{sudo apt-get install mercurial}
   197 %% Introduction to jargon 
   167   \item TortoiseHg
   198 %% This should have some excerpts from normal systems.
   168   \item \typ{\$ hg}
   199 %% Like diffs, folders etc.
   169   \item \typ{\$ hg version}
   200 
   170   \end{itemize}
   201 %% \section{Learning the Lingo!}
   171 \end{frame}
   202 
   172 
   203 %% \begin{frame}[fragile]
   173 \section{Let there be a Repo!}
   204 %%   \frametitle{Common jargon: Basic setup}
   174 % init, status, commit, log, [ui]
   205 %%   \begin{lstlisting}
   175 \begin{frame}
   206 %% $ ls slides/
   176   \frametitle{We need a repo!}
   207 %% filter.png  lena_mean.png  lena.png  
   177   \begin{itemize}
   208 %% neighbour.png  pool.aux  pool.log  
   178   \item A Repository (repo) is where all the action is!
   209 %% pool.nav  pool.out  pool.pdf  pool.snm  
   179   \item Project's files plus a special folder that stores all the
   210 %% pool.tex  pool.tex~  pool.toc  pool.vrb    
   180     changes
   211 %%   \end{lstlisting}  %%$
   181   \item We take snapshots of the whole repository; not individual
   212 %%   \begin{itemize}
   182     files. 
   213 %%   \item Repository(repo):\\
   183   \end{itemize}
   214 %%         The folder with all files.
   184 \end{frame}
   215 %%   %% \item Server:\\
   185 
   216 %%   %%       Machine with main inventory/repo.
   186 \begin{frame}
   217 %%   %% \item Client:\\
   187   \frametitle{Initializing a repo}
   218 %%   %%       Local machines with copy of main repo.
   188   \begin{itemize}
   219 %%   \end{itemize}
   189   \item \typ{\$ hg init}
   220 %% \end{frame}
   190   \item Creates a fresh repository
   221 
   191   \item Adds a \typ{.hg} directory to our \emph{Working directory}
   222 %% \begin{frame}[fragile]
   192   \end{itemize}
   223 %%   \frametitle{Actions}
   193   \emphbar{\typ{.hg} directory keeps log of changes made henceforth}
   224 %%   \begin{itemize}
   194 \end{frame}
   225 %%   \item Add:\\
   195 
   226 %%     Creating/Copying files(cp, touch).
   196 \begin{frame}
   227 %%   \item Check out/Clone:\\
   197   \frametitle{Status report}
   228 %%     Creating copy of working folder.
   198   \begin{itemize}
   229 %%   \end{itemize}
   199   \item \typ{hg status} gives the status of our repo
   230 %%   \begin{lstlisting}
   200   \item Use it often; at least as a beginner
   231 %% $ cp -rv circulate/ local
   201   \item \typ{hg help command} gives us help about \typ{command}
   232 %% `circulate/' -> `local'
   202   \end{itemize}
   233 %% `circulate/sslc1.txt' -> `local/sslc1.txt'
   203 \end{frame}
   234 %% `circulate/pos.txt' -> `local/pos.txt'
   204 
   235 %% `circulate/pendulum.txt' -> `local/pendulum.txt'
   205 \begin{frame}[fragile]
   236 %% `circulate/lena.png' -> `local/lena.png'
   206   \frametitle{Status codes}
   237 %% `circulate/sslc1.py' -> `local/sslc1.py'
       
   238 %% `circulate/points.txt' -> `local/points.txt'    
       
   239 %%   \end{lstlisting}  %%$
       
   240 %% \end{frame}
       
   241 
       
   242 %% \begin{frame}
       
   243 %%   \frametitle{Actions cont...}
       
   244 %%   \begin{itemize}
       
   245 %%     \item Version:\\
       
   246 %%     Version number(Die Hard 4.0).\\
       
   247 %%     Making changes to folder, changes state/version.
       
   248 %%     \item Head/Tip:\\
       
   249 %%     Most recent revision/stage.
       
   250 %%     \item Commit:\\
       
   251 %%     Saving(recording) a change.
       
   252 %%   \item Change log/History:\\
       
   253 %%     List of all past changes.
       
   254 %%   \end{itemize}
       
   255 %% \end{frame}
       
   256 
       
   257 %% \begin{frame}
       
   258 %%   \frametitle{Actions cont...}
       
   259 %%   \begin{itemize}
       
   260 %%   \item Branch:\\
       
   261 %%     Separate local copy for bug fixing, testing.
       
   262 %%   \item Diff/Change:\\
       
   263 %%     Changes made in a file in two different versions.
       
   264 %%   \item Merge (or patch):\\
       
   265 %%     Appling the changes to file, to make it up-to-date.
       
   266 %%   \item Conflict:\\
       
   267 %%     When merging a file is not obvious.
       
   268 %%   \item Resolve:\\
       
   269 %%     Fixing the conflict manually.
       
   270 %%   \end{itemize}
       
   271 %% \end{frame}
       
   272 
       
   273 %% % Types of Version Controls
       
   274 %% %% \section{Types of VCS}
       
   275 
       
   276 %% %% \begin{frame}
       
   277 %% %%   \frametitle{Types:}
       
   278 %% %%   Based on ways of managing the repo there are two types of VCS:
       
   279 %% %%   \begin{itemize}
       
   280 %% %%   \item Centralized VCS\\
       
   281 %% %%     cvs, svn fall under this category.
       
   282 %% %%   \item Distributed VCS\\
       
   283 %% %%     hg, bzr, git follows this methodology.
       
   284 %% %%   \end{itemize}
       
   285 %% %%   \emphbar{We would be covering \typ{hg}}
       
   286 %% %% \end{frame}
       
   287 
       
   288 \begin{frame}
       
   289   \frametitle{We will cover hg?}
       
   290     \includegraphics[height=.75in, interpolate=true]{mercurial}\\
       
   291   Because it is:
       
   292   \begin{itemize}
       
   293   \item Easy to learn and use.
       
   294   \item Lightweight.
       
   295   \item Scales excellently.
       
   296   \item Written in Python.
       
   297   \end{itemize}
       
   298   \inctime{15}
       
   299 \end{frame}
       
   300 
       
   301 % Initializing the repo, cloning, committing changes, pushing, pulling to repo.
       
   302 \section{Getting Started}
       
   303 
       
   304 \begin{frame}
       
   305   \frametitle{Objective}
       
   306   \begin{block}{}
       
   307     We will \alert{manage} letters collaboratively using \typ{hg}.
       
   308   \end{block}
       
   309 
       
   310   %% \pause
       
   311   %% \begin{block}{Disclaimer}
       
   312   %%   Please note, objective is not to learn creative writing, but to learn \alert{hg(mercurial)} via \alert{interesting} use case.
       
   313   %% \end{block}    
       
   314 \end{frame}
       
   315 
       
   316 \begin{frame}[fragile]
       
   317   \frametitle{Getting comfortable:}
       
   318   For checking \typ{hg} installation and its version type:
       
   319   \begin{lstlisting}
   207   \begin{lstlisting}
   320     $ hg version    
   208     M = modified                                               
       
   209     A = added                                                  
       
   210     R = removed                                                
       
   211     C = clean                                                  
       
   212     ! = missing 
       
   213     ? = not tracked                                            
       
   214     I = ignored                                                
   321   \end{lstlisting}
   215   \end{lstlisting}
   322   To get broad help on \typ{hg} and commands available:
   216 \end{frame}
   323   \begin{lstlisting}
   217 
   324     $ man hg
   218 \begin{frame}
   325     $ hg help
   219   \frametitle{Adding files}
   326   \end{lstlisting}
   220   \begin{itemize}
   327   To get help on particular \typ{hg} related option try:
   221   \item From \typ{hg status} we know, none of the files are being
   328   \begin{lstlisting}
   222     tracked, yet. 
   329     $ hg help diff
   223   \item \typ{hg add} --- asking \typ{hg} to track these files
   330   \end{lstlisting} %$
   224   \item As expected \typ{hg status} prepends an \typ{A} to the file names.
   331 \end{frame}
   225   \end{itemize}
   332 
   226 \end{frame}
   333 \begin{frame}[fragile]
   227 
   334   \frametitle{Getting working/existing code base}
   228 \begin{frame}
   335   To get an already existing code base:
   229   \frametitle{Taking Snapshots}
   336   \begin{lstlisting}
   230   \begin{itemize}
   337 $ hg clone 
   231   \item \typ{hg commit}
   338 http://hg.serpentine.com/tutorial/hello 
   232   \item Asking Mercurial to take a snapshot; remember the changes made
   339 localCopyhello
   233     to the repository. 
   340   \end{lstlisting}
   234   \item Commit message is a description of the changes made. 
   341 \typ{localCopyhello} is copy of code-base. 
   235   \end{itemize}
   342   \begin{lstlisting}
   236 \end{frame}
   343 $ ls localCopyhello/
   237 
   344 hello.c  Makefile
   238 \begin{frame}
   345   \end{lstlisting}
   239   \frametitle{Thumbnail views}
   346 \end{frame}
   240   \begin{itemize}
   347 
   241   \item \typ{hg log}~ gives the log of the changes made
   348 %%introduction to clone, repo, server, client.
   242   \item A \typ{changeset} is an atomic collection of changes to the
   349 \begin{frame}[fragile]
   243     files (between successive commits)
   350   \frametitle{What did we do!}
   244   \end{itemize}
   351   \begin{block}{Explanation}
   245   \begin{block}{Log information}
   352     \begin{itemize}
   246     \begin{itemize}
   353     \item<1-> \typ{hello} is a \alert{repo}, it's a collection of files and folders. 
   247     \item \alert{changeset}: Identifiers for the changeset
   354     \item<2-> This repo is located on remote(\alert{server}) machine.    
   248     \item \alert{user}: Details of user who created the changeset
   355     \item<3-> We copy(\alert{clone}) repo to our local machine.
   249     \item \alert{date}: Date and time of creation
       
   250     \item \alert{summary}: One line description
   356     \end{itemize}    
   251     \end{itemize}    
   357   \end{block}
   252   \end{block}
   358 \end{frame}
   253 \end{frame}
   359 
   254 
   360 \begin{frame}[fragile]
   255 \begin{frame}
   361   \frametitle{Creating repo of existing files}
   256   \frametitle{User information}
   362   I have some files which I want to bring under version control. \typ{hg} provides \alert{\typ{init}} command for this: 
   257   \begin{itemize}
       
   258   \item User information is set in the \typ{hgrc} file
       
   259   \item It can be set globally or local to the project
       
   260   \item Global \typ{hgrc}
       
   261     \begin{itemize}
       
   262     \item \typ{\$HOME/.hgrc} -- Unix like systems
       
   263     \item \typ{\%HOME\%\\.hgrc} -- Windows
       
   264     \end{itemize}
       
   265   \end{itemize}
       
   266 \end{frame}
       
   267 
       
   268 \begin{frame}
       
   269   \frametitle{\alert{Advice}: \typ{commits}, messages}
       
   270   \begin{itemize}
       
   271   \item Atomic changes; one change with one \typ{commit}
       
   272   \item Single line summary --- 60 to 65 characters long
       
   273   \item Followed by paragraphs of detailed description
       
   274     \begin{itemize}
       
   275     \item Why the change?
       
   276     \item What does it effect?
       
   277     \item Known bugs/issues?
       
   278     \item etc. 
       
   279     \end{itemize}
       
   280   \end{itemize}
       
   281 \end{frame}
       
   282 
       
   283 \section{But Why \typ{commit}~?}
       
   284 
       
   285 \begin{frame}
       
   286   \frametitle{Operational overhead?}
       
   287   \begin{itemize}
       
   288   \item But why do we \typ{commit}
       
   289   \item Isn't all this just adding to operational costs?
       
   290   \item Isn't all this a waste of time?
       
   291   \end{itemize}
       
   292   \begin{center}
       
   293     \emphbar{No! You shall see the benefits, soon!}    
       
   294   \end{center}
       
   295 \end{frame}
       
   296 
       
   297 \begin{frame}
       
   298   \frametitle{Revert Changes}
       
   299   \begin{itemize}
       
   300   \item Undo all changes; the editor can only do so much.
       
   301   \item \typ{hg revert --all}
       
   302   \item \typ{hg revert filename}
       
   303   \item Present file, with changes --- \typ{filename.orig}
       
   304   \end{itemize}
       
   305 \end{frame}
       
   306 
       
   307 \begin{frame}[fragile]
       
   308   \frametitle{Viewing Changes}
       
   309   \begin{itemize}
       
   310   \item \typ{hg diff} --- all changes since last commit
       
   311   \end{itemize}
       
   312   \begin{block}{}
       
   313     \begin{lstlisting}
       
   314       - this line was deleted
       
   315       + this line was added
       
   316     \end{lstlisting}
       
   317   \end{block}
       
   318 \end{frame}
       
   319 
       
   320 
       
   321 \begin{frame}[fragile]
       
   322   \frametitle{Revision numbering}
       
   323   \begin{itemize}
       
   324   \item \typ{changeset:   n:cbf6e2a375b4}
       
   325   \item \typ{n} is the revision number
       
   326   \item The revision number is local to a repository
       
   327   \item \typ{cbf6e2a375b4} is the unique identifier
       
   328   \end{itemize}
       
   329 \end{frame}
       
   330 
       
   331 \begin{frame}[fragile]
       
   332   \frametitle{Using revision numbers}
       
   333   \begin{itemize}
       
   334   \item \typ{-r n} can be passed as arguments to commands to specify
       
   335     the revision number
       
   336   \item For instance, \typ{hg log -r0} 
       
   337   \item \typ{m:n} specifies a range of revision numbers
       
   338   \item \typ{-1} gives the \typ{tip}; Negative numbering can be used
       
   339   \end{itemize}
       
   340 \end{frame}
       
   341 
       
   342 \section{Collaborating with Mercurial}
       
   343 \begin{frame}[fragile]
       
   344   \frametitle{Cloning Repositories}
       
   345   \begin{itemize}
       
   346   \item \typ{hg clone SOURCE [DEST]}
       
   347   \item All \typ{hg} repositories are self-contained
       
   348   \end{itemize}
       
   349 \end{frame}
       
   350 
       
   351 \begin{frame}[fragile]
       
   352   \frametitle{Sharing Repositories}
       
   353   \begin{itemize}
       
   354   \item \typ{hg serve}
       
   355   \item Can be cloned with \typ{hg clone http://my-ip-address:8000}
       
   356   \item We share a central repository; work on our local copies. 
       
   357   \item Set write permissions in \typ{.hg/hgrc}
       
   358   \end{itemize}
   363   \begin{lstlisting}
   359   \begin{lstlisting}
   364 $ ls -a circulate/
   360     [web]
   365 .  ..  lena.png  pendulum.txt  points.txt  pos.txt  sslc1.py  sslc1.txt
   361     push_ssl=False
   366 $ cd circulate/
   362     allow_push=*
   367 $ hg init
       
   368 $ ls -a
       
   369 .  ..  .hg  lena.png  pendulum.txt  points.txt  pos.txt  sslc1.py  sslc1.txt    
       
   370   \end{lstlisting}
   363   \end{lstlisting}
   371   \emphbar{\typ{.hg} directory keeps log of changes made henceforth.}
   364 \end{frame}
   372 \end{frame}
   365 
   373 
   366 \begin{frame}
   374 \begin{frame}[fragile]
   367   \frametitle{Sharing Changes}
   375   \frametitle{Starting fresh}
   368   \begin{itemize}
   376   We can use \typ{init} to start a new repository also
   369   \item Use \typ{hg push} to push your \typ{commits}
   377   \begin{lstlisting}
   370     (\typ{changesets}) to the central repository
   378 $ mkdir letter
   371   \end{itemize}
   379 $ cd letter
   372 \end{frame}
   380 $ touch letter.tex
   373 
   381 $ ls -a
   374 
   382 .  ..  letter.tex
   375 \begin{frame}
   383 $ hg init
   376   \frametitle{Pulling Changes}
   384 $ ls -a
   377   \begin{itemize}
   385 .  ..  letter.tex  .hg
   378   \item \typ{hg incoming} shows new \typ{changesets} in the server 
   386   \end{lstlisting}
   379   \item To get these \typ{changesets}, we use \typ{hg pull}
   387 \end{frame}
   380   \item These changes do not affect our working directory
   388 
   381   \item \typ{hg parent} shows the parents of the working directory
   389 \begin{frame}[fragile]
   382   \end{itemize}
   390   \frametitle{Making copies: Branching}
   383 \end{frame}
   391   All \typ{hg} repositories are self-contained, and independent which can be copied(cloned):
   384 
   392   \begin{lstlisting}
   385 \begin{frame}
   393 $ hg clone localCopyhello newCopy
   386   \frametitle{Pulling Changes \ldots}
   394 updating working directory
   387   \begin{itemize}
   395 2 files updated, 0 files merged, 
   388   \item \typ{hg update} will update the working directory 
   396 0 files removed, 0 files unresolved
       
   397   \end{lstlisting}
       
   398   \alert{or}
       
   399   \begin{lstlisting}
       
   400 $ hg clone letter letter-clone
       
   401 updating working directory
       
   402 0 files updated, 0 files merged, 
       
   403 0 files removed, 0 files unresolved 
       
   404  \end{lstlisting}
       
   405 \end{frame}
       
   406 
       
   407 %%introduction to branch
       
   408 \begin{frame}[fragile]
       
   409   \frametitle{Why do we need branching?}
       
   410   \begin{block}{}
       
   411     \begin{itemize}
   389     \begin{itemize}
   412     \item To keep separate set for \alert{experimentation}.
   390     \item Updates to the \typ{tip} if no revision is specified
   413     \item Simple way to \alert{backup} all in one go!
   391     \item \typ{tip} is the most recently added changeset 
   414     \item It helps in collaborative environment.
   392     \item Can specify revision number to update to
   415     %% should we mention it at all? there is no need to know atleast here.
       
   416     %% syncing and integrating in backup files and testing environment can also be mentioned.
       
   417     \end{itemize}
   393     \end{itemize}
   418   \end{block}
   394   \item \typ{hg tip} shows the \typ{tip} of the repository
   419   \inctime{15}
   395   \end{itemize}
   420 \end{frame}
   396 \end{frame}
   421 
   397 
   422 %% Should we here stress on how are distribute VCS have 
   398 \begin{frame}
   423 %% different approach then centralized ones? Maybe a pic
   399   \frametitle{Simultaneous Changes}
   424 %% or some other graphical representation.
   400   \begin{itemize}
   425 \begin{frame}[fragile]
   401   \item The logs of both repositories will be different
   426   \frametitle{Revisiting saved points:history/logs}
   402   \item The repositories have diverged
   427   In \typ{hg}, the difference between consecutive stages is termed as \alert{changeset}.\\
   403   \item \typ{hg push} fails, in such a scenario
   428   Once we have saved stages, we need a mechanism to review and access them, for that use \alert{\typ{log}} command.
   404   \item \alert{Never, Never, Never, Ever} use \typ{hg push -f}
   429   \begin{lstlisting}
   405   \end{itemize}
   430 $ cd localCopyhello
   406 \end{frame}
   431 $ hg log    
   407 
   432   \end{lstlisting}
   408 \begin{frame}
   433 \end{frame}
   409   \frametitle{Merging}
   434 
   410   \begin{itemize}
   435 \begin{frame}[fragile]
   411   \item Pull and merge, when \typ{abort: push creates new remote
   436   \frametitle{Understanding output}
   412     heads!}
   437   It provides following information:
   413   \item \typ{hg merge} will merge the two diverged heads
   438   \begin{itemize}
   414   \item \typ{commit} after you have \typ{merged}!
   439   \item \alert{changeset}: Identifiers for the changeset.
   415   \end{itemize}
   440   \item \alert{user}: Person who created the changeset.
   416 \end{frame}
   441   \item \alert{date}: Date and time of creation of changeset.
   417 
   442   \item \alert{summary}: One line description.
   418 \begin{frame}
   443   \end{itemize}
   419   \frametitle{Simultaneous Changes \ldots}
   444 \end{frame}
   420   \begin{itemize}
   445 
   421   \item \typ{outgoing} shows the \typ{changesets} that will be pushed
   446 %% here we should have image of dotA or halo for resuming from a stage in game.
   422   \item \typ{hg push} works!
   447 
   423   \item Look at the `Change graph'!
   448 \begin{frame}[fragile]
   424   \end{itemize}
   449   \frametitle{History/Logs cont...}
   425 \end{frame}
   450   By default \typ{log} returns complete list of all changes. \\
   426 
   451   For selective view try:
   427 \begin{frame}
   452 \begin{lstlisting}
   428   \frametitle{Simultaneous Conflicting Changes}
   453 $ hg log -r 3
   429   \begin{itemize}
   454 $ hg log -r 2:4
   430   \item What if the changes conflict? -- overlapping edits
   455 \end{lstlisting}
   431   \item \typ{hg push} fails; \typ{hg pull}; \typ{hg merge}
   456   tip/latest changes can be seen via:
   432   \item You now get a diff view with 3 panes 
   457   \begin{lstlisting}
       
   458 $ hg tip    
       
   459   \end{lstlisting} %%$
       
   460   \inctime{5}
       
   461 \end{frame}
       
   462 
       
   463 \begin{frame}[fragile]
       
   464   \frametitle{Advancing through a stage:status}
       
   465   We often need to add/delete some files from directory(repo). The structure keeps on evolving, and tools for handling them are needed.\\
       
   466   We will use the \typ{letter} repo we created earlier.
       
   467   \begin{lstlisting}
       
   468 $ cd letter
       
   469 $ hg log
       
   470 $ hg st
       
   471 ? letter.tex
       
   472   \end{lstlisting} %%$
       
   473   \alert{\typ{st}} (aka status) is command to show changed files in the working directory.\\
       
   474 \end{frame}
       
   475 
       
   476 %% track record is confusing for some. Duma have some doubts :(
       
   477 \begin{frame}[fragile]
       
   478   \frametitle{Adding files}
       
   479   "?" indicates that this file are aliens to track record.\\
       
   480   \alert{\typ{add}} command is available to add new files to present structure.
       
   481   \begin{lstlisting}
       
   482 $ hg add letter.tex
       
   483 $ hg st
       
   484 A letter.tex
       
   485   \end{lstlisting}
       
   486 \end{frame}
       
   487 
       
   488 \begin{frame}[fragile]
       
   489   \frametitle{Saving present stage: committing}
       
   490   \emphbar{This is equivalent to completing tasks, before reaching a stage where you want to save.}
       
   491   \typ{hg} uses \alert{\typ{ci}}(aka \typ{commit}) command to save changes. So after adding file, we have to commit it also:
       
   492   \begin{lstlisting}
       
   493 $ hg ci -u "Shantanu <shantanu@fossee.in>" 
       
   494         -m "First commit."
       
   495 $ hg log
       
   496 changeset:   0:210664b4ed58
       
   497 tag:         tip
       
   498 user:        Shantanu <shantanu@fossee.in>
       
   499 date:        Tue Feb 23 19:41:45 2010 +0530
       
   500 summary:     First commit.
       
   501   \end{lstlisting}
       
   502 \end{frame}
       
   503 
       
   504 %% explanation of ci command??
       
   505 \begin{frame}[fragile]
       
   506   \frametitle{\typ{ci} command}
       
   507   Some arguments passed to \typ{ci} command are worth noticing:
       
   508   \begin{itemize}
       
   509   \item \alert{u}: To provide name and email contact information of person making changes!\\
       
   510   In case you don't want to repeat that each time of committing, add info to \typ{hgrc} file.
       
   511   \item<2-> \alert{m}: It is to provide one-line summary of changeset. \\
       
   512     if this argument is not passed, hg takes you to editor to specify the message which is required to commit.
       
   513   \end{itemize}  
       
   514 \end{frame}
       
   515 
       
   516 \begin{frame}[fragile]
       
   517   \frametitle{Other operations}
       
   518   \typ{hg} supports basic file-management functions like copy, remove, rename etc.
       
   519   \begin{lstlisting}
       
   520 $ hg cp letter.tex letter-prof.tex
       
   521 $ hg rename letter.tex letter-personal.tex
       
   522 $ hg st
       
   523 A letter-personal.tex
       
   524 A letter-pro.tex
       
   525 R letter.tex
       
   526 $ hg ci -u "Shantanu <shantanu@fossee.in>" 
       
   527         -m "Renamed and added letters."
       
   528 $ hg tip| grep summary 
       
   529 summary:     Renamed and added letters.
       
   530   \end{lstlisting} %$
       
   531 %% Other commands which can be handy are \typ{remove}, \typ{revert} etc.
       
   532   \inctime{10}
       
   533 \end{frame}
       
   534 
       
   535 % Introduction to concepts of branches, merging patch?
       
   536 \section{Sharing and Collaborating}
       
   537 
       
   538 \begin{frame}[fragile]
       
   539   \frametitle{Distributing changes}
       
   540   \begin{itemize}
       
   541   \item All directory-structure(repo) are self-contained.
       
   542   \item Changes created are local.
       
   543     \begin{itemize}
   433     \begin{itemize}
   544     \item Until we sync. previously cloned repos.
   434     \item First --- current file
       
   435     \item Second --- file with your changes
       
   436     \item Third --- \typ{changesets} that you pulled
   545     \end{itemize}
   437     \end{itemize}
   546   \end{itemize}
   438   \item Resolve conflict and save
   547   \begin{lstlisting}
   439   \item \typ{hg commit}; \typ{hg push}
   548 $ cd letter-clone
   440   \item Look at the `Change graph'!
   549 $ hg pull 
   441   \end{itemize}
   550 pulling from /home/baali/letter
   442 \end{frame}
   551 requesting all changes
   443 
   552 adding changesets
   444 \section{Conclusion}
   553 adding manifests
   445 
   554 adding file changes
   446 \begin{frame}
   555 added 2 changesets with 2 changes to 2 files
   447   \frametitle{\alert{Advice}: Work-flow}
   556 (run 'hg update' to get a working copy)
   448   General work-flow
   557   \end{lstlisting} %$
   449   \begin{itemize}
   558 \end{frame}
   450   \item \typ{pull}; \typ{update}
   559 
   451   \item Make changes
   560 \begin{frame}[fragile]
   452   \item \typ{commit}
   561   \frametitle{Pulling changesets cont...}
   453   \item If changes on repo, \typ{pull} and \typ{merge}
   562   \alert{\typ{pull}} command doesn't update current directory, it just imports changesets. To add all these changes, use \alert{\typ{up}}:
   454   \item \typ{push}
   563   \begin{lstlisting}
   455   \end{itemize}
   564 $ ls -a
   456   \emphbar{Commit Early, Commit Often}
   565 .  ..  .hg
   457 \end{frame}
   566 $ hg up
   458 
   567 2 files updated, 0 files merged, 
   459 \begin{frame}
   568 0 files removed, 0 files unresolved
   460   \frametitle{References}
   569 $ ls -a
   461   \begin{itemize}
   570 .  ..  .hg  letter-personal.tex  
   462   \item \href{http://betterexplained.com/articles/a-visual-guide-to-version-control/}{A Visual Guide to Version Control}
   571 letter-pro.tex
   463   \item \href{http://karlagius.com/2009/01/09/version-control-for-the-masses/}{Version Control for the Masses}
   572   \end{lstlisting} %% $
   464   \item \href{http://betterexplained.com/articles/intro-to-distributed-version-control-illustrated/}{(Illustrated) Intro to Distributed Version Control}
   573   \pause
   465   \item \href{http://mercurial.selenic.com/wiki/UnderstandingMercurial}{Understanding Mercurial}
   574   \emphbar{Why \typ{pull} and \typ{up} are needed separately?}
   466   \item \href{http://mercurial.selenic.com/wiki/Tutorial}{A Tutorial on Using Mercurial}
   575 \end{frame}
   467   \item \href{http://hginit.com/}{Hg Init: a Mercurial tutorial}
   576 
   468   \item \href{http://mercurial.selenic.com/wiki/BeginnersGuides}{Beginners Guides}
   577 \begin{frame}[fragile]
   469   \item \href{http://software-carpentry.org/4_0/vc/}{Software Carpentry}
   578   \frametitle{Content of letter}
   470   \end{itemize}
   579   Personal letter can be letter to ask a girl out!\\
   471 \end{frame}
   580   Using LaTeX to write letter, it would be straight forward:
   472 
   581 
       
   582   \begin{small}  
       
   583   \begin{block}{}
       
   584   \begin{lstlisting}
       
   585 \documentclass{letter}
       
   586 \begin{document}
       
   587 \begin{letter}{}
       
   588 \opening{Hello Jas,}
       
   589 I really enjoyed meeting you in CS 101, 
       
   590 but would love to know you better. 
       
   591 How about a coffee on Thursday after class?
       
   592 
       
   593 \closing{-Samarth}
       
   594 \end{letter}
       
   595 \end{document}
   473 \end{document}
   596 
   474 
   597   \end{lstlisting}
       
   598   \end{block}
       
   599   \end{small}
       
   600 \end{frame}
       
   601 
       
   602 \begin{frame}[fragile]
       
   603   \frametitle{Sharing the changes!}
       
   604   \begin{lstlisting}    
       
   605 $ hg st
       
   606 M letter-personal.tex
       
   607   \end{lstlisting} %%$
       
   608   \alert{'M'} sign indicates that \typ{hg} has noticed change in that particular file.
       
   609 \end{frame}
       
   610 
       
   611 \begin{frame}[fragile]
       
   612   \frametitle{Revisiting changes}
       
   613   To view changes made \typ{hg} provides \alert{\typ{diff}}:
       
   614   \begin{small}      
       
   615   \begin{lstlisting}
       
   616 $ hg diff
       
   617 diff -r 4a2d973a92de letter-personal.tex
       
   618 --- a/letter-personal.tex	Tue Feb 23 19:50:39 2010 +0530
       
   619 +++ b/letter-personal.tex	Tue Feb 23 20:28:46 2010 +0530
       
   620 @@ -0,0 +1,11 @@
       
   621 +\documentclass{letter}
       
   622 +\begin{document}
       
   623 + 
       
   624 +\begin{letter}{}
       
   625 +\opening{Hello Jas,}
       
   626 +  
       
   627 +I really enjoyed meeting you in CS 101, 
       
   628 .
       
   629 .
       
   630   \end{lstlisting} %$
       
   631   \end{small}
       
   632 \end{frame}
       
   633 
       
   634 \begin{frame}[fragile]
       
   635   \frametitle{Saving the changes}
       
   636   We have to commit these changes.
       
   637   \begin{lstlisting}
       
   638 $ hg ci -u "Shantanu <shantanu@fossee.in>" 
       
   639   -m "Added content to personal letter."
       
   640   \end{lstlisting} %$
       
   641 \end{frame}
       
   642 
       
   643 \begin{frame}[fragile]
       
   644   \frametitle{Syncing two repos}
       
   645   To bring both the repos at same stage we have to \alert{\typ{push}} changesets
       
   646   \begin{lstlisting}
       
   647 $ hg push 
       
   648 pushing to /home/baali/letter
       
   649 searching for changes
       
   650 adding changesets
       
   651 adding manifests
       
   652 adding file changes
       
   653 added 1 changesets with 1 changes to 1 files
       
   654   \end{lstlisting} %$
       
   655 \end{frame}
       
   656 
       
   657 \begin{frame}[fragile]
       
   658   \frametitle{Syncing cont...}
       
   659   Same as \typ{pull}, \typ{push} wont update the main directory by default.
       
   660   \begin{lstlisting}
       
   661 $ cd letter
       
   662 $ hg tip    
       
   663 $ cat letter-personal.tex
       
   664   \end{lstlisting} %%$
       
   665   \alert{\typ{tip}} shows latest changeset, but content of file are not updated.\\
       
   666   We have to use \typ{up} on main branch
       
   667   \begin{lstlisting}
       
   668 $ hg up
       
   669 1 files updated, 0 files merged, 0 files removed, 0 files unresolved    
       
   670   \end{lstlisting} %$
       
   671   \inctime{15}
       
   672 \end{frame}
       
   673 
       
   674 \begin{frame}[fragile]
       
   675   \frametitle{Merging: Scenario}
       
   676   One very useful feature is merging work of different peers working on same project.\\
       
   677   We consider scenario, two person on one project, both have local copies, and one among them is main branch.\\
       
   678   \begin{center}
       
   679     \includegraphics[height=1in, interpolate=true]{scenario}
       
   680   \end{center}  
       
   681 \end{frame}
       
   682 
       
   683 \begin{frame}
       
   684   \frametitle{Scenario cont...}
       
   685   \begin{block}{}
       
   686   \begin{itemize}
       
   687   \item To make this letter better, I ask for suggestions.
       
   688   \item Friend of mine, clones this repo and edit things.
       
   689   \item When he/she pushes changes, I can decide to use them or not.
       
   690   \end{itemize}  
       
   691   \end{block}  
       
   692 \end{frame}
       
   693 
       
   694 \begin{frame}[fragile]
       
   695   \frametitle{Creating more clones for sharing}
       
   696   I create a clone of repo which is accessible to my friend.
       
   697   \begin{lstlisting}
       
   698 $ hg clone letter letter-suggestion
       
   699 updating working directory
       
   700 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   701   \end{lstlisting} %$
       
   702 \end{frame}
       
   703 
       
   704 %% here we can have introduction to concept of DVCS and CVCS?
       
   705 
       
   706 \begin{frame}[fragile]
       
   707   \frametitle{Suggestions!}
       
   708   He is convinced that using some colored text would be a good idea.
       
   709   He just adds color to closing part.
       
   710   %% a comment on how bad is this idea :P
       
   711   \begin{small}      
       
   712   \begin{lstlisting}
       
   713 $ hg dif
       
   714 diff -r 4a2d973a92de letter-personal.tex
       
   715 --- a/letter-personal.tex	Tue Feb 23 19:50:39 2010 +0530
       
   716 +++ b/letter-personal.tex	Wed Feb 24 12:03:33 2010 +0530
       
   717 @@ -0,0 +1,12 @@
       
   718  \documentclass{letter}
       
   719 +\usepackage{color}
       
   720  \begin{document}
       
   721 .
       
   722 -\closing{-Samarth}
       
   723 +\closing{\textcolor{red}{-Samarth}}
       
   724   \end{lstlisting} %%$
       
   725   \end{small}
       
   726 \end{frame}
       
   727 
       
   728 \begin{frame}[fragile]
       
   729   \frametitle{Committing the changes}
       
   730   He is satisfied with his minor changes, so he commits.
       
   731   \begin{lstlisting}
       
   732 $ hg ci 
       
   733   -u "Vattam <vattam@fossee.in>"
       
   734   -m "Added some suggestions."   
       
   735   \end{lstlisting} %%$
       
   736 \end{frame}
       
   737 
       
   738 \begin{frame}[fragile]
       
   739   \frametitle{The other good half of repo...}
       
   740   It turns out, in this process, Jas is already dating, so we edit the letter for someone else from same class.
       
   741   \begin{lstlisting}
       
   742 $ hg ci -u "Shantanu <shantanu@fossee.in>"
       
   743         -m "Changed name."
       
   744 $ hg tip|grep changeset
       
   745 changeset:   3:fadbd6492cc4    
       
   746   \end{lstlisting}
       
   747   %%\emphbar{\alert{moral:} Don't wait for it!}
       
   748 \end{frame}
       
   749 
       
   750 %%\hspace*{-0.5in} 
       
   751 
       
   752 \begin{frame}[fragile]
       
   753   \frametitle{Situation}
       
   754   \begin{columns}
       
   755     \column{0.5\textwidth}    
       
   756     \begin{block}{\center{main directory}}
       
   757       \includegraphics[height=2in, interpolate=true]{glog-main}
       
   758     \end{block}
       
   759     \column{0.5\textwidth} 
       
   760     \begin{block}{\center{cloned directory}}
       
   761       \includegraphics[height=2in, interpolate=true]{glog-suggestion}
       
   762     \end{block}
       
   763   \end{columns}
       
   764 \end{frame}
       
   765 
       
   766 \begin{frame}[fragile]
       
   767   \frametitle{Merging}
       
   768   \emphbar{Lets sync both these branches!}
       
   769   \begin{lstlisting}
       
   770 $ hg pull ../letter-suggestion
       
   771 pulling from ../letter-suggestion
       
   772 searching for changes
       
   773 adding changesets
       
   774 adding manifests
       
   775 adding file changes
       
   776 added 1 changesets with 1 changes to 1 files (+1 heads)
       
   777 (run 'hg heads' to see heads, 'hg merge' to merge)    
       
   778   \end{lstlisting} %$
       
   779   \begin{itemize}
       
   780   \item \typ{pull} can be done from a branch explicitly also.
       
   781   \pause
       
   782   \item \alert{Output is already suggesting something!}
       
   783   \end{itemize}  
       
   784 \end{frame}
       
   785 
       
   786 %% Here one can mention the point of having push and pull separate. Because of this policy, changes made are not lost.
       
   787 \begin{frame}[fragile]
       
   788   \frametitle{Analyzing events in detail}
       
   789   Since hg \typ{pull} don't update the files directly, our changes are still safe. \typ{hg} provides some commands to help understand such problems.
       
   790 \begin{tiny}
       
   791   \begin{lstlisting}
       
   792 $ hg heads 
       
   793 changeset:   4:71fd776d856b
       
   794 tag:         tip
       
   795 parent:      2:a5d8cb2fac01
       
   796 user:        Vattam <vattam@fossee.in>
       
   797 date:        Wed Feb 24 12:54:31 2010 +0530
       
   798 summary:     Added some suggestions.
       
   799 
       
   800 changeset:   3:02b49a53063f
       
   801 user:        Shantanu <Shantanu@fossee.in>
       
   802 date:        Wed Feb 24 13:12:26 2010 +0530
       
   803 summary:     Changed name.
       
   804   \end{lstlisting} %%$
       
   805 \end{tiny}
       
   806   It shows current repository heads or show branch head
       
   807 \end{frame}
       
   808 
       
   809 \begin{frame}[fragile]
       
   810   \frametitle{What went wrong: Analysis}
       
   811     \begin{lstlisting}
       
   812 $ hg glog    
       
   813   \end{lstlisting} %%$
       
   814   \begin{center}
       
   815   \includegraphics[height=2in]{heads}  
       
   816   \end{center}  
       
   817   It shows history alongside an ASCII revision graph.  
       
   818 \end{frame}
       
   819 
       
   820 \begin{frame}[fragile]
       
   821   \frametitle{What went wrong: Analysis cont...}
       
   822   Because of different 'pasts', \typ{up} command fails.
       
   823   \begin{lstlisting}
       
   824 $ hg up
       
   825 abort: crosses branches (use 'hg merge' 
       
   826        or 'hg update -C')
       
   827   \end{lstlisting} %$
       
   828 \end{frame}
       
   829 
       
   830 \begin{frame}[fragile]
       
   831   \frametitle{Merging}
       
   832   To deal such situations \typ{hg} \alert{merge} command merge working directory with another revision.
       
   833   \begin{lstlisting}
       
   834 $ hg merge
       
   835  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   836 (branch merge, don't forget to commit)   
       
   837   \end{lstlisting} %$
       
   838   After merging two branches, we have to commit the results to create a common head.
       
   839   \begin{lstlisting}
       
   840 $ hg ci -u "Shantanu <shantanu@fossee.in>" 
       
   841         -m "Merged branches."
       
   842   \end{lstlisting} %$
       
   843   \inctime{15}
       
   844 \end{frame}
       
   845 
       
   846 \begin{frame}[fragile]
       
   847   \frametitle{\typ{glog}}
       
   848   \begin{center}
       
   849   \includegraphics[height=2.8in]{glog-2}  
       
   850   \end{center}
       
   851 \end{frame}
       
   852 
       
   853 \begin{frame}[fragile]
       
   854   \frametitle{Revisiting history!}
       
   855   In case earlier girl is available again and you are still looking for date you can \alert{revert} back to previous letter!
       
   856   \begin{lstlisting}
       
   857 $ hg revert -r 2 -a
       
   858 reverting letter-personal.tex    
       
   859   \end{lstlisting} %%$
       
   860   And the content changes. From here on you can further change your letter as you wish.
       
   861   %% more options for revert are to explained here!
       
   862 \end{frame}
       
   863 
       
   864 \begin{frame}[fragile]
       
   865   \frametitle{More information}
       
   866   \begin{itemize}
       
   867   \item \typ{merge} fails if there are conflicting changes.
       
   868     \begin{itemize}
       
   869     \item Like two persons editing same file, same line and pushing it upstream.
       
   870     \end{itemize}
       
   871   \item In conflicts, one have to perform \typ{merge} manually.
       
   872   \item \typ{hg} provides \alert{\typ{incoming}} command, which checks the would-be imported changes
       
   873     \begin{itemize}
       
   874     \item To avoid conflicting changes before importing.
       
   875     \end{itemize}
       
   876   \end{itemize}
       
   877   \inctime{10}
       
   878 \end{frame}
       
   879 
       
   880 %% Manual and force merge
       
   881 %% hgignore
       
   882 
       
   883 %% Reverting to previous versions!
       
   884 % Steps to follow to make life easier. How to avoid/handle manual merges.
       
   885 \section{Work flow: DOs and DON'Ts}
       
   886 
       
   887 \begin{frame}
       
   888   \frametitle{Motto behind hg}
       
   889   \begin{center}
       
   890   \color{red}{``Commit Early Commit Often.''}
       
   891   \end{center}  
       
   892 \end{frame}
       
   893 
       
   894 \begin{frame}
       
   895   \frametitle{Work-flow}
       
   896   \begin{itemize}
       
   897   \item Make changes.
       
   898   \item Commit.
       
   899   \item Pull changesets.
       
   900   \item Merge(if required).
       
   901   \item Push.
       
   902   \end{itemize}
       
   903 \end{frame}
       
   904 
       
   905 \begin{frame}
       
   906   \frametitle{Cheat Sheet}
       
   907   \begin{center}
       
   908   \includegraphics[height=2.8in]{mod}  
       
   909   \end{center}  
       
   910   \inctime{15}
       
   911 \end{frame}
       
   912 
       
   913 %% Move it to end of session. Once introduction part is 
       
   914 %% over. Then mentioning about options and utility.
       
   915 \section{Use case and Options}
       
   916 
       
   917 \begin{frame}
       
   918   \frametitle{Use cases}
       
   919   \emphbar{For team of people working remotely(even different computers/machines) on a project, use of version control is inevitable!}
       
   920   \vspace{0.15in}
       
   921   \emphbar{For single person: managing projects and assignments becomes easy}
       
   922   \vspace{0.15in}
       
   923   \pause
       
   924   \emphbar{\color{red}{It is a good habit!}}
       
   925 \end{frame}
       
   926 
       
   927 \begin{frame}
       
   928   \frametitle{What are other options!}
       
   929   \begin{itemize}
       
   930   \item cvs (Concurrent Version System)
       
   931   \item svn (Subversion)
       
   932   \item hg (Mercurial)
       
   933   \item bzr (Bazaar)
       
   934   \item git
       
   935   \end{itemize}
       
   936   \inctime{5}
       
   937 \end{frame}
       
   938 
       
   939 \begin{frame}
       
   940   \frametitle{Suggested Readings:}
       
   941   \begin{itemize}
       
   942   \item \url{http://mercurial.selenic.com/guide/}
       
   943   \item \url{http://hgbook.red-bean.com/}    
       
   944   \item \url{http://karlagius.com/2009/01/09/version-control-for-the-masses/}
       
   945   \item Articles related to version control available on \url{http://betterexplained.com/}
       
   946   \item \url{http://en.wikipedia.org/wiki/Revision_control}
       
   947   \item \url{http://wiki.alliedmods.net/Mercurial_Tutorial}
       
   948   \item Mario game images are taken from wikipedia.
       
   949   \end{itemize}
       
   950 \end{frame}
       
   951 \end{document}
       
   952 
       
   953 Some more suggestions from Nishanth:
       
   954 revert  
       
   955 resolve
       
   956 
       
   957 Notes
       
   958 -----
       
   959 
       
   960 From http://mercurial.selenic.com/
       
   961 
       
   962 Quick Start
       
   963 
       
   964 Clone a project and push changes
       
   965 
       
   966 $ hg clone http://selenic.com/repo/hello
       
   967 $ cd hello
       
   968 $ (edit files)
       
   969 $ hg add (new files)
       
   970 $ hg commit -m 'My changes'
       
   971 $ hg push
       
   972 
       
   973 
       
   974 Create a project and commit
       
   975 
       
   976 $ hg init (project-directory)
       
   977 $ cd (project-directory)
       
   978 $ (add some files)
       
   979 $ hg add
       
   980 $ hg commit -m 'Initial commit'