diff options
author | Primal Pappachan | 2012-01-27 15:38:44 +0530 |
---|---|---|
committer | Primal Pappachan | 2012-01-27 15:38:44 +0530 |
commit | 473d36c8e626a9cbc3bf293dab15f1e695563b76 (patch) | |
tree | 887a692e87b2ae45688abd61b3b6f13f54b837da | |
parent | 04ab5683d37511c35f242d78c4e6f05a104d4c73 (diff) | |
download | sdes-stscripts-473d36c8e626a9cbc3bf293dab15f1e695563b76.tar.gz sdes-stscripts-473d36c8e626a9cbc3bf293dab15f1e695563b76.tar.bz2 sdes-stscripts-473d36c8e626a9cbc3bf293dab15f1e695563b76.zip |
Split first into 2 parts and added evaluation questions
-rw-r--r-- | Version_Control/vcs1/vcs1.rst | 255 |
1 files changed, 82 insertions, 173 deletions
diff --git a/Version_Control/vcs1/vcs1.rst b/Version_Control/vcs1/vcs1.rst index f2720df..2e55493 100644 --- a/Version_Control/vcs1/vcs1.rst +++ b/Version_Control/vcs1/vcs1.rst @@ -9,10 +9,11 @@ Version Control using Hg - Part I .. Author : Primal Pappachan Internal Reviewer : Kiran Isukapatla - Date: Jan 8, 2012 --------- -Script --------- + Date: Jan 27, 2012 + +--------------------- +Spoken Tutorial Script +---------------------- .. L1 @@ -51,13 +52,15 @@ As the quote from the famous blog post 'Version Control for masses' says "Version control is one of those weird, geeky things that never really gained much ground in non-geek fields, despite the fact that it’s blindingly useful." +Over the course of these 3 spoken tutorials, we are going to see a handful of such things, which are widely used in the programmer world, but not so much in the scientific computing world, even when if they would be very useful. + .. L4 {{{Show the slide 'Home-brewed'}}} .. R5 -Let's look at an example of home-brew Version Control system +Let's look at an example of home-brewed Version Control system Version control is a way of backing up files, before making changes. Most people would have cooked up their own version control system, without realizing, there were tools built by others, that performs the task in a more organized and systematic way. @@ -65,11 +68,13 @@ Version control is a way of backing up files, before making changes. Most people {{{Show the slide 'Problems'}}} -Let's look at the various problems associated with this set-up. - .. R6 -Now, let's move to identifying the needs for a 'Version Control System'. +Let's look at the various problems associated with this set-up. + + 1. Name and changes made are not related or linked. + #. Can't track sequence of changes made to a fike + #. Does not scale .. L6 @@ -77,238 +82,142 @@ Now, let's move to identifying the needs for a 'Version Control System'. .. R7 -We have seen that one of the main motivations to use a Version Control system is the ability to go back to a working version of a file, when something goes wrong. Below are a few more advantages of using an automated version control system. - -1. By tracking the history of a project, any person may see the evolution of a project. - -#. Allows for effective collaboration on a project, as everything is shared. - -#. Helps to identify which additions have broken down a project and thus aids in efficient tracking down of the bugs. - -#. It is good for a one man show as it is for a big group of people working on a project. +Having seen the problems of a home brewed setup, let's now move onto identifying the needs for a 'Version Control System'. + 1. To err is Human . . . + #. Tracking the history and evolution of a project + #. To collaborate effectively on a project + #. To efficiently track down bugs and pin-point the + #. changes that caused it .. L7 -{{{Show the slide 'How does it work? - Analogy}}} +{{{Show the slide 'The need for Version Control'}}} .. R8 -It is, in some ways, similar to playing a video game. We generally play games in stages. While playing, we save the game at some instances as per our choice. We continue playing, but we could, if necessary, choose to go back to one of the saved states and start over. In this manner, we could change the state of the game. +We have seen that one of the main motivations to use a Version Control system is the ability to go back to a working version of a file, when something goes wrong. Below are a few more advantages of using an automated version control system. + + 1. By tracking the history of a project, any person may see the evolution of a +project. This helps to track what changes were made at what point of time, when +and by whom. + #. Allows for effective collaboration on a project, as everything is shared. + #. Helps to identify which additions have broken down a project and thus aids in efficient tracking down of the bugs. + #. It is good for a one man show as it is for a big group of people working on a project. + +Keeping your stuff version controlled will help avoid accidental deletion of +individual files etc. Hosting it on a remote server will protect your sanity +from a local hard disk crash. .. L8 -{{{Show the slide 'Mercurial or hg'}}} +{{{Show the slide 'How does it work? - Analogy}}} .. R9 -Some of the Version Control tools available and used widely are: - -1. cvs(Concurrent Version Systems) - -#. svn(subversion) +It is, in some ways, similar to playing a video game. We generally play games +in stages. While playing, we save the game at some instances as per our choice. +We continue playing, but we could, if necessary, choose to go back to one of +the saved states and start over. In this manner, we could change the course of the game. -#. hg(mercurial) +.. L9 -#. git +{{{Show the slide 'Mercurial or hg'}}} .. R10 -Each of these tools have their own merits and demerits. In this tutorial we shall learn how to use mercurial or hg. - -Let's now get into Installation - -.. L8 +Some of the Version Control tools available and used widely are: -sudo apt-get install mercurial + 1. cvs(Concurrent Version Systems) + #. svn(subversion) + #. hg(mercurial) + #. git .. R11 -For Windows, +Each of these tools have their own merits and demerits. In this tutorial we +shall learn how to use mercurial or hg which is easy to learn and use and +comparatively light weight. Once you learn how to use hg, you can easily try +other tools and switch to one that you feel most comfortable with. -.. L9 - -http://mercurial.selenic.com/downloads/ - -Type 'hg' which lists out all the commands +Let's now get into Installation. For Linux distributions, Ubuntu and Debian type the following in command line terminal .. L10 -$hg +sudo apt-get install mercurial .. R12 -and 'hg version' which gives the version number. +For Windows, .. L11 -$hg version - -.. R13 - -Now, what exactly is a repo? A repo/repository is a folder with contains all the files and information on all the changes that were made to it. To save disk space, hg doesn't save all files, but only saves only a series of changes made to the files. - -.. L13 +http://mercurial.selenic.com/downloads/ -{{{Show the slide for 'We need a repo!'}}} +http://hgbook.red-bean.com/read/a-tour-of-mercurial-the-basics.html -.. R14 +.. R 13 -Let's now see how to initialize a repo. +For any other Operating system, please refer the hg book for installation instruction - -.. L14 - -cd working-directory/ +Type 'hg' which lists out all the commands -$hg init +.. L12 -ls -a +$hg -.. R15 +.. R14 -The .hg directory indicates that our book directory is now a hg repository. Mercurial keeps all the history of the changes made and a few other config files etc. in this directory. +and 'hg version' which gives the version number. .. L13 -$hg status - -.. R15 - -Gives the status of our repo. As a beginner, use it often. +$hg version .. L14 -$hg help 'status' - -.. R16 - -You can use 'hg help commandname' which gives the details about the command. For example. - -.. L15 - -hg help status - -{{{Show the slides for 'Status Codes'}}} - -.. R17 - -Have a look at what various status codes, associated with the files mean. By looking at the codes, it is clear that our files are not being tracked by hg yet. Now let's move onto 'Adding Files'. - -.. L16 - -$hg status - -.. R18 - -This shows that none of the files in the folder have been added yet. - -.. L17 - -$hg add - -.. R19 - -This simply adds all the files in the (working) directory, to the repository. As expected, the status command shows an 'A' has been appended to the filenames. We could also specify files individually, for example - -.. L18 - -$ hg add filename - -.. R20 - -We have added a set of files to the repository, but we haven't told mercurial to remember these changes. Now let's take a snapshot of this working directory. This can be done by using commit command. - -.. L19 - -$hg commit -u "username <user@domain.com>" -m "Commit message." - -.. R20 - -The -u parameter allows to specify the user details. The parameter -m is used to attach a commit message which gives a description of the changes committed to the repository. Check the status of repository by typing - -.. L20 - -$ hg st - -.. R21 - -To see the history of changes made to our repository, we use hg log. We can view the change that we just made to our repository. - -.. L21 - -{{{Show the slide 'Thumbnail views'}}} - -.. R21 - -hg log gives the log of the changes made in the form of changesets. A changeset is a set of changes made to the repository between two consecutive commits. It also shows the date at which the commit was made. - - -.. R22 - -User information is set in the hgrc file. It can be either set globally or locally to the project. - -For linux systems -.. L23 - -cat ~/.hgrc -[ui] -username = username <user@domain.com> -editor = vim - - -.. R23 - - -We have now set the user-name details for mercurial to use. - -.. L24 - -{{{Show the slide 'Advice: commits, messages'}}} - -.. R24 - -1. Atomic changes; one change with one commit - -#. Single line summary — 60 to 65 characters long - -#. Followed by paragraphs of detailed description - - Why the change? - - What does it effect? - - Known bugs/issues? - - etc. - -.. L25 - {{{Show the 'summary' slide'}}} -.. R25 +.. R15 This brings us to the end of the tutorial. In this tutorial, we have -learnt to, +seen, + 1. the motivation to use version control + #. an analogy of version control with playing a video game + #. how to check if mercurial is installed, and it's version using hg version -.. L26 +.. L15 {{{Show self assessment questions slide}}} -.. R26 +.. R16 Here are some self assessment questions for you to solve -.. L27 + 1. Is Mercurial a Centralized VCS or Distributed VCS? Justify your reasoning. + #. How can you verify whether Mercurial has been installed properly? + #. What is the command for accessing built-in help system of Mercurial? + +.. L16 {{{Show the solutions slide to self assessment questions }}} -.. R27 +.. R17 And the answers, + 1. Mercurial is a Centralized Version Control system. To read more go here, http://en.wikipedia.org/wiki/Distributed_revision_control + #. $hg version - + #. $hg help command -.. L27 + +.. L17 {{{Show the thank you slide}}} -.. R28 +.. R18 + +Hope you have enjoyed this tutorial and found it useful. Feel free to play around with Mercurial and read the documentation given by hg help command. When you are ready to move on, please proceed to the second tutorial on 'Version Control using Hg' -Hope you have enjoyed this tutorial and found it useful. Thank you |