summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xTDD/using_python_framework_for_tdd/tdd2_script.rst63
-rw-r--r--Version_Control/.gitignore1
-rw-r--r--Version_Control/vcs1/vcs1.rst55
-rw-r--r--Version_Control/vcs2/vcs2.rst124
-rw-r--r--Version_Control/vcs3/vcs3.rst63
-rw-r--r--Version_Control/vcs4/vcs4.rst131
-rw-r--r--Version_Control/vcs4/vcslide4.tex26
7 files changed, 329 insertions, 134 deletions
diff --git a/TDD/using_python_framework_for_tdd/tdd2_script.rst b/TDD/using_python_framework_for_tdd/tdd2_script.rst
index f8365f5..bd5090b 100755
--- a/TDD/using_python_framework_for_tdd/tdd2_script.rst
+++ b/TDD/using_python_framework_for_tdd/tdd2_script.rst
@@ -44,20 +44,20 @@ At the end of this tutorial, you will be able to,
.. R3
-Before beginning this tutorial,we would suggest you to complete the
+Before beginning this tutorial,we suggest you to complete the
tutorial on "Test driven development-part 1".
.. R4
-To test ``fibonacci`` function we have used two test cases.
+To test ``fibonacci`` function, we have used two test cases.
It is inconvenient to repeatedly change the test conditions in
-the fibonacci.py file.Each time a new test case is added it
-introduces a 'if' statement too.
-So it is good practice to write the test cases in a separate file.
-The file will contain multiple lines,each line for separate test case,
-each line consist of two comma separated values,
-first column is the integer value which has to be passed to the function
- and the second column is the return value from the function.
+the fibonacci.py file. Each time a new test case is added, it
+introduces an 'if' statement too.
+So, it is a good practice to write the test cases in a separate file.
+This file contains multiple lines, each line representing a test case.
+Each line consists of two comma separated values in which the
+first column is the integer value that has to be passed to the function.
+ The second column is the return value from the function.
@@ -69,8 +69,8 @@ first column is the integer value which has to be passed to the function
.. R5
-Lets open the same fibonacci.py file which we have used in our
-previous tutorial.Change the code to use fibonacci_testcases.dat
+Let us open the fibonacci.py file which we have used in our
+previous tutorial. Now, change the code to use 'fibonacci_testcases.dat'
file for test cases.
@@ -81,7 +81,7 @@ file for test cases.
.. R6
-Save the fibonacci.py file. Go to terminal and run
+Save the fibonacci.py file. Switch to terminal and run
``python fibonacci.py``. It should pass all the tests.
@@ -95,9 +95,9 @@ Save the fibonacci.py file. Go to terminal and run
.. R7
So far we have used simple repetitive tests.
-Now we will see how ``Python testing frameworks`` can do the
+Now, let us see how ``Python testing frameworks`` does the
same job efficiently.
-Python provides two frameworks for testing code, unittest and
+Python provides two frameworks for testing code: unittest and
doctest.
.. L7
@@ -106,25 +106,25 @@ doctest.
.. R8
-Let us first see how doctest works.
+First, let us see how doctest works.
A docstring is used to document function. Along with the
description, interactive interpretor session's input and
output are also added.
-When executed doctest module pick up all such interactive
+When executed, the doctest module picks up all such interactive
examples, executes them and determines if the code runs
as documented.
.. L8
-{{{switch to slide7 for 3 seconds and move to to slide8,
+{{{switch to slide7 for 3 seconds and move to slide8,
Doctest for fibonacci.py}}}
.. R9
-To initiate doctest we need to import doctest module.
+To initiate doctest, we need to import the doctest module.
Testmod automatically picks all sample sessions, executes
them and compares with the documented output.
-Doctest doesn't give any output when all test pass,
+Doctest doesn't give any output when all the tests pass,
it complains only when any test fails.
.. L9
@@ -133,9 +133,9 @@ it complains only when any test fails.
.. R10
-Let us run doctests by typing ``python fibonacci.py``.
+Let us run doctest by typing ``python fibonacci.py``.
As all tests pass, doctest doesn't give any output.
-For more detailed information we can run with -v argument.
+For detailed information, we may run the file with -v argument.
Run as ``python -v fibonacci.py``.
.. L10
@@ -150,22 +150,30 @@ Run as ``python -v fibonacci.py``.
So far we have seen doctest, which is simple to use. But when
it comes to automate the process, unittest is better.
-Unittest initializes code and data, it aggregate
+Unittest initializes code and data, it aggregates
tests into collections and improves reporting.
.. L11
-{{{ switch to slide-11, Unittest }}}
+{{{ Switch to slide-11, Unittest }}}
.. R12
+<<<<<<< HEAD
To run unittest on our fibonacci function let us create a
new file ``test_fibonacci.py``. This new file will host the
test code.
To begin unittesting let us subclass the TestCase class
in unittest. We need fibonacci.py and fibonacci_testcases.py
files too.
+=======
+To run unittest on our fibonacci function, let us create a
+new file ``test_fibonacci.py``. This new file hosts the
+test code. To begin unittesting, let us subclass
+ the TestCase class in unittest. We need fibonacci.py
+ and fibonacci_testcases.py files too.
+>>>>>>> 9c943d7375af3ed25c2c1d32f42bdf359f13d115
.. L12
@@ -174,6 +182,7 @@ files too.
.. R13
+<<<<<<< HEAD
The function ``setUp`` will read all the test data and store
it in a list.The next function ``test_fibonacci`` contains
test code. The last function deletes the data from test_cases
@@ -188,8 +197,12 @@ list and closes ``fibonacci_testcases.dat`` file.
This brings us to the end of the tutorial.In this tutorial,
we have learnt to,
+=======
+This brings us to the end of the tutorial. In this tutorial,
+ we have learnt to,
+>>>>>>> 9c943d7375af3ed25c2c1d32f42bdf359f13d115
- 1. Undestand the basic steps involved in Test driven development.
+ 1. Understand the basic steps involved in Test driven development.
#. Design a Test driven approach for a given ``fibonacci`` function.
@@ -226,5 +239,5 @@ Thank you!
.. L16
-{{{ Switch to slide-16, Thankyou}}}
+{{{ Switch to slide-16, Thank you}}}
diff --git a/Version_Control/.gitignore b/Version_Control/.gitignore
index 6d99674..4525803 100644
--- a/Version_Control/.gitignore
+++ b/Version_Control/.gitignore
@@ -3,3 +3,4 @@
*.toc
*.log
*.out
+*~
diff --git a/Version_Control/vcs1/vcs1.rst b/Version_Control/vcs1/vcs1.rst
index ed5914f..306dfda 100644
--- a/Version_Control/vcs1/vcs1.rst
+++ b/Version_Control/vcs1/vcs1.rst
@@ -17,11 +17,13 @@ Spoken Tutorial Script
.. L1
-{{{ Show the first slide containing title, name of the production team along with the logo of MHRD}}}
+{{{ Show the first slide containing title, name of the production team along
+with the logo of MHRD}}}
.. R1
-Hello friends and welcome to the first part of tutorial on 'Version Control using Hg'
+Hello friends and welcome to the first part of tutorial on 'Version Control
+using Hg'
.. L2
@@ -45,14 +47,19 @@ First, let's understand what 'Version Control' is.
.. R4
-'Version control' is a way to track files over time and share them. This allows access to earlier versions of a file(s) if and when required. It therefore enables us to make changes to the content of a file, view it's change log and collaborate on a single piece of work with a team of people.
+'Version control' is a way to track files over time and share them. This allows
+access to earlier versions of a file(s) if and when required. It therefore
+enables us to make changes to the content of a file, view it's change log and
+collaborate on a single piece of work with a team of people.
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.
+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
@@ -62,7 +69,10 @@ Over the course of these 3 spoken tutorials, we are going to see a handful of su
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.
+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.
.. L5
@@ -73,7 +83,7 @@ Version control is a way of backing up files, before making changes. Most people
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
+ #. Can't track sequence of changes made to a file
#. Does not scale
.. L6
@@ -82,7 +92,8 @@ Let's look at the various problems associated with this set-up.
.. R7
-Having seen the problems of a home brewed setup, let's now move onto identifying the needs for a 'Version Control System'.
+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
@@ -96,18 +107,23 @@ Having seen the problems of a home brewed setup, let's now move onto identifying
.. R8
-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.
+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.
+ #. 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.
+from a hard disk crash.
.. L8
@@ -118,7 +134,8 @@ from a local hard disk crash.
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.
+the saved states and start over. In this manner, we could change the course of
+the game.
.. L9
@@ -140,7 +157,8 @@ 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.
-Let's now get into Installation. For Linux distributions, Ubuntu and Debian type the following in command line terminal
+Let's now get into Installation. For Linux distributions, Ubuntu and Debian
+type the following in command line terminal
.. L10
@@ -158,7 +176,8 @@ http://hgbook.red-bean.com/read/a-tour-of-mercurial-the-basics.html
.. R 13
-For any other Operating system, please refer the hg book for installation instruction -
+For any other Operating system, please refer the hg book for installation
+instruction -
Type 'hg' which lists out all the commands
@@ -206,7 +225,8 @@ Here are some self assessment questions for you to solve
And the answers,
- 1. Mercurial is a Centralized Version Control system. To read more go here, http://en.wikipedia.org/wiki/Distributed_revision_control
+ 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
@@ -217,7 +237,10 @@ And the answers,
.. 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. 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'
Thank you
diff --git a/Version_Control/vcs2/vcs2.rst b/Version_Control/vcs2/vcs2.rst
index daa5666..c69a30b 100644
--- a/Version_Control/vcs2/vcs2.rst
+++ b/Version_Control/vcs2/vcs2.rst
@@ -1,11 +1,11 @@
---------------------------------
-Version Control using Hg Part II
+Version Control using Hg Part 2
---------------------------------
.. Prerequisites
.. -------------
-.. None
+.. Version Control using Hg Part 1
.. Author : Primal Pappachan
Internal Reviewer : Kiran Isukapatla
@@ -17,11 +17,13 @@ Spoken Tutorial Script
.. L1
-{{{ Show the first slide containing title, name of the production team along with the logo of MHRD}}}
+{{{ Show the first slide containing title, name of the production team along
+with the logo of MHRD}}}
.. R1
-Hello friends and welcome to the second part of tutorial on 'Version Control using Hg'
+Hello friends and welcome to the second part of tutorial on 'Version Control
+using Hg'
.. L2
@@ -29,7 +31,8 @@ Hello friends and welcome to the second part of tutorial on 'Version Control usi
.. R2
-Please make sure that you have gone through the following tutorials before you continue on this tutorial:
+Please make sure that you have gone through the following tutorials before you
+continue on this tutorial:
.. L3
@@ -51,9 +54,13 @@ At the end of this tutorial you will be able to
.. R4
-To start using Mercurial (or hg) and get the benefits of using a version control system, we should first have a repository.
+To start using Mercurial (or hg) and get the benefits of using a version
+control system, we should first have a repository.
-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.
+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.
.. L5
@@ -61,9 +68,12 @@ Now, what exactly is a repo? A repo/repository is a folder with contains all the
.. R5
-A repository can either be started using an init command or an existing repository could be cloned. Let us look at creating our own repository, now. We can look at obtaining already existing repositories, at a later stage.
+A repository can either be started using an init command or an existing
+repository could be cloned. Let us look at creating our own repository, now. We
+can look at obtaining already existing repositories, at a later stage.
-Let's say we have a folder called book, which has all the chapters of a book as text files. Let us convert that folder, into a hg repository.
+Let's say we have a folder called book, which has all the chapters of a book as
+text files. Let us convert that folder, into a hg repository.
.. L6
@@ -73,7 +83,8 @@ $ ls -a
.. R6
-We have three chapters in the folder. We convert this folder into a mercurial repository using the hg init command
+We have three chapters in the folder. We convert this folder into a mercurial
+repository using the hg init command
.. L7
@@ -83,7 +94,10 @@ $ ls -a
.. R7
-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. The directory, book is called our working directory.
+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. The directory, book is called our working
+directory.
.. L8
@@ -91,7 +105,9 @@ The .hg directory indicates that our book directory is now a hg repository. Merc
.. R8
-We now have a fresh repository, but all our files are not being tracked or watched by mercurial, yet. We need to explicitly ask it to watch the files, that we want it to.
+We now have a fresh repository, but all our files are not being tracked or
+watched by mercurial, yet. We need to explicitly ask it to watch the files,
+that we want it to.
.. L9
@@ -107,7 +123,8 @@ $hg help 'status'
.. R10
-You can use 'hg help commandname' which gives the details about the command. For example.
+You can use 'hg help commandname' which gives the details about the command.
+For example.
.. L11
@@ -119,7 +136,9 @@ $hg help status
.. R11
-Let's now to try to discern what each of the status code 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'.
+Let's now to try to discern what each of the status code 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'.
.. L13
@@ -127,7 +146,9 @@ $hg add
.. R12
-This simply adds all the files in the (working) directory, to the repository. As expected, the status command shows an A before he file names. We could also specify files individually, for example
+This simply adds all the files in the (working) directory, to the repository.
+As expected, the status command shows an A before he file names. We could also
+specify files individually, for example
.. L14
@@ -135,7 +156,9 @@ $ hg add chapter1.txt
.. R13
-If you have deleted files, hg status will show you the status code !. You can, then, tell hg to stop tracking these files, using the hg remove command. Look at hg help remove for more details.
+If you have deleted files, hg status will show you the status code !. You can,
+then, tell hg to stop tracking these files, using the hg remove command. Look
+at hg help remove for more details.
.. L15
@@ -143,7 +166,9 @@ If you have deleted files, hg status will show you the status code !. You can, t
.. R14
-We have added a set of new files to the repository, but we haven't told mercurial to remember these changes, i.e., to take a snapshot at this point in time. We do this by using the commit command.
+We have added a set of new files to the repository, but we haven't told
+mercurial to remember these changes, i.e., to take a snapshot at this point in
+time. We do this by using the commit command.
.. L16
@@ -151,9 +176,14 @@ $ hg commit -u "Primal Pappachan <primal@fossee.in>" -m "Initial Commit."
.. R15
-The -u parameter allows us to specify the user details. It is a general good practice to use full name followed by the email id. The -m parameter allows us to give the commit message --- a message describing the changes that are being committed.
+The -u parameter allows us to specify the user details. It is a general good
+practice to use full name followed by the email id. The -m parameter allows us
+to give the commit message --- a message describing the changes that are being
+committed.
-Mercurial has now taken a snapshot of our repository and has attached our description along with it. To see the status of the files in the repository, use the hg status command.
+Mercurial has now taken a snapshot of our repository and has attached our
+description along with it. To see the status of the files in the repository,
+use the hg status command.
.. L17
@@ -161,7 +191,9 @@ $ hg st
.. R16
-The command does not return anything, when there are no uncommitted changes. Also, notice that I have started getting lazy and used only a short name st for the status command.
+The command does not return anything, when there are no uncommitted changes.
+Also, notice that I have started getting lazy and used only a short name st for
+the status command.
.. L18
@@ -169,7 +201,8 @@ The command does not return anything, when there are no uncommitted changes. Als
.. R17
-To see the history of the changes to our repository, we use hg log. We can view the change that we just made to our repository.
+To see the history of the changes to our repository, we use hg log. We can view
+the change that we just made to our repository.
.. L19
@@ -177,7 +210,10 @@ $ hg log
.. R18
-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. Please have a look of the various aspects of the changeset.
+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. Please have a look of the
+various aspects of the changeset.
.. L20
@@ -185,14 +221,21 @@ hg log gives the log of the changes made in the form of changesets. A changeset
.. R19
-There are two aspects which can be improved upon. Firstly, it is unnecessary to keep typing the user information each and every time we make a commit. Secondly, it is not very convenient to enter a multi-line commit message from the terminal. To solve these problems, we set our user details and editor preferences in the .hgrc file in our home folder. ($HOME/.hgrc on Unix like systems and %USERPROFILE%\.hgrc on Windows systems) This is a global setting for all the projects that we are working on.
+There are two aspects which can be improved upon. Firstly, it is unnecessary to
+keep typing the user information each and every time we make a commit.
+Secondly, it is not very convenient to enter a multi-line commit message from
+the terminal. To solve these problems, we set our user details and editor
+preferences in the .hgrc file in our home folder. ($HOME/.hgrc on Unix like
+systems and %USERPROFILE%\.hgrc on Windows systems) This is a global setting
+for all the projects that we are working on.
-.. R20
-For linux systems, we open the configuration file in our favorite editor and add the username details and our editor preferences... L23
+For linux systems, we open the configuration file in our favorite editor and
+add the username details and our editor preferences.
.. L21
+
vim ~/.hgrc
[ui]
username = Primal Pappachan <primal@fossee.in>
@@ -229,7 +272,8 @@ Some Recommended Practices for commit messages
This brings us to the end of the tutorial. In this tutorial, we have
seen,
1. how to initialize a new repository using hg init,
- #. get the status of a repository using hg status and meaning of it's status codes
+ #. get the status of a repository using hg status and meaning of it's status
+ codes
#. make commits of changes to files, using hg commit
#. view the history of the repository using the hg log command,
#. set our user information in the global hgrc file.
@@ -249,9 +293,12 @@ Here are some self assessment questions for you to solve
user: Primal Pappachan <primal@fossee.in>
date: Sat Jan 26 22:16:53 2012 +0530
summary: Added Readme
- 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?
+ 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?
- #. What happens when 'hg commit' command is run first time without specifying username as parameter or creating the hg configuration file?
+ #. What happens when 'hg commit' command is run first time without specifying
+ username as parameter or creating the hg configuration file?
.. L25
@@ -261,9 +308,19 @@ Here are some self assessment questions for you to solve
And the answers,
- 1. If you have deleted files, hg status will show you the status code !. You can, then, tell hg to stop tracking these files, using the hg remove command.
- #. 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
- #. 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.
+ 1. If you have deleted files, hg status will show you the status code !. You
+ can, then, tell hg to stop tracking these files, using the hg remove command.
+ #. 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
+
+ #. 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.
.. L26
@@ -271,7 +328,10 @@ And the answers,
.. R26
-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 third tutorial on 'Version Control using Hg'
+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 third tutorial on 'Version
+Control using Hg'
Thank you
diff --git a/Version_Control/vcs3/vcs3.rst b/Version_Control/vcs3/vcs3.rst
index 1e10d78..49e2dad 100644
--- a/Version_Control/vcs3/vcs3.rst
+++ b/Version_Control/vcs3/vcs3.rst
@@ -19,7 +19,8 @@ Script
.. L1
-{{{ Show the first slide containing title, name of the production team along with the logo of MHRD}}}
+{{{ Show the first slide containing title, name of the production team along
+with the logo of MHRD}}}
.. R1
@@ -41,8 +42,10 @@ continue on this tutorial
.. R3
At the end of this tutorial you will be able to
+
1. Learn how to view and revert changes made to files in a repository.
- #. Learn how to share repositories and deal with simultaneous conflicting changes.
+ #. Learn how to share repositories and deal with simultaneous conflicting
+ changes.
.. L4
@@ -50,7 +53,8 @@ At the end of this tutorial you will be able to
.. R4
-Let's first try to find out why we should commit inspite of the additional operational costs and loss of time?
+Let's first try to find out why we should commit inspite of the additional
+operational costs and loss of time?
.. L4
@@ -59,8 +63,8 @@ Let's first try to find out why we should commit inspite of the additional opera
.. R4
While you were wondering, let's say your friend walks in and together you make
-a lot of changes. You replace all the occurrences of & in chapter1.txt with and. 2. You delete
-the chapter3.txt file.
+a lot of changes. 1. You replace all the occurrences of & in chapter1.txt with
+and. 2. You delete the chapter3.txt file.
.. L5
@@ -75,9 +79,13 @@ But after a while, you realize that these changes are unwarranted. You want to
go back to the previous state, undoing all the changes that you made, after
your friend arrived.
-The undo in your editor may allow undoing some changes(if you haven't closed it after making the changes) but there's no way of getting back deleted files using your editor. That's where mercurial comes to the rescue.
+The undo in your editor may allow undoing some changes(if you haven't closed it
+after making the changes) but there's no way of getting back deleted files
+using your editor. That's where mercurial comes to the rescue.
-We shall use the revert command of hg to undo all the changes after the last commit. If we want to undo all the changes, we use the revert command with the --all argument, else use revert command with specific filename as argument.
+We shall use the revert command of hg to undo all the changes after the last
+commit. If we want to undo all the changes, we use the revert command with the
+--all argument, else use revert command with specific filename as argument.
.. L5
@@ -91,10 +99,11 @@ chapter1.txt chapter1.txt.orig chapter2.txt chapter3.txt
.. R5
-After running this command, you can see that all deleted files have been restored.
-But hg has generated new files with .orig extension. Mercurial actually doesn't like
-to delete any of the changes that you have made. So, it makes a back-up of the already
-existing files in the present state and gives you back the old file.
+After running this command, you can see that all deleted files have been
+restored. But hg has generated new files with .orig extension. Mercurial
+actually doesn't like to delete any of the changes that you have made. So, it
+makes a back-up of the already existing files in the present state and gives
+you back the old file.
If we now decide, that we want to redo the changes that we had done to the
existing file, we can just overwrite it with the backed up file.
@@ -111,7 +120,10 @@ M chapter1.txt
.. R6
-Let's say we now want to commit these changes, but we are not sure of all the changes that we have made to the file, since it's been a while after we made the changes. We could use the diff command to see all the changes that have been made in the file.
+Let's say we now want to commit these changes, but we are not sure of all the
+changes that we have made to the file, since it's been a while after we made
+the changes. We could use the diff command to see all the changes that have
+been made in the file.
.. L8
@@ -119,7 +131,10 @@ $ hg diff
.. R7
-You see some cryptic output, but it's essentially giving you the list of changes made to the file. All the lines that were deleted are preceded by a - and all the new-lines are preceded by a +. You can see that the & occurrences have been replaces with and.
+You see some cryptic output, but it's essentially giving you the list of
+changes made to the file. All the lines that were deleted are preceded by a -
+and all the new-lines are preceded by a +. You can see that the & occurrences
+have been replaces with and.
We should note here that, the diff wouldn't make much sense, if we had some
binary files like .jpg or .pdf files. We would see some gibberish in the
@@ -177,7 +192,9 @@ the revision number, if required.
.. R12
-The revision number can also be passed as an argument to many commands. Let's say we wish to see the changes between revision 1 and revision 2. We shall use the diff command to do this.
+The revision number can also be passed as an argument to many commands. Let's
+say we wish to see the changes between revision 1 and revision 2. We shall use
+the diff command to do this.
.. L14
@@ -185,11 +202,13 @@ $ hg diff -r1 -r2
.. R13
-The diff command takes two revision numbers as arguments and gives the changes made from revision in the first argument to revision in the second argument.
+The diff command takes two revision numbers as arguments and gives the changes
+made from revision in the first argument to revision in the second argument.
.. R14
-It can be passed to other commands as well. For instance, we can check the logs of the very first commit, by saying
+It can be passed to other commands as well. For instance, we can check the logs
+of the very first commit, by saying
.. L15
@@ -197,7 +216,8 @@ $ hg log -r0
.. R15
-You could also specify a range of commits whose logs you would like to see. Say, we would like to see the last two commits,
+You could also specify a range of commits whose logs you would like to see.
+Say, we would like to see the last two commits,
.. L16
@@ -246,7 +266,7 @@ Here are some self assessment questions for you to solve
.. R20
And the answers,
- 1.hg revert -C --no-backup
+ 1. hg revert -C --no-backup
#. hg log -r 2:4
#. hg log -v -p -r 2
@@ -256,8 +276,9 @@ And the answers,
.. R21
-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 third tutorial on 'Version Control using Hg'
+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 third tutorial on 'Version
+Control using Hg'
Thank you!
diff --git a/Version_Control/vcs4/vcs4.rst b/Version_Control/vcs4/vcs4.rst
index 1883b08..964b410 100644
--- a/Version_Control/vcs4/vcs4.rst
+++ b/Version_Control/vcs4/vcs4.rst
@@ -23,7 +23,7 @@ Script
.. R1
-Hello friends and welcome to the tutorial on 'Version Control with Hg'
+Hello friends and welcome to the fourth part of tutorial on 'Version Control with Hg'
.. L2
@@ -41,8 +41,9 @@ continue on this tutorial
.. R3
At the end of this tutorial you will be able to
- 1. Learn how to view and revert changes made to files in a repository.
- #. Learn how to share repositories and deal with simultaneous conflicting changes.
+ 1. Clone existing repositories
+ #. Share your repositories with peers
+ #. use version control for collaborating with your peers
.. L4
@@ -63,6 +64,9 @@ $ hg clone book book-repo
The syntax of the clone command is -- hg clone SOURCE [DEST], where the optional argument DEST is being represented in brackets. The clone command can be used to replicate already existing repositories, either on your own machine or on some remote machine somewhere on the network. Since, hg maintains a copy of the full repository with every copy of the repository, the two copies that we have are exactly equivalent.
+In this example book-repo shall be our central repository we are sharing with
+peers.
+
.. L16
{{{Show the slide 'Sharing Repositories'}}}
@@ -73,6 +77,7 @@ A mercurial repository can be shared in multiple ways. We shall use the http pro
.. L17
+$cd ../book-repo
$hg serve
.. R17
@@ -85,15 +90,22 @@ Open the url http://localhost:8000 in browser.
.. R18
-To clone the repository, use
+Now if your friend Primal wishes to clone the repository, use
.. L19
-$ hg clone http://my-ip-address:8000
+$ hg clone http://my-ip-address:8000 book-primal
.. R19
-By this process, we share a central repository; work on our local copies. It doesn't make much sense to allow anybody to make changes to a public repository, by default. We will need to make changes to the settings of the repository to allow this. To set the write permissions, add the following lines in .hg/hgrc
+Now if Primal makes some changes to the repository and tries to commit it fails
+obviously as access rights haven't been taken care of.
+
+By this process, we share a central repository; work on our local copies. It
+doesn't make much sense to allow anybody to make changes to a public
+repository, by default. We will need to make changes to the settings of the
+repository to allow this. To set the write permissions, add the following lines
+in .hg/hgrc
.. L20
@@ -103,15 +115,18 @@ allow_push=*
.. R20
-This will allow anybody to push to the repository, now.
+This will allow anybody to push to the repository, now. Primal can now push and
+his changes will appear in the central repository.
.. L21
+
{{{Show the slide 'Sharing Changes'}}}
.. R21
-Use hg push to push your commits (changesets) to the central repository
+Use hg push to push your commits (changesets) to the central repository. The
+changes made by Primal will appear in the central repository.
.. L22
@@ -168,40 +183,40 @@ $ hg update
.. R28
As expected the update command updates the parent to the latest changes that we just pulled from the remote repository.
+ 1. Updates to the tip if no revision is specified
+ #. tip is the most recently added changeset
+ #. Can specify revision number to update to
-1. Updates to the tip if no revision is specified
+For example
-#. tip is the most recently added changeset
+.. L29
-#. Can specify revision number to update to
+$ hg up -r1
.. R29
hg tip shows the tip of the repository
-.. L29
+.. L30
$ hg tip
-.. R30
+.. R31
What happens when two users have made simultaneous changes to the same file, by editing different parts at the same time.
-.. L30
+.. L31
{{{Show the slide 'Simultaneous Changes'}}}
.. R31
With simultaneous changes, following things happen
+ 1. The logs of both repositories will be different
+ #. The repositories have diverged
+ #. hg push fails, in such a scenario
-1. The logs of both repositories will be different
-
-#. The repositories have diverged
-
-#. hg push fails, in such a scenario
-
-.. L31
+.. L32
$ hg push
pushing to http://192.168.1.101:8000
@@ -213,7 +228,7 @@ abort: push creates new remote heads!
Don't take the advice given by mercurial. Using the -f would be disastrous. We will leave out a discussion of that, for this course.
-.. L32
+.. L33
{{{Show the slide 'Merging'}}}
@@ -221,7 +236,7 @@ Don't take the advice given by mercurial. Using the -f would be disastrous. We w
We will now need to pull the new changes that have been pushed to the repository after the last pull and merge them with the changes.
-.. L33
+.. L34
$ hg pull
@@ -231,7 +246,7 @@ $ hg merge
We have now pull the changes from the central repository and merged them with the changes in our repository. But, hg is warning us not to forget to commit.
-.. L34
+.. L35
$ hg commit
@@ -239,7 +254,7 @@ $ hg commit
We can now push this changes to the central repository. We could also check the changes that will be pushed, before pushing them, using the hg outgoing command.
-.. L35
+.. L36
{{{Show the slide 'Outgoing Changes'}}}
@@ -268,20 +283,16 @@ What will happen if we edited the same portion of the file, at the same time? Ho
.. R38
Let's say both of us edit the same part of the same file.
-
-1. hg push fails
-
-#. So we first do hg pull
-
-#. followed by hg merge
+ 1. hg push fails
+ #. So we first do hg pull
+ #. followed by hg merge
.. L39
+$ hg commit
$ hg push
-
$ hg pull
-
$ hg merge
.. R39
@@ -326,9 +337,11 @@ Here's an advice on the Work-flow to be followed.
That brings us to the end of this tutorial on Mercurial. What we have covered is nothing close to all the features of Mercurial. We've only scratched the surface, but let's hope that this will get you started and you will be able to organize your work and projects, better.
+.. L44
+
{{{Show the 'summary' slide'}}}
-.. R18
+.. R45
In this tutorial, we have learnt to,
@@ -337,4 +350,54 @@ In this tutorial, we have learnt to,
#. push changes to a repository using hg push,
#. check the changesets in a repository after last pull, using hg incoming,
#. pull changes from a repository using hg pull ,
+#. update the working directory, using hg update,
+#. merge two heads, using hg merge,
+#. and resolve conflicts using hg resolve.
+
+.. L46
+
+{{{Show the slide 'Evaluation'}}}
+
+.. R46
+
+Here are some self assessment questions for you to solve
+ 1. Mention the easiest way to get started on sharing your repository by providing a web interface
+ #.. Suppose Joey and Melissa have made simultaneous changes to the same file in their own systems. Would the output of hg parents before and after if one of them pulls in the changes and merges with it?
+ #. What are the commands involved in the process of merging changes?
+
+.. L47
+
+{{{ Show Solution of self assessment questions on slide }}}
+
+.. R47
+And the answers,
+ 1. hg serve
+ #. No, whenever we've done a merge, hg parents will display two parents until we hg commit the results of the merge.
+ #. hg pull, hg merge, hg commit -m "Merged Remote changes"
+
+.. L48
+
+{{{Show the slide 'Additional Reading'}}}
+
+.. R48
+
+It is strongly recommended that you to go through the following topics, once you are comfortable with using Mercurial on a day-to-day basis.
+ 1. .hgignore
+ #. hg rollback
+ #. hg bisect
+ #. hg backout
+
+
+.. L49
+
+{{{ Show the Thank you slide }}}
+
+.. R49
+
+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 third tutorial on 'Version Control using Hg'
+
+Thank you!
+
diff --git a/Version_Control/vcs4/vcslide4.tex b/Version_Control/vcs4/vcslide4.tex
index fa0c0e5..52e67f1 100644
--- a/Version_Control/vcs4/vcslide4.tex
+++ b/Version_Control/vcs4/vcslide4.tex
@@ -221,9 +221,12 @@ In this tutorial, we have learnt to,
\begin{frame}[fragile]
\frametitle{Evaluation}
\begin{enumerate}
-\item
-\item
-\item
+\item Mention the easiest way to get started on sharing your repository by
+providing a web interface
+\item Suppose Joey and Melissa have made simultaneous changes to the same file
+in their own systems. Would the output of hg parents before and after if one of
+them pulls in the changes and merges with it?
+\item What are the commands involved in the process of merging changes?
\end{enumerate}
\end{frame}
@@ -231,13 +234,24 @@ In this tutorial, we have learnt to,
\begin{frame}
\frametitle{Solutions}
\begin{enumerate}
-\item
-\item
+\item hg serve
+\item No, whenever we've done a merge, hg parents will display two parents
+until we hg commit the results of the merge.
+\item hg pull, hg merge, hg commit -m "Merged Remote changes"
\end{enumerate}
\end{frame}
-\begin{frame}
+\begin{frame}
+\frametitle{Additional Reading}
+\begin{enumerate}
+\item .hgignore
+\item hg rollback
+\item hg bisect
+\item hg backout
+\end{enumerate}
+\end{frame}
+
\begin{block}{}
\begin{center}
\textcolor{blue}{\Large THANK YOU!}