software configuration management
DESCRIPTION
Software Configuration Management. Software Configuration Management. What is it? Software Configuration Management is the process of tracking changes to software. Why use it? Maintain multiple branches and versions. Recover previous versions. Keep track of changes, ie, committed changes. - PowerPoint PPT PresentationTRANSCRIPT
AE6382
Software Configuration Management
AE6382
Software Configuration Management
What is it?• Software Configuration Management is the process of tracking changes to software.
Why use it?• Maintain multiple branches and versions.• Recover previous versions.• Keep track of changes, ie, committed changes.
When to use it?• For text files: programs, data, and configuration files.• Supports binary files: Word and Excel files, etc.• In multi developer contexts: can assign blame for changes.
AE6382
Software Configuration Management
• Used in both single user and multi user environments.• There are two multi user paradigms
– Locked access – A single developer checks-out a copy of a file before modifying it. The modified file is then checked-in. During check-out only a single developer has access to the file.
– Concurrent access –Multiple developers work with their own copy of a file. Conflicts are resolved as the local copies are committed to the common repository.
AE6382
Software Configuration Management
• There are many implementations of version control software.– RCS (Revision Control System) is one of the earliest. It was developed along
with Unix. It is implemented as check-in/check-out.– CVS (Concurrent Versioning System) is built on top of RCS and implements a
concurrent access scheme. – Subversion is a newer and is designed as a replacement for CVS. It is more
easily deployed as a server. It is rapidly displacing CVS as the version control system of choice.
– Visual Source Safe is part of Microsoft Visual Studio. It is a check-in/check-out system and only runs on Windows.
– There are other open source and commercial implementations available.
AE6382
Subversion
• Runs on Linux, Unix, MacOS, and Windows.• Files, properties, and versioning information is maintained in a
repository.• The developer works with a copy located in a local working directory. • Subversion repositories are local or server-based.• The URL of the repository describes the access method
– file://... – a local file based repository
– svn://… - a repository using the built-in svnserver– svn+ssh://… - an svnserver with ssh used to control access (not a
tunnel)
– http://... – a web based repository, most common in multi user environments
• http://subversion.tigris.org/ home page• http://svnbook.red-bean.com/ Subversion Book
AE6382
Subversion
URL Notes• When using the file:// method, do not use it in multi user mode
while the repository is located on a shared network disk. It is unreliable and will eventually corrupt your repository.
• When using the http:// method, you can view the current head revision files using a normal browser.
AE6382
Subversion
AE6382
Subversion
• Plain SVN is a line mode system.– ex, svn update
• There are several GUI clients– http://subversion.tigris.org/links.html– TortoiseSVN is popular Windows client, explorer extension
• Download TortoiseSVN from– http://tortoisesvn.tigris.org/
AE6382
Subversion
Installation of TortoiseSVN• Download TortoiseSVN from
– http://tortoisesvn.tigris.org/
• Double click file – TortoiseSVN-1.5.3.13783-win32-svn-1.5.2.msi
• Installs as an explorer extension– special file icons for affected files
– added right-click menu items
– Start | Programs |TortoiseSVN
– Includes a differences program
• After installation explorer or computer must be restarted.
AE6382
Subversion
Use Cases• create a repository
• import initial files into new repository
• check out a repository into a working directory
• update a working directory
• change file svn properties
• add a new file to a repository
• commit changes to the repository
• checking status of files in working set
• listing files in repository
• show a files log entries
• revert to a previous version
• resolving conflicts
AE6382
Subversion
Create a Local Repository
AE6382
Subversion
Create a pair of directories/folders.
work is the working directory.
repos is the directory where repositories will reside.
AE6382
Subversion
Create the specific repository directory.
Use the TortiseSVN Explorer extension, right click the mouse on the repos folder.
AE6382
Subversion
A dialog box will appear asking for the type of repository to create. The choice is either a Berkeley Database file or a file-based repository. In most cases the file-based repository is best.
The line-mode equivalent issvnadmin create proj1 –fs-type fsfs
AE6382
Subversion
Now the repos directory is filled with folders and files that are used by Subversion to manage the repository.
The repository is still empty.
AE6382
Subversion
Import Project Files to Repository
AE6382
Subversion
The initial set of files that are to be placed under version control are created in the work directory. In this example a single file, matmult.c, is created.
This is an optional step. It is used only if there is an existing project that is being added to a repository.
See slides on Adding Files to repository.
AE6382
Subversion
The next slide shows the contents of matmult.c.
In particular see line 5. The string $Id: $ identifies the revision number associated with the file. This string is updated to show the version id every time the working file is updated, if the appropriate property is set.
AE6382
Subversion
#include <stdio.h>#include <time.h>#define MAX 500
static char svnid[] = "$Id: $";
void printmat(double *a,int imax, int jmax) {
long int i,j;
printf("enter printmat\n"); for (i=0;i<imax;i++) { for (j=0;j<jmax;j++) { printf("%5.2f ",*(a + (jmax * i) + j)); } printf("\n"); }}
int main(int argc, char **argv) {
long int i,j, k; int iter; double a[MAX][MAX]; double b[MAX][MAX]; double c[MAX][MAX]; clock_t t1,t2;
for(i=0;i<MAX;i++) { a[i][i] = 2.0; b[i][i] = 3.0; }
t1 = clock();
for(iter=0;iter<10;iter++) {
for(i=0;i<MAX;i++) {
for(j=0;j<MAX;j++) {
c[i][j] = 0.0;
for(k=0;k<MAX;k++) {
c[i][j] = c[i][j] + a[i][k] * b[k][j];
}
}
}
}
t2 = clock();
printf("t1=%d, t2=%d\n",t1,t2);
printf("cpu time=%8.3f\n",(float)(t2 - t1)/CLOCKS_PER_SEC);
/*
printmat(c,MAX,MAX);
*/
}
AE6382
Subversion
The next step is to import the initial set of files into the repository.
Right-click the mouse on the work directory.
AE6382
Subversion
This dialog box requests the location of the repository. It is entered as a URL.
In this case the repository is a local directory so use the file:// form.
A web based URL might be http://svn/svn/proj
AE6382
Subversion
This is the result of the import operation. It shows that one file has been added to the repository.
The current revision number is 1.
AE6382
Subversion
The contents of the work directory can now be discarded.
AE6382
Subversion
Check Out the Repository to a Working Directory
AE6382
Subversion
Create a subversion working directory under revision control.
We will reuse the work directory.
To do this delete the contents of the work directory. At least the files that were added to the repository.
Now checkout the contents of the repository to the work directory.
AE6382
Subversion
This dialog box is used to control what is checked out and to where.
The directory work will be created if it does not exist.
AE6382
Subversion
For a server based working directory, the file work usually has the same name as the repository.
AE6382
Subversion
This dialog box lists the files that were added to the working directory.
AE6382
Subversion
Opening the working directory.
The TortoiseSVN extension results in changes to the file icons.
AE6382
Subversion
Additional information about revision controlled files can be displayed by using View/Details and then View/Choose Details…
AE6382
Subversion
The dialog box that results from View/Choose Details…
The SVN parameters, if selected, will be displayed when View/Details is selected as the directory format.
AE6382
Subversion
The result of selecting SVN Revision and SVN Status.
AE6382
Subversion
Update a Working Directory
AE6382
Subversion
Right click on directory or file and select SVN Update.
This will load the current version from the repository to the working directory.
When using a multi user repository it is a good idea to execute an update before working on the file.
AE6382
Subversion
Set Subversion Properties
AE6382
Subversion
To set properties on svn controlled files
AE6382
Subversion
To set properties on svn controlled files.
AE6382
Subversion
To set properties on svn controlled files.
The drop-down box shows the available properties.
AE6382
Subversion
svn:eol-style
Subversion will set the end-of-line in a text file appropriate to the destination working directory.
svn:keywords
Informs Subversion to handle the keywords, eg, $Id: $, which will be updated when downloaded to the working directory.
svn:executable
Informs Subversion that the file is an executable file. It will set permissions on the working copy to allow execution.
AE6382
Subversion
For this file svn:keywords has been set to Id and svn:eol-style has been set to native.
AE6382
Subversion
Going back an looking at the work directory notice that the icon for the file matmult.c has changed. In this case it indicates that the svn properties for the file have changed.
AE6382
Subversion
Add a New File to a Working Directory
AE6382
Subversion
To add a new file, readme.txt, to the repository. Create the file in the working directory, then use svn add
AE6382
Subversion
The dialog box that lists the files to be added to the repository. And the result of the add operation.
AE6382
Subversion
The freshly added file has a “+” icon to indicate its status. Now set the properties of the file then commit it.
AE6382
Subversion
The status of the working directory after the commit operation. Note that readme.txt is level 3 and matmult.c is level 2.
AE6382
Subversion
Adding is the “better” way to put files into a repository.• Create the file in the working directory.• Add the file to the repository.• Set the appropriate properties.• Commit the file to the repository.
AE6382
Subversion
Commit Changes to Repository
AE6382
Subversion
Now commit the changed file to the repository.
AE6382
Subversion
The dialog that results from the commit operation allows you to enter a log message that describes the changes made.
AE6382
Subversion
The final dialog box verifying the update of the repository. The revision number is now 2. The icon for matmult.c reverts to the green check. Looking at the file matmult.c shows the following:
static char svnid[] = "$Id: matmult.c 2 2006-11-08 15:33:16Z latham $";
AE6382
Subversion
Listing the Contents of the Repository
AE6382
Subversion
The contents of the repository can be viewed by using the repository browser.
AE6382
Subversion
The list of files in the repository.
AE6382
Subversion
Show Log for File
AE6382
Subversion
To show a files log entries, right click the file and select TortoiseSVN | Show Log.
The window at the right shows every revision made that included a comment.
Use TortoiseSVN | Revision Graph for a complete list of all revisions.
AE6382
Subversion
Revert to a Previous Version
AE6382
Subversion
Right click on the file to revert, then select the revision number that you want.
AE6382
Subversion
Resolving Conflicts
(todo)