In any Software project, there are different methodologies and tools used during the project. Coming to methodologies there are Agile and Waterfall. Similarly when it comes to tools there are many tools we use during different stages of project.
In this post I am going to discuss about such a tool which widely used for Source Code Management during a Software Project. In Production environment, for any project there will be different releases.
All these releases will be scheduled with some timelines. To avoid confusion related to source code, we need some tools to manage it. SubVersion (SVN) is tool many of the Software Companies make use for Code management.
Using SVN, we create a directory structure which helps to maintain clarity about the code related to every release. This proper structure make use of following branching strategies:
1. Sequential
Sequential is a strategy, in which we can work on one release after completion of the other. No work related to different releases can be carried out during single timeline.
R2 will be started after completion of R1. Similarly R3 will be started after R2. So there will be no confusion in moving the developers data to production. But in real time this strategy will not be a good one.
2. Parallel
Most of the Clients cannot wait to start working on R2 till the R1 completes. So then comes the Parallel branching strategy. In Parallel, we can work on more than one Release at single point of time.
This helps to overcome the problem of longer duration for every release as we face in Sequential branching. To maintain proper directory structure, after completion of coding for each release we update the production with delta changes.
There is a problem with this strategy. For initial releases the updation of production is something like we merge 90% of new data to 10% of old data. But when it comes to 15th release or more, to update 10% of new data we need to update it by merging with 90% of old data.
3. Merging
To avoid the problem with Parallel branching, the Merging strategy was evolved. I will make use of two locations Core and Prod. Prod is the data what actually our Production server contains and core is data at developer end.
After completion of every release the Core should equals with Prod. When we use this strategy, during the development of R15 data which we need to update to Prod is just R13, R14 and R15 (Since R13,R14 may be in development stage).
What I mean, when R1 is released, core=prod=R1+old
R2 is released, core=R1+old Prod=R2+R1+old to make Core=Prod
we copy R2 to core......
.
.
.
.
.
R8 , core=R1...R6/7+old and Prod=R8 + R1....R6/7 + old
So to make Core=Prod, copy back R8 to Core.
.
.
.
.
.
For R15, we need delta changes from R13, R14 and R15 only....
But in Parallel branching, we need to update Prod with R15,R14,R13 changes by merging with R1....R12 data.
Now lets see some practical part like installing SVN and by working with some commands usually used by developers at Client level....
I am using svn from bitnami which is parented by APACHE.
root@ubuntu-new:~# cd /home/ubu/
root@ubuntu-new:/home/ubu#
root@ubuntu-new:/home/ubu# ls
bitnami-subversion-1.9.5-0-linux-x64-installer.run Music
Desktop Pictures
docker-master.zip Public
Documents Setup-Subversion-1.8.17.msi
Downloads Templates
libapache2-mod-php5_5.3.10-1ubuntu3.25_amd64.deb Videos
root@ubuntu-new:/home/ubu#
Already downloaded and copied my installer file to my Ubuntu server...
root@ubuntu-new:/home/ubu# ./bitnami-subversion-1.9.5-0-linux-x64-installer.run
----------------------------------------------------------------------------
Welcome to the Bitnami Subversion Stack Setup Wizard.
----------------------------------------------------------------------------
Installation folder
Please, choose a folder to install Bitnami Subversion Stack
Select a folder [/opt/subversion-1.9.5-0]:
----------------------------------------------------------------------------
Web Server Port
Choose a port that is not currently in use, such as port 81.
Apache Web Server Port [81]:
----------------------------------------------------------------------------
Repository
Please configure your repository
Path to repository [/opt/subversion-1.9.5-0/repository]:
----------------------------------------------------------------------------
Setup is now ready to begin installing Bitnami Subversion Stack on your
computer.
Do you want to continue? [Y/n]: Y
----------------------------------------------------------------------------
Please wait while Setup installs Bitnami Subversion Stack on your computer.
Installing
0% ______________ 50% ______________ 100%
#########################################
----------------------------------------------------------------------------
Setup has finished installing Bitnami Subversion Stack on your computer.
Launch Bitnami Subversion Stack [Y/n]: Y
root@ubuntu-new:/home/ubu#
To Check the status of our subversion...
root@ubuntu-new:/home/ubu# cd
/opt/subversion-1.9.5-0
root@ubuntu-new:/opt/subversion-1.9.5-0# ls
apache2 config licenses README.txt sqlite uninstall.dat
changelog.txt ctlscript.sh manager-linux-x64.run repository subversion use_subversion
common img properties.ini scripts uninstall
root@ubuntu-new:/opt/subversion-1.9.5-0#
root@ubuntu-new:/opt/subversion-1.9.5-0# ./ctlscript.sh status
subversion already running
apache already running
root@ubuntu-new:/opt/subversion-1.9.5-0#
Through browser we can check.....
Now to work with SVN CLI, lets install the client in our Windows.
We need to checkout the SVN server using the URL in our desired location from our client...
Most important thing is, Workspace is the place where a developer can do all the coding. We can add and then commit the files which are inside our Workspace.
As you see, soon after checkout command, there is a subversion directory within which readme file was created. Our workspace is the subversion directory...
Above I tried executing svn commands outside the workspace, it didn't allow me. But when I tried changing directory to subversion then I am able to execute "svn info".
Let us try creating a file and adding it to our SVN server.
Above I created Welcome file with some text in it....
Soon after creating a file, we can check the "svn status" command....
Command Prompt output of our SVN Client machine....
F:\Workspace_local\subversion>
F:\Workspace_local\subversion>svn status
? Welcome.txt
F:\Workspace_local\subversion>
In the above output, ? represents this file is not yet reflected on our server....
First add it, then we need to commit....
Note: Commit always needs a message, we can give any message so that whenever we check the logs, we can remember what are the changes done with this commit....
F:\Workspace_local\subversion>svn add Welcome.txt
A Welcome.txt
F:\Workspace_local\subversion>svn commit Welcome.txt -m "1st Commit"
Adding Welcome.txt
Transmitting file data .
Committed revision 2.
F:\Workspace_local\subversion>
This time if we check status command, no new changes done at client side. All data is in sync with server...
F:\Workspace_local\subversion>svn status
F:\Workspace_local\subversion>
Screenshots from browser,
Revision number before commit of new file....
Revision number incremented after commit of new file....
We can view the content of the file....
################################################################################
No comments:
Post a Comment