1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Version Control Systems
%
% Author: FOSSEE
% Copyright (c) 2012, FOSSEE, IIT Bombay
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[14pt,compress]{beamer}
\mode<presentation>
{
\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]
\begin{document}
\begin{frame}
\begin{center}
\vspace{12pt}
\textcolor{blue}{\huge Version Control Using Hg - Part 2}
\end{center}
\vspace{18pt}
\begin{center}
\vspace{10pt}
\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}
\textbf{Version Control Using Hg}
\begin{itemize}
\item Part I
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Objectives}
At the end of this tutorial, you will be able to:
\begin{itemize}
\item Initialize a new repository,
\item Obtain the status of a repository,
\item Add new files to a repository,
\item Take snapshots of a repository,
\item View the history of a repository,
\item 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 <email>}
\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 <primal@fossee.in> \\
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{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}
\item \small{If you have set the EMAIL environment variable, this will be used. Next, Mercurial will query your system to find out your local user name and host name, and construct a username from these components. Since this often results in a username that is not very useful, it will print a warning if it has to do this. If all of these mechanisms fail, Mercurial will fail, printing an error message. In this case, it will not let you commit until you set up a username.}
\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}
|