121 %% There are some %$ used just to minimise the effect of $ sign used in lstlisting. In emacs it looks unhealthy. |
121 %% There are some %$ used just to minimise the effect of $ sign used in lstlisting. In emacs it looks unhealthy. |
122 |
122 |
123 % Introduction to course-need of version control, history, options available. |
123 % Introduction to course-need of version control, history, options available. |
124 \section{Introduction} |
124 \section{Introduction} |
125 |
125 |
126 \begin{frame} |
126 %% Home made version control system? |
127 \frametitle{What is Version Control?} |
127 \begin{frame}[fragile] |
|
128 \frametitle{Home-brew} |
|
129 \begin{center} |
|
130 \includegraphics[height=1.8in,width=4.2in]{folder.png} |
|
131 \end{center} |
|
132 \begin{lstlisting} |
|
133 $ ls |
|
134 a.out id1.txt id2.txt identifier.cpp id.txt lex pda1.cpp pda2.cpp pda.cpp pda.txt string.txt |
|
135 \end{lstlisting} %%$ |
|
136 %%a screen-shot of folder with all crazy names. |
|
137 \end{frame} |
|
138 |
|
139 \begin{frame}[fragile] |
|
140 \frametitle{Problems with such nomenclature} |
|
141 \begin{block}{} |
|
142 \begin{itemize} |
|
143 \item Difficult to relate to content of file. |
|
144 \item Cant track changes done to file. |
|
145 \item It wont scale. |
|
146 \end{itemize} |
|
147 \end{block} |
|
148 \end{frame} |
|
149 |
|
150 \begin{frame} |
|
151 \frametitle{What is version control} |
128 \begin{block}{From a blog post} |
152 \begin{block}{From a blog post} |
129 ``Version control (or source control) is nothing more arcane than keeping copies of ones work as one make changes to it.'' |
153 ``Version control (or source control) is nothing more than keeping copies of work as we make changes to it.'' |
130 \end{block} |
154 \end{block} |
131 \pause |
155 \end{frame} |
132 \begin{block}{} |
156 |
133 It is better to use these tools rather than wasting creativity to invent VCS which have files with names like \begin{color}{red}{prog1.py, prog2.py}\end{color} or \begin{color}{red}prog-old.py, prog.py.\end{color} |
157 \begin{frame}[fragile] |
134 \end{block} |
158 \frametitle{Need of Version Control} |
135 \end{frame} |
|
136 |
|
137 \begin{frame} |
|
138 \frametitle{Motivation behind such tools} |
|
139 \begin{itemize} |
159 \begin{itemize} |
140 \item Track the history and evolution of a program. |
160 \item Track the history and evolution of a program. |
141 \item To collaborate effectively on a project. |
161 \item To collaborate effectively on a project. |
142 \item \begin{color}{red}``To err is Human''\end{color} \pause for recovery we have ``Version Control'' |
162 \item \begin{color}{red}``To err is Human''\end{color} for recovery we have ... |
143 \end{itemize} |
163 \end{itemize} |
144 \end{frame} |
164 \end{frame} |
145 |
165 |
146 %% Introduction to how logs are managed in VCS. |
166 %% Introduction to how logs are managed in VCS. |
147 %% A analogy in logs and day-to-day life? |
167 %% A analogy in logs and day-to-day life? |
148 \begin{frame}[fragile] |
168 \begin{frame}[fragile] |
149 \frametitle{How does it work?} |
169 \frametitle{How does it work? Analogy} |
150 It can roughly be related to Computer/Video Games. |
170 It can roughly be related to Computer/Video Games. |
151 \begin{itemize} |
171 \begin{itemize} |
152 \item We play games in stages. |
172 \item We play games in stages. |
153 \item We pass a stage/task- \begin{color}{red}we SAVE the game.\end{color} |
173 \item We pass a stage/task- \begin{color}{red}we SAVE the game.\end{color} |
154 \item We resume playing from there onwards. |
174 \item We resume playing from there onwards. |
166 \end{frame} |
186 \end{frame} |
167 |
187 |
168 \begin{frame} |
188 \begin{frame} |
169 \frametitle{How is it done?} |
189 \frametitle{How is it done?} |
170 \begin{itemize} |
190 \begin{itemize} |
171 \item It keeps track of changes you make to a file. You can improvise, revisit, and amend. |
191 \item It keeps track of changes you make to a file. You can improve, revisit, and amend. |
172 \item All procedure is logged/recorded, so you and others can follow the development cycle. |
192 \item All changes are logged/recorded, so you and others can follow the development cycle. |
173 \end{itemize} |
193 \end{itemize} |
174 \end{frame} |
194 \end{frame} |
175 |
195 |
176 \begin{frame} |
196 |
177 \frametitle{Do we really need this?} |
197 %% Introduction to jargon |
178 \emphbar{For team of people working remotely(even different computers/machines) on a project, use of version control is inevitable!} |
198 %% This should have some excerpts from normal systems. |
179 \vspace{0.15in} |
199 %% Like diffs, folders etc. |
180 \emphbar{For single person: managing projects and assignments becomes easy} |
200 |
181 \vspace{0.15in} |
201 %% \section{Learning the Lingo!} |
182 \pause |
202 |
183 \emphbar{\color{red}{It is a good habit!}} |
203 %% \begin{frame}[fragile] |
184 \end{frame} |
204 %% \frametitle{Common jargon: Basic setup} |
185 |
205 %% \begin{lstlisting} |
186 \begin{frame} |
206 %% $ ls slides/ |
187 \frametitle{Whats on the menu!} |
207 %% filter.png lena_mean.png lena.png |
188 \begin{itemize} |
208 %% neighbour.png pool.aux pool.log |
189 \item cvs (Concurrent Version System) |
209 %% pool.nav pool.out pool.pdf pool.snm |
190 \item svn (Subversion) |
210 %% pool.tex pool.tex~ pool.toc pool.vrb |
191 \item hg (Mercurial) |
211 %% \end{lstlisting} %%$ |
192 \item bzr (Bazaar) |
212 %% \begin{itemize} |
193 \item git |
213 %% \item Repository(repo):\\ |
194 \end{itemize} |
214 %% The folder with all files. |
195 \inctime{10} |
215 %% %% \item Server:\\ |
196 \end{frame} |
216 %% %% Machine with main inventory/repo. |
197 |
217 %% %% \item Client:\\ |
198 % Introduction to jargon |
218 %% %% Local machines with copy of main repo. |
199 \section{Learning the Lingo!} |
219 %% \end{itemize} |
200 |
220 %% \end{frame} |
201 \begin{frame} |
221 |
202 \frametitle{Common jargon: Basic setup} |
222 %% \begin{frame}[fragile] |
203 \begin{itemize} |
223 %% \frametitle{Actions} |
204 \item Repository(repo):\\ |
224 %% \begin{itemize} |
205 The folder with all files. |
225 %% \item Add:\\ |
206 \item Server:\\ |
226 %% Creating/Copying files(cp, touch). |
207 Machine with main inventory/repo. |
227 %% \item Check out/Clone:\\ |
208 \item Client:\\ |
228 %% Creating copy of working folder. |
209 Local machines with copy of main repo. |
229 %% \end{itemize} |
210 \end{itemize} |
230 %% \begin{lstlisting} |
211 \end{frame} |
231 %% $ cp -rv circulate/ local |
212 |
232 %% `circulate/' -> `local' |
213 \begin{frame} |
233 %% `circulate/sslc1.txt' -> `local/sslc1.txt' |
214 \frametitle{Actions} |
234 %% `circulate/pos.txt' -> `local/pos.txt' |
215 \begin{itemize} |
235 %% `circulate/pendulum.txt' -> `local/pendulum.txt' |
216 \item Add:\\ |
236 %% `circulate/lena.png' -> `local/lena.png' |
217 Adding file into the repo for the first time. |
237 %% `circulate/sslc1.py' -> `local/sslc1.py' |
218 \item Version:\\ |
238 %% `circulate/points.txt' -> `local/points.txt' |
219 Version number(Die Hard 4.0). |
239 %% \end{lstlisting} %%$ |
220 \item Head/Tip:\\ |
240 %% \end{frame} |
221 Most recent revision/stage. |
241 |
222 \item Check out/Clone:\\ |
242 %% \begin{frame} |
223 Initial download of working copy. |
243 %% \frametitle{Actions cont...} |
224 \item Commit:\\ |
244 %% \begin{itemize} |
225 Saving(recording) a change. |
245 %% \item Version:\\ |
226 \item Change log/History:\\ |
246 %% Version number(Die Hard 4.0).\\ |
227 List of all past changes. |
247 %% Making changes to folder, changes state/version. |
228 \end{itemize} |
248 %% \item Head/Tip:\\ |
229 \end{frame} |
249 %% Most recent revision/stage. |
230 |
250 %% \item Commit:\\ |
231 \begin{frame} |
251 %% Saving(recording) a change. |
232 \frametitle{Actions cont...} |
252 %% \item Change log/History:\\ |
233 \begin{itemize} |
253 %% List of all past changes. |
234 \item Branch:\\ |
254 %% \end{itemize} |
235 Separate local copy for bug fixing, testing. |
255 %% \end{frame} |
236 \item Diff/Change:\\ |
256 |
237 Changes made in a file in two different versions. |
257 %% \begin{frame} |
238 \item Merge (or patch):\\ |
258 %% \frametitle{Actions cont...} |
239 Appling the changes to file, to make it up-to-date. |
259 %% \begin{itemize} |
240 \item Conflict:\\ |
260 %% \item Branch:\\ |
241 When merging a file is not obvious. |
261 %% Separate local copy for bug fixing, testing. |
242 \item Resolve:\\ |
262 %% \item Diff/Change:\\ |
243 Fixing the conflict manually. |
263 %% Changes made in a file in two different versions. |
244 \end{itemize} |
264 %% \item Merge (or patch):\\ |
245 \end{frame} |
265 %% Appling the changes to file, to make it up-to-date. |
246 |
266 %% \item Conflict:\\ |
247 % Types of Version Controls |
267 %% When merging a file is not obvious. |
248 \section{Types of VCS} |
268 %% \item Resolve:\\ |
249 |
269 %% Fixing the conflict manually. |
250 \begin{frame} |
270 %% \end{itemize} |
251 \frametitle{Types:} |
271 %% \end{frame} |
252 Based on ways of managing the repo there are two types of VCS: |
272 |
253 \begin{itemize} |
273 %% % Types of Version Controls |
254 \item Centralized VCS\\ |
274 %% %% \section{Types of VCS} |
255 cvs, svn fall under this category. |
275 |
256 \item Distributed VCS\\ |
276 %% %% \begin{frame} |
257 hg, bzr, git follows this methodology. |
277 %% %% \frametitle{Types:} |
258 \end{itemize} |
278 %% %% Based on ways of managing the repo there are two types of VCS: |
259 \emphbar{We would be covering \typ{hg}} |
279 %% %% \begin{itemize} |
260 \end{frame} |
280 %% %% \item Centralized VCS\\ |
261 |
281 %% %% cvs, svn fall under this category. |
262 \begin{frame} |
282 %% %% \item Distributed VCS\\ |
263 \frametitle{Why hg?} |
283 %% %% hg, bzr, git follows this methodology. |
264 \includegraphics[height=.75in, interpolate=true]{mercurial} |
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: |
265 \begin{itemize} |
292 \begin{itemize} |
266 \item Easy to learn and use. |
293 \item Easy to learn and use. |
267 \item Lightweight. |
294 \item Lightweight. |
268 \item Scales excellently. |
295 \item Scales excellently. |
269 \item Written in Python. |
296 \item Written in Python. |
270 \end{itemize} |
297 \end{itemize} |
271 \inctime{10} |
298 \inctime{15} |
272 \end{frame} |
299 \end{frame} |
273 |
300 |
274 % Initializing the repo, cloning, committing changes, pushing, pulling to repo. |
301 % Initializing the repo, cloning, committing changes, pushing, pulling to repo. |
275 \section{Getting Started} |
302 \section{Getting Started} |
276 |
303 |
|
304 \begin{frame} |
|
305 \frametitle{Objective} |
|
306 \begin{block}{} |
|
307 We would \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 |
277 \begin{frame}[fragile] |
316 \begin{frame}[fragile] |
278 \frametitle{Getting comfortable:} |
317 \frametitle{Getting comfortable:} |
279 For checking \typ{hg} installation and its version try: |
318 For checking \typ{hg} installation and its version type: |
280 \begin{lstlisting} |
319 \begin{lstlisting} |
281 $ hg version |
320 $ hg version |
282 \end{lstlisting} |
321 \end{lstlisting} |
283 To get broad help on \typ{hg} and commands available: |
322 To get broad help on \typ{hg} and commands available: |
284 \begin{lstlisting} |
323 \begin{lstlisting} |
291 \end{lstlisting} %$ |
330 \end{lstlisting} %$ |
292 \end{frame} |
331 \end{frame} |
293 |
332 |
294 \begin{frame}[fragile] |
333 \begin{frame}[fragile] |
295 \frametitle{Getting working/existing code base} |
334 \frametitle{Getting working/existing code base} |
296 \typ{clone} is used to make a copy of an existing repository. It can be both local or remote. |
335 To get a already existing code-base: |
297 \begin{lstlisting} |
336 \begin{lstlisting} |
298 $ hg clone |
337 $ hg clone |
299 http://hg.serpentine.com/tutorial/hello |
338 http://hg.serpentine.com/tutorial/hello |
300 localCopyhello |
339 localCopyhello |
301 \end{lstlisting} |
340 \end{lstlisting} |
302 And we get a local copy of this repository. |
341 \typ{localCopyhello} is copy of code-base. |
303 \begin{lstlisting} |
342 \begin{lstlisting} |
304 $ ls localCopyhello/ |
343 $ ls localCopyhello/ |
305 hello.c Makefile |
344 hello.c Makefile |
306 \end{lstlisting} |
345 \end{lstlisting} |
307 \end{frame} |
346 \end{frame} |
308 |
347 |
309 \begin{frame}[fragile] |
348 %%introduction to clone, repo, server, client. |
310 \frametitle{To start track-record on existing files} |
349 \begin{frame}[fragile] |
311 I have some files which I want to bring under version control. \typ{hg} provides \typ{init} command for this: |
350 \frametitle{What did we do!} |
|
351 \begin{block}{Explanation} |
|
352 \begin{itemize} |
|
353 \item<1-> \typ{hello} is a \alert{repo}, it's a collection of files and folders. |
|
354 \item<2-> This repo is located on remote(\alert{server}) machine. |
|
355 \item<3-> We copy(\alert{clone}) repo to our local machine. |
|
356 \end{itemize} |
|
357 \end{block} |
|
358 \end{frame} |
|
359 |
|
360 \begin{frame}[fragile] |
|
361 \frametitle{Creating repo of existing files} |
|
362 I have some files which I want to bring under version control. \typ{hg} provides \alert{\typ{init}} command for this: |
312 \begin{lstlisting} |
363 \begin{lstlisting} |
313 $ ls -a circulate/ |
364 $ ls -a circulate/ |
314 . .. lena.png pendulum.txt points.txt pos.txt sslc1.py sslc1.txt |
365 . .. lena.png pendulum.txt points.txt pos.txt sslc1.py sslc1.txt |
315 $ cd circulate/ |
366 $ cd circulate/ |
316 $ hg init |
367 $ hg init |
343 $ hg clone localCopyhello newCopy |
393 $ hg clone localCopyhello newCopy |
344 updating working directory |
394 updating working directory |
345 2 files updated, 0 files merged, |
395 2 files updated, 0 files merged, |
346 0 files removed, 0 files unresolved |
396 0 files removed, 0 files unresolved |
347 \end{lstlisting} |
397 \end{lstlisting} |
348 or |
398 \alert{or} |
349 \begin{lstlisting} |
399 \begin{lstlisting} |
350 $ hg clone Fevicol Fevicol-pull |
400 $ hg clone letter letter-clone |
351 updating working directory |
401 updating working directory |
352 0 files updated, 0 files merged, |
402 0 files updated, 0 files merged, |
353 0 files removed, 0 files unresolved |
403 0 files removed, 0 files unresolved |
354 \end{lstlisting} |
404 \end{lstlisting} |
355 \inctime{20} |
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} |
|
412 \item To keep separate set for \alert{experimentation}. |
|
413 \item Simple way to \alert{backup} all in one go! |
|
414 \item It helps in collaborative environment. |
|
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} |
|
418 \end{block} |
|
419 \inctime{15} |
356 \end{frame} |
420 \end{frame} |
357 |
421 |
358 %% Should we here stress on how are distribute VCS have |
422 %% Should we here stress on how are distribute VCS have |
359 %% different approach then centralized ones? Maybe a pic |
423 %% different approach then centralized ones? Maybe a pic |
360 %% or some other graphical representation. |
424 %% or some other graphical representation. |
361 \begin{frame}[fragile] |
425 \begin{frame}[fragile] |
362 \frametitle{Revisiting saved points:history/logs} |
426 \frametitle{Revisiting saved points:history/logs} |
363 In \typ{hg}, the difference between consecutive stages is termed as changeset.\\ |
427 In \typ{hg}, the difference between consecutive stages is termed as \alert{changeset}.\\ |
364 Once we have saved stages, we need a mechanism to review and access them, for that use \typ{log} command. |
428 Once we have saved stages, we need a mechanism to review and access them, for that use \alert{\typ{log}} command. |
365 \begin{lstlisting} |
429 \begin{lstlisting} |
366 $ cd localCopyhello |
430 $ cd localCopyhello |
367 $ hg log |
431 $ hg log |
368 \end{lstlisting} |
432 \end{lstlisting} |
369 \end{frame} |
433 \end{frame} |
370 |
434 |
371 \begin{frame}[fragile] |
435 \begin{frame}[fragile] |
372 \frametitle{Understanding output} |
436 \frametitle{Understanding output} |
373 The output provides following information: |
437 It provides following information: |
374 \begin{itemize} |
438 \begin{itemize} |
375 \item changeset: Identifiers for the changeset. |
439 \item \alert{changeset}: Identifiers for the changeset. |
376 \item user: Person who created the changeset. |
440 \item \alert{user}: Person who created the changeset. |
377 \item date: Date and time of creation of changeset. |
441 \item \alert{date}: Date and time of creation of changeset. |
378 \item summary: One line description. |
442 \item \alert{summary}: One line description. |
379 \end{itemize} |
443 \end{itemize} |
380 \end{frame} |
444 \end{frame} |
|
445 |
|
446 %% here we should have image of dotA or halo for resuming from a stage in game. |
381 |
447 |
382 \begin{frame}[fragile] |
448 \begin{frame}[fragile] |
383 \frametitle{History/Logs cont...} |
449 \frametitle{History/Logs cont...} |
384 By default \typ{log} returns complete list of all changes. \\ |
450 By default \typ{log} returns complete list of all changes. \\ |
385 For selective view try: |
451 For selective view try: |
395 \end{frame} |
461 \end{frame} |
396 |
462 |
397 \begin{frame}[fragile] |
463 \begin{frame}[fragile] |
398 \frametitle{Advancing through a stage:status} |
464 \frametitle{Advancing through a stage:status} |
399 We often need to add/delete some files from directory(repo). The structure keeps on evolving, and tools for handling them are needed.\\ |
465 We often need to add/delete some files from directory(repo). The structure keeps on evolving, and tools for handling them are needed.\\ |
400 We will use the Fevicol repo we created earlier. |
466 We will use the \typ{letter} repo we created earlier. |
401 \begin{lstlisting} |
467 \begin{lstlisting} |
402 $ cd Fevicol |
468 $ cd letter |
403 $ hg log |
469 $ hg log |
404 $ hg st |
470 $ hg st |
405 ? feviStick.py |
471 ? letter.tex |
406 \end{lstlisting} %%$ |
472 \end{lstlisting} %%$ |
407 \typ{st} (aka status) is command to show changed files in the working directory.\\ |
473 \alert{\typ{st}} (aka status) is command to show changed files in the working directory.\\ |
408 \end{frame} |
474 \end{frame} |
409 |
475 |
410 %% track record is confusing for some. Duma have some doubts :( |
476 %% track record is confusing for some. Duma have some doubts :( |
411 \begin{frame}[fragile] |
477 \begin{frame}[fragile] |
412 \frametitle{Adding files} |
478 \frametitle{Adding files} |
413 "?" indicates that these file are aliens to track record.\\ |
479 "?" indicates that this file are aliens to track record.\\ |
414 \typ{add} command is available to add new files to present structure. |
480 \alert{\typ{add}} command is available to add new files to present structure. |
415 \begin{lstlisting} |
481 \begin{lstlisting} |
416 $ hg add feviStick.py |
482 $ hg add letter.tex |
417 $ hg st |
483 $ hg st |
418 A feviStick.py |
484 A letter.tex |
419 \end{lstlisting} |
485 \end{lstlisting} |
420 \end{frame} |
486 \end{frame} |
421 |
487 |
422 \begin{frame}[fragile] |
488 \begin{frame}[fragile] |
423 \frametitle{Saving present stage: committing} |
489 \frametitle{Saving present stage: committing} |
424 \emphbar{This is equivalent to completing tasks, before reaching a stage where you want to save.} |
490 \emphbar{This is equivalent to completing tasks, before reaching a stage where you want to save.} |
425 \typ{hg} uses \typ{ci}(aka \typ{commit}) command to save changes. So after adding file, we have to commit it also: |
491 \typ{hg} uses \alert{\typ{ci}}(aka \typ{commit}) command to save changes. So after adding file, we have to commit it also: |
426 \begin{lstlisting} |
492 \begin{lstlisting} |
427 $ hg ci -u "Shantanu <shantanu@fossee.in>" |
493 $ hg ci -u "Shantanu <shantanu@fossee.in>" |
428 -m "First commit." |
494 -m "First commit." |
429 $ hg log |
495 $ hg log |
430 changeset: 0:84f5e91f4de1 |
496 changeset: 0:210664b4ed58 |
431 tag: tip |
497 tag: tip |
432 user: Shantanu <shantanu@fossee.in> |
498 user: Shantanu <shantanu@fossee.in> |
433 date: Fri Aug 21 23:37:13 2009 +0530 |
499 date: Tue Feb 23 19:41:45 2010 +0530 |
434 summary: First commit. |
500 summary: First commit. |
435 \end{lstlisting} |
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} |
436 \end{frame} |
514 \end{frame} |
437 |
515 |
438 \begin{frame}[fragile] |
516 \begin{frame}[fragile] |
439 \frametitle{Other operations} |
517 \frametitle{Other operations} |
440 \typ{hg} supports basic file-management functions like copy, remove, rename etc. |
518 \typ{hg} supports basic file-management functions like copy, remove, rename etc. |
441 \begin{lstlisting} |
519 \begin{lstlisting} |
442 $ hg cp feviStick.py pidiLite.py |
520 $ hg cp letter.tex letter-prof.tex |
443 $ hg rename pidiLite.py feviCol.py |
521 $ hg rename letter.tex letter-personal.tex |
444 $ hg st |
522 $ hg st |
445 A feviCol.py |
523 A letter-personal.tex |
|
524 A letter-pro.tex |
|
525 R letter.tex |
446 $ hg ci -u "Shantanu <shantanu@fossee.in>" |
526 $ hg ci -u "Shantanu <shantanu@fossee.in>" |
447 -m "Added feviCol.py." |
527 -m "Renamed and added letters." |
448 $ hg tip| grep summary |
528 $ hg tip| grep summary |
449 summary: Added feviCol.py. |
529 summary: Renamed and added letters. |
450 \end{lstlisting} %$ |
530 \end{lstlisting} %$ |
451 %% Other commands which can be handy are \typ{remove}, \typ{revert} etc. |
531 %% Other commands which can be handy are \typ{remove}, \typ{revert} etc. |
452 \inctime{10} |
532 \inctime{10} |
453 \end{frame} |
533 \end{frame} |
454 |
534 |
476 \end{lstlisting} %$ |
557 \end{lstlisting} %$ |
477 \end{frame} |
558 \end{frame} |
478 |
559 |
479 \begin{frame}[fragile] |
560 \begin{frame}[fragile] |
480 \frametitle{Pulling changesets cont...} |
561 \frametitle{Pulling changesets cont...} |
481 \typ{pull} command doesn't update current directory, it just imports changesets. To add all these changes, use \typ{up}: |
562 \alert{\typ{pull}} command doesn't update current directory, it just imports changesets. To add all these changes, use \alert{\typ{up}}: |
482 \begin{lstlisting} |
563 \begin{lstlisting} |
483 $ cd Fevicol-pull |
|
484 $ ls -a |
564 $ ls -a |
485 . .. .hg |
565 . .. .hg |
486 $ hg up |
566 $ hg up |
487 2 files updated, 0 files merged, |
567 2 files updated, 0 files merged, |
488 0 files removed, 0 files unresolved |
568 0 files removed, 0 files unresolved |
489 $ ls -a |
569 $ ls -a |
490 . .. feviCol.py feviStick.py .hg |
570 . .. .hg letter-personal.tex |
491 \end{lstlisting} |
571 letter-pro.tex |
|
572 \end{lstlisting} %% $ |
492 \pause |
573 \pause |
493 \emphbar{Why \typ{pull} and \typ{up} are needed separately?} |
574 \emphbar{Why \typ{pull} and \typ{up} are needed separately?} |
494 \end{frame} |
575 \end{frame} |
495 |
576 |
496 \begin{frame}[fragile] |
577 \begin{frame}[fragile] |
497 \frametitle{Making changes across branches} |
578 \frametitle{Content of letter} |
498 \begin{lstlisting} |
579 Personal letter can be letter to ask a girl out!\\ |
499 $ cd Fevicol-pull/ |
580 Using LaTeX to write letter, it would be straight forward: |
500 \end{lstlisting} %$ |
581 |
501 Lets edit and correct the feviStick.py |
582 \begin{small} |
502 \begin{lstlisting} |
583 \begin{block}{} |
503 $ echo "print 'Ab no more Chip Chip'" |
584 \begin{lstlisting} |
504 > feviStick.py |
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} |
|
596 |
|
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} |
505 $ hg st |
605 $ hg st |
506 M feviStick.py |
606 M letter-personal.tex |
507 \end{lstlisting} |
607 \end{lstlisting} %%$ |
508 'M' sign indicates that \typ{hg} has noticed change.\\ |
608 \alert{'M'} sign indicates that \typ{hg} has noticed change in that particular file. |
509 \end{frame} |
609 \end{frame} |
510 |
610 |
511 \begin{frame}[fragile] |
611 \begin{frame}[fragile] |
512 \frametitle{Revisiting changes} |
612 \frametitle{Revisiting changes} |
513 To view changes made \typ{hg} provides \typ{diff}: |
613 To view changes made \typ{hg} provides \alert{\typ{diff}}: |
514 \begin{lstlisting} |
614 \begin{small} |
|
615 \begin{lstlisting} |
515 $ hg diff |
616 $ hg diff |
516 diff -r a7912d45f47c feviStick.py |
617 diff -r 4a2d973a92de letter-personal.tex |
517 --- a/feviStick.py Sun Aug 23 22:34:35 2009 +0530 |
618 --- a/letter-personal.tex Tue Feb 23 19:50:39 2010 +0530 |
518 +++ b/feviStick.py Sun Aug 23 22:47:49 2009 +0530 |
619 +++ b/letter-personal.tex Tue Feb 23 20:28:46 2010 +0530 |
519 @@ -1,1 +1,1 @@ |
620 @@ -0,0 +1,11 @@ |
520 -print 'Yeh Fevicol ka Majboot jod hai' |
621 +\documentclass{letter} |
521 +print 'Ab no more Chip Chip' |
622 +\begin{document} |
522 \end{lstlisting} %$ |
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} |
523 \end{frame} |
632 \end{frame} |
524 |
633 |
525 \begin{frame}[fragile] |
634 \begin{frame}[fragile] |
526 \frametitle{Saving the changes} |
635 \frametitle{Saving the changes} |
527 We have to commit these changes. |
636 We have to commit these changes. |
528 \begin{lstlisting} |
637 \begin{lstlisting} |
529 $ hg ci -u "Shantanu <shantanu@fossee.in>" |
638 $ hg ci -u "Shantanu <shantanu@fossee.in>" |
530 -m "Changed tagline for feviStick.py." |
639 -m "Added content to personal letter." |
531 \end{lstlisting} %$ |
640 \end{lstlisting} %$ |
532 \end{frame} |
641 \end{frame} |
533 |
642 |
534 \begin{frame}[fragile] |
643 \begin{frame}[fragile] |
535 \frametitle{Syncing two repos} |
644 \frametitle{Syncing two repos} |
536 To bring both the repos at same stage we have to \typ{push} differences. |
645 To bring both the repos at same stage we have to \alert{\typ{push}} changesets |
537 \begin{lstlisting} |
646 \begin{lstlisting} |
538 $ hg push |
647 $ hg push |
539 pushing to /home/baali/Fevicol |
648 pushing to /home/baali/letter |
540 searching for changes |
649 searching for changes |
541 adding changesets |
650 adding changesets |
542 adding manifests |
651 adding manifests |
543 adding file changes |
652 adding file changes |
544 added 1 changesets with 1 changes to 1 files |
653 added 1 changesets with 1 changes to 1 files |
545 \end{lstlisting} %$ |
654 \end{lstlisting} %$ |
546 \end{frame} |
655 \end{frame} |
547 |
656 |
548 \begin{frame}[fragile] |
657 \begin{frame}[fragile] |
549 \frametitle{Syncing cont...} |
658 \frametitle{Syncing cont...} |
550 Same as pulling, pushing wont update the main directory by default. |
659 Same as \typ{pull}, \typ{push} wont update the main directory by default. |
551 \begin{lstlisting} |
660 \begin{lstlisting} |
552 $ cd Fevicol |
661 $ cd letter |
553 $ hg tip |
662 $ hg tip |
554 $ cat feviStick.py |
663 $ cat letter-personal.tex |
555 \end{lstlisting} |
664 \end{lstlisting} %%$ |
556 \typ{tip} shows latest changeset, but content of file are not updated. We have to use \typ{up} on main branch |
665 \alert{\typ{tip}} shows latest changeset, but content of file are not updated.\\ |
|
666 We have to use \typ{up} on main branch |
557 \begin{lstlisting} |
667 \begin{lstlisting} |
558 $ hg up |
668 $ hg up |
559 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
669 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
560 \end{lstlisting} %$ |
670 \end{lstlisting} %$ |
561 \inctime{15} |
671 \inctime{15} |
568 \begin{center} |
678 \begin{center} |
569 \includegraphics[height=1in, interpolate=true]{scenario} |
679 \includegraphics[height=1in, interpolate=true]{scenario} |
570 \end{center} |
680 \end{center} |
571 \end{frame} |
681 \end{frame} |
572 |
682 |
573 \begin{frame}[fragile] |
683 \begin{frame} |
574 \frametitle{Making changes to one of repo} |
684 \frametitle{Scenario cont...} |
575 \begin{lstlisting} |
685 \begin{block}{} |
576 $ cd Fevicol-pull |
686 \begin{itemize} |
577 $ echo "print 'Yeh Fevicol ka Majboot jod |
687 \item To make this letter better, I ask for suggestions. |
578 hai, tootega nahin'" > feviCol.py |
688 \item Friend of mine, clones this repo and edit things. |
579 $ hg st |
689 \item When he/she pushes changes, I can decide to use them or not. |
580 M feviStick.py |
690 \end{itemize} |
581 $ hg ci -u "Shantanu <shantanu@fossee.in>" |
691 \end{block} |
582 -m "Updated tag line for feviCol.py." |
692 \end{frame} |
583 $ hg tip| grep changeset |
693 |
584 changeset: 3:caf986b15e05 |
694 \begin{frame}[fragile] |
585 \end{lstlisting} %$ |
695 \frametitle{Creating more clones for sharing} |
586 \end{frame} |
696 I create a clone of repo which is accessible to my friend. |
587 |
697 \begin{lstlisting} |
588 \begin{frame}[fragile] |
698 $ hg clone letter letter-suggestion |
589 \frametitle{In the meanwhile, other repo is ...} |
699 updating working directory |
590 \begin{lstlisting} |
700 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
591 $ cd Fevicol |
701 \end{lstlisting} %$ |
592 $ echo "print 'Jor laga ke hayyiya'" |
702 \end{frame} |
593 > firstAdd.py |
703 |
594 $ hg add |
704 %% here we can have introduction to concept of DVCS and CVCS? |
595 $ hg st |
705 |
596 A firstAdd.py |
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} |
597 $ hg ci -u "Shantanu <shantanu@fossee.in>" |
742 $ hg ci -u "Shantanu <shantanu@fossee.in>" |
598 -m "Added firsAdd.py." |
743 -m "Changed name." |
599 $ hg tip|grep changeset |
744 $ hg tip|grep changeset |
600 changeset: 3:fadbd6492cc4 |
745 changeset: 3:fadbd6492cc4 |
601 \end{lstlisting} |
746 \end{lstlisting} |
|
747 %%\emphbar{\alert{moral:} Don't wait for it!} |
602 \end{frame} |
748 \end{frame} |
603 |
749 |
604 %%\hspace*{-0.5in} |
750 %%\hspace*{-0.5in} |
605 |
751 |
606 \begin{frame}[fragile] |
752 \begin{frame}[fragile] |
607 \frametitle{Situation} |
753 \frametitle{Situation} |
608 \begin{columns} |
754 \begin{columns} |
609 \column{0.5\textwidth} |
755 \column{0.5\textwidth} |
610 \begin{block}{\center{main directory}} |
756 \begin{block}{\center{main directory}} |
611 \includegraphics[height=2in, interpolate=true]{main} |
757 \includegraphics[height=2in, interpolate=true]{glog-main} |
612 \end{block} |
758 \end{block} |
613 \column{0.5\textwidth} |
759 \column{0.5\textwidth} |
614 \begin{block}{\center{cloned directory}} |
760 \begin{block}{\center{cloned directory}} |
615 \includegraphics[height=2in, interpolate=true]{clone} |
761 \includegraphics[height=2in, interpolate=true]{glog-suggestion} |
616 \end{block} |
762 \end{block} |
617 \end{columns} |
763 \end{columns} |
618 \end{frame} |
764 \end{frame} |
619 |
765 |
620 \begin{frame}[fragile] |
766 \begin{frame}[fragile] |
621 \frametitle{Merging} |
767 \frametitle{Merging} |
622 \emphbar{Lets sync both these branches!} |
768 \emphbar{Lets sync both these branches!} |
623 \begin{lstlisting} |
769 \begin{lstlisting} |
624 $ hg pull ../Fevicol-pull |
770 $ hg pull ../letter-suggestion |
625 pulling from ../Fevicol-pull |
771 pulling from ../letter-suggestion |
626 searching for changes |
772 searching for changes |
627 adding changesets |
773 adding changesets |
628 adding manifests |
774 adding manifests |
629 adding file changes |
775 adding file changes |
630 added 1 changesets with 1 changes to 1 files (+1 heads) |
776 added 1 changesets with 1 changes to 1 files (+1 heads) |
631 (run 'hg heads' to see heads, 'hg merge' to merge) |
777 (run 'hg heads' to see heads, 'hg merge' to merge) |
632 \end{lstlisting} %$ |
778 \end{lstlisting} %$ |
633 \begin{itemize} |
779 \begin{itemize} |
634 \item \typ{pull} can be done from a branch explicitly also. |
780 \item \typ{pull} can be done from a branch explicitly also. |
635 \item Output is already suggesting something! |
781 \pause |
|
782 \item \alert{Output is already suggesting something!} |
636 \end{itemize} |
783 \end{itemize} |
637 \end{frame} |
784 \end{frame} |
638 |
785 |
639 %% Here one can mention the point of having push and pull separate. Because of this policy, changes made are not lost. |
786 %% Here one can mention the point of having push and pull separate. Because of this policy, changes made are not lost. |
640 \begin{frame}[fragile] |
787 \begin{frame}[fragile] |
641 \frametitle{Analyzing events in detail} |
788 \frametitle{Analyzing events in detail} |
642 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. |
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. |
643 \begin{tiny} |
790 \begin{tiny} |
644 \begin{lstlisting} |
791 \begin{lstlisting} |
645 $ hg heads |
792 $ hg heads |
646 changeset: 4:c5f40fda69cf |
793 changeset: 4:71fd776d856b |
647 tag: tip |
794 tag: tip |
648 parent: 2:0b8286c48e88 |
795 parent: 2:a5d8cb2fac01 |
649 user: Shantanu <shantanuc@fosse.in> |
796 user: Vattam <vattam@fossee.in> |
650 date: Fri Jan 22 19:43:46 2010 +0530 |
797 date: Wed Feb 24 12:54:31 2010 +0530 |
651 summary: Updated tagline for feviCol.py. |
798 summary: Added some suggestions. |
652 |
799 |
653 changeset: 3:60edf0e499e7 |
800 changeset: 3:02b49a53063f |
654 user: Shantanu <shantanuc@fosse.in> |
801 user: Shantanu <Shantanu@fossee.in> |
655 date: Fri Jan 22 19:47:58 2010 +0530 |
802 date: Wed Feb 24 13:12:26 2010 +0530 |
656 summary: Added firstAdd.py. |
803 summary: Changed name. |
657 \end{lstlisting} %%$ |
804 \end{lstlisting} %%$ |
658 \end{tiny} |
805 \end{tiny} |
659 It shows current repository heads or show branch head |
806 It shows current repository heads or show branch head |
660 \end{frame} |
807 \end{frame} |
661 |
808 |
698 \begin{frame}[fragile] |
846 \begin{frame}[fragile] |
699 \frametitle{\typ{glog}} |
847 \frametitle{\typ{glog}} |
700 \begin{center} |
848 \begin{center} |
701 \includegraphics[height=2.8in]{glog-2} |
849 \includegraphics[height=2.8in]{glog-2} |
702 \end{center} |
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! |
703 \end{frame} |
862 \end{frame} |
704 |
863 |
705 \begin{frame}[fragile] |
864 \begin{frame}[fragile] |
706 \frametitle{More information} |
865 \frametitle{More information} |
707 \begin{itemize} |
866 \begin{itemize} |
708 \item \typ{merge} fails if there are conflicting changes. |
867 \item \typ{merge} fails if there are conflicting changes. |
709 \begin{itemize} |
868 \begin{itemize} |
710 \item Like two persons editing same file, same line and pushing it upstream. |
869 \item Like two persons editing same file, same line and pushing it upstream. |
711 \end{itemize} |
870 \end{itemize} |
712 \item In conflicts, one have to perform \typ{merge} manually. |
871 \item In conflicts, one have to perform \typ{merge} manually. |
713 \item \typ{hg} provides \typ{incoming} command, which checks the would-be imported changes |
872 \item \typ{hg} provides \alert{\typ{incoming}} command, which checks the would-be imported changes |
714 \begin{itemize} |
873 \begin{itemize} |
715 \item To avoid conflicting changes before importing. |
874 \item To avoid conflicting changes before importing. |
716 \end{itemize} |
875 \end{itemize} |
717 \end{itemize} |
876 \end{itemize} |
718 \end{frame} |
877 \inctime{10} |
719 |
878 \end{frame} |
|
879 |
|
880 %% Manual and force merge |
|
881 %% hgignore |
|
882 |
|
883 %% Reverting to previous versions! |
720 % Steps to follow to make life easier. How to avoid/handle manual merges. |
884 % Steps to follow to make life easier. How to avoid/handle manual merges. |
721 \section{Work flow: DOS and DON'Ts} |
885 \section{Work flow: DOS and DON'Ts} |
722 |
886 |
723 \begin{frame} |
887 \begin{frame} |
724 \frametitle{Motto behind hg} |
888 \frametitle{Motto behind hg} |