    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
     <channel>
        <title>ACCU  :: Using Version Control</title>
        <link>https://members.accu.org/index.php/journals/439</link>
        <description>Professionalism in Programming</description>
        <dc:language>en-us</dc:language> 
        <dc:creator>Administrator</dc:creator> 
        <admin:generatorAgent rdf:resource="http://www.xaraya.org" /> 
        <admin:errorReportsTo rdf:resource="mailto:webeditor@accu.org" />
       <sy:updatePeriod>hourly</sy:updatePeriod>
       <sy:updateFrequency>1</sy:updateFrequency>
       <docs>http://backend.userland.com/rss</docs>


        <h2>Journal Articles</h2>


<div class="xar-mod-head"><span class="xar-mod-title">Overload Journal #44 - Aug 2001 + Programming Topics</span></div>

<table border="0" cellpadding="1" cellspacing="0">
    <tbody>
    <tr>
        <td valign="top">
            Browse in :
       </td>
       <td valign="top">

                                            <a href="https://members.accu.org/index.php/journals/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c76/">Journals</a>

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c78/">Overload</a>

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c160/">44</a>
                    (7)
<br />

                                            <a href="https://members.accu.org/index.php/journals/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c13/">Topics</a>

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c65/">Programming</a>
                    (877)
<br />

                                            <a href="https://members.accu.org/index.php/journals/c160-65/">Any of these categories</a>

                    -                        <a href="https://members.accu.org/index.php/journals/c160+65/">All of these categories</a>
<br />
</td>
   </tr>
   </tbody>
</table>




<div class="xar-error">
   <p>
 <strong>Note:</strong> when you create a new publication type,
the articles module will automatically use the templates
<em>user-display-[publicationtype].xt</em>
and <em>user-summary-[publicationtype].xt</em>.
If those templates do not exist when you try to preview or display a new article,
you'll get this warning :-)  Please place your own templates in themes/<em>yourtheme</em>/modules/articles . The templates will get the extension .xt there. </p>
</div>
<div class="xar-norm xar-standard-box-padding">
   <h1><strong>Title:</strong>&nbsp;Using Version Control</h1>
<p><strong>Author:</strong>&nbsp;</p>
<p>
<strong>Date:</strong> 26 August 2001 17:46:07 +01:00 or Sun, 26 August 2001 17:46:07 +01:00</p>
<p><strong>Summary:</strong>&nbsp;</p>
<p><strong>Body:</strong>&nbsp;<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e18" id="d0e18"></a></h2>
</div>
<p>I'd like to thank the participants on the <tt class=
"literal">accu-general</tt> mailing list for the discussion that
led to this paper being written, and especially Tom Hughes and Jim
Hyslop for their review comments on the initial draft.</p>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e25" id="d0e25"></a>Scope</h2>
</div>
<p>This documents provides a general overview of the use of source
code version control within a software development project. It
outlines the facilities required to support the development process
and introduces the specific features of CVS that provide this
support together with the working practices that leverage this
support to best effect.</p>
<p>This is not a reference manual for CVS - that is at <a href=
"http://cvshome.org/docs/manual/cvs.html" target=
"_top">http://cvshome.org/docs/manual/cvs.html</a>, nor is it an
adequate guide to implementing CVS on a project that is at <a href=
"http://cvsbook.red-bean.com/" target=
"_top">http://cvsbook.red-bean.com/</a>. It does, however, cover
the concepts and operations most needed by a user or in
short-listing version control systems prior to a detailed
evaluation.</p>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e38" id="d0e38"></a>Aims and
strategy</h2>
</div>
<div class="sect2" lang="en">
<div class="titlepage">
<h3><a name="d0e41" id="d0e41"></a>What is version
control?</h3>
</div>
<p>Fundamentally version control is about being able to manage
versions of the source code. This management includes the ability
to reproduce identified versions of the source code, to query
differences between versions and to allow the changes made between
two versions to be applied to a third.</p>
<p>There are significant differences between version control
systems in the way they implement these facilities - at their most
primitive they do no more than record a sequence of changes to
individual files, at their most sophisticated they also manage the
addition and removal of source file, allow concurrent changes,
automate the software build process, ensure regression tests
succeed, enforce sign-off processes and create and distribute the
resulting software.</p>
<p>While much of the following discussion is generic in nature it
uses CVS as a specific example of a source code version control
system. CVS is a free [<a href="#GPL">GPL</a>] version control
system that falls between the primitive and sophisticated extremes
identified above: as with much 'free' software it provides a basic
set of version control features important to developers and does it
well. It does not provide the additional process management
features available in some commercial products (but there are
separate tools for some of these tasks that integrate with
CVS).</p>
</div>
<div class="sect2" lang="en">
<div class="titlepage">
<h3><a name="d0e53" id="d0e53"></a>What do we want
from version control?</h3>
</div>
<p>As an individual developer I want a version control system to
manage the changes that I make without putting obstructions in the
way of my making them. Ideally I just want to make changes to my
working copy of the system and for any interaction of these with
the shared development and/or release versions of the system to be
resolved automatically. Within my working copy I'd like to be able
to use the version control system to answer queries such as &quot;what
did I change this morning?&quot; and to allow facilitate operations like
&quot;undo all my changes to this file&quot; or &quot;undo the changes I made last
Friday afternoon (without losing any prior or subsequent
changes)&quot;.</p>
<p>Some version control systems only allow a single developer to a
file at a time. In practice, when version control prevents a
developer from making a necessary change they bypass the version
control system in order to get work done. (By changing local copies
of files followed later by manual integration of their changes.)
This loses potential benefits of version control, can be error
prone, and risks scenarios where neither of two developers can
check in their changes without first updating a file &quot;owned&quot; by the
other.</p>
<p>Whether working as an individual developer, in quality
assurance, or as a release manager I want to be in control of when
the changes other people make impact my working copy. Ideally the
version control system will allow me to choose when to update my
working copy, to select specific updates and to ensure that the all
the changes relating to the update are applied.</p>
<p>A problem that occurs with some version control systems is that
they may require me to &quot;check out&quot; a specific version of a file -
e.g. to add a method I may need to get the latest version, and this
version may not be consistent with other files within my working
copy.</p>
<p>Reworking these requirements as a checklist:</p>
<div class="orderedlist">
<ol type="1">
<li>
<p>Track changes made by each developer (sometimes a small group of
developers) in their own working copy.</p>
</li>
<li>
<p>Allow each developer to undo and/or redo selected changes within
their working copy.</p>
</li>
<li>
<p>Allow developers to exchange and share selected changes between
their working copies.</p>
</li>
<li>
<p>Allow each developers to change the version of files they are
using (and integrate these with any other changes to the file).</p>
</li>
<li>
<p>Report the differences between different times, development
versions and releases.</p>
</li>
<li>
<p>Allow QA and/or the release manager to incorporate into release
versions specific work supplied by developers.</p>
</li>
<li>
<p>Reproduce the state of the release version and/or a developer's
area at specific milestones and/or times.</p>
</li>
<li>
<p>Support multiple concurrent release versions.</p>
</li>
</ol>
</div>
</div>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e91" id=
"d0e91"></a>TANSTAAFL[<a href="#Heinlein">Heinlein</a>]</h2>
</div>
<p>I've never encountered a tool that provides the ideals outlined
in the previous section without any effort on the part of the
users. In particular the version control system usually needs to be
informed of some types of changes, and to be asked explicitly to
record or apply others. In addition, steps need to be taken to
group changes that correspond to a logical update (e.g. a bug fix
or new feature).</p>
<p>In particular, although many version control systems allow
multiple developers to update a project or file, automatic merging
of changes cannot always be relied on. For example it is possible
for one developer to remove an unused item (file, variable or
method), whilst another adds code that makes use of it. In
practice, such problems can be detected automatically, either when
doing the merge, by rebuilding the resulting software, or by
running a smoke test [<a href="#SmokeTest">SmokeTest</a>]. Once
such a conflict has been detected manual intervention is invariably
required to resolve it.</p>
<p>The following section identifies ways of working with CVS that
allow the ideals to be approached.</p>
<div class="sect2" lang="en">
<div class="titlepage">
<h3><a name="d0e106" id="d0e106"></a>Working with
CVS</h3>
</div>
<p>The key idea to understand when working with CVS is that the
version in the repository is the important one. The user issues to
update the working copy or to apply changes from the working copy
to the repository. This implies that in order to track changes by
individual developers separately (as described above) it is
necessary for each developer to maintain a separate version of a
project within CVS. The mechanism that CVS provides for this is
&quot;branching&quot; - each branch is an independent version of the
project.</p>
<p>Working on a branch you allows CVS to track your changes for you
whilst being isolated from any other work being done at the same
time. It also means your changes don't affect anyone else and you
are not affected by them (unless or until you intentionally merge
the changes).</p>
<div class="figure"><a name="d0e113" id="d0e113"></a>
<p class="title c2">Figure 1. Basic Branching</p>
<div class="mediaobject"><img src="/var/uploads/journals/resources/CVS-branching.png"
alt="Basic Branching"></div>
</div>
<p>Unless the version within the repository is updated to match the
working copy on a regular basis developers won't be able to use the
CVS facilities to manage changes, so it is a good habit to check in
changes on a regular basis - after each cycle of update, compile
and test is about right (i.e. several times a day). Remember, these
check-ins only affect the current branch.</p>
<p>The CVS branching mechanism also provides a convenient way to
group changes relating to a logical update - by creating a branch
for each such update allows the changes to be identified as those
that occur on that branch. On completion of a logical update
several things need to happen: the change must be made available
for QA, the change must be integrated into the principle
development version, and into any appropriate release version -
this is discussed further below.</p>
<p>The QA and release functions have similar needs to control
change (but in these cases source updates should always be applied
by the version control system - not by changing the source code).
For this reason they too should work on branches - although in this
case the branch will, potentially, be 'handed on' from QA to
release.</p>
</div>
<div class="sect2" lang="en">
<div class="titlepage">
<h3><a name="d0e125" id="d0e125"></a>An example
project</h3>
</div>
<p>The project we are going to consider is the development and
maintenance of an application that is maintained over a series of
releases - the series of releases open ended. (I've used CVS with
up to a dozen developers on projects up to a million lines of code,
I've heard reports of much larger projects.)</p>
<p>In this project the main branch (known as the trunk) is the
development integration branch. Most other branches are split off
this and have a limited lifetime. In particular, all development of
new features is done on branches that are then merged back into the
trunk.</p>
<p>At a given moment there are potentially two other main branches
- a &quot;Release&quot; branch undergoing &quot;QA&quot; and a &quot;Release&quot; branch
corresponding to released software. The release process is as
follows:</p>
<p>Ensure that all bugfixes (e.g. to QA and release branches) have
been merged back into the trunk.</p>
<p>Build the trunk and run regression tests.</p>
<p>Create a new Release by branching from the trunk. (Development
continues on the trunk.)</p>
<p>Run the full test suite against the new branch. (If problems are
found they may be corrected on this branch - or on branches that
are merged back into it.)</p>
<p>Once QA &quot;passes&quot; the new release, any bugfixes that were made to
achieve this pass are scheduled to be merged back into the
trunk.</p>
<p>(Eventually) retire the old Release branch. (If problems are
found in the field they may be corrected on this branch - and
scheduled for merging back into the trunk.)</p>
<div class="figure"><a name="d0e146" id="d0e146"></a>
<p class="title c2">Figure 2. Branches during the project
lifecycle</p>
<div class="mediaobject"><img src="/var/uploads/journals/resources/CVS-branches.png" alt=
"Branches during the project lifecycle"></div>
</div>
</div>
</div>
<div class="bibliography">
<div class="titlepage">
<h2><a name="d0e152" id="d0e152"></a>References</h2>
</div>
<div class="bibliomixed"><a name="GPL" id="GPL"></a>
<p class="bibliomixed">[GPL]
http://www.fsf.org/copyleft/gpl.html</p>
</div>
<div class="bibliomixed"><a name="Heinlein" id="Heinlein"></a>
<p class="bibliomixed">[Heinlein] &quot;There Ain't No Such Thing As A
Free Lunch&quot;, <span class="citetitle"><i class="citetitle">The Moon
is a Harsh Mistress</i></span>, Robert Heinlein</p>
</div>
<div class="bibliomixed"><a name="SmokeTest" id="SmokeTest"></a>
<p class="bibliomixed">[SmokeTest]
http://c2.com/cgi/wiki?SmokeTest</p>
</div>
</div>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
