software configuration management

59
AE6382 Software Configuration Management

Upload: orly

Post on 05-Jan-2016

58 views

Category:

Documents


0 download

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 Presentation

TRANSCRIPT

Page 1: Software Configuration Management

AE6382

Software Configuration Management

Page 2: 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.

Page 3: Software Configuration Management

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.

Page 4: Software Configuration Management

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.

Page 5: Software Configuration Management

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

Page 6: Software Configuration Management

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.

Page 7: Software Configuration Management

AE6382

Subversion

Page 8: Software Configuration Management

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/

Page 9: Software Configuration Management

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.

Page 10: Software Configuration Management

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

Page 11: Software Configuration Management

AE6382

Subversion

Create a Local Repository

Page 12: Software Configuration Management

AE6382

Subversion

Create a pair of directories/folders.

work is the working directory.

repos is the directory where repositories will reside.

Page 13: Software Configuration Management

AE6382

Subversion

Create the specific repository directory.

Use the TortiseSVN Explorer extension, right click the mouse on the repos folder.

Page 14: Software Configuration Management

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

Page 15: Software Configuration Management

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.

Page 16: Software Configuration Management

AE6382

Subversion

Import Project Files to Repository

Page 17: Software Configuration Management

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.

Page 18: Software Configuration Management

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.

Page 19: Software Configuration Management

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);

*/

}

Page 20: Software Configuration Management

AE6382

Subversion

The next step is to import the initial set of files into the repository.

Right-click the mouse on the work directory.

Page 21: Software Configuration Management

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

Page 22: Software Configuration Management

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.

Page 23: Software Configuration Management

AE6382

Subversion

The contents of the work directory can now be discarded.

Page 24: Software Configuration Management

AE6382

Subversion

Check Out the Repository to a Working Directory

Page 25: Software Configuration Management

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.

Page 26: Software Configuration Management

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.

Page 27: Software Configuration Management

AE6382

Subversion

For a server based working directory, the file work usually has the same name as the repository.

Page 28: Software Configuration Management

AE6382

Subversion

This dialog box lists the files that were added to the working directory.

Page 29: Software Configuration Management

AE6382

Subversion

Opening the working directory.

The TortoiseSVN extension results in changes to the file icons.

Page 30: Software Configuration Management

AE6382

Subversion

Additional information about revision controlled files can be displayed by using View/Details and then View/Choose Details…

Page 31: Software Configuration Management

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.

Page 32: Software Configuration Management

AE6382

Subversion

The result of selecting SVN Revision and SVN Status.

Page 33: Software Configuration Management

AE6382

Subversion

Update a Working Directory

Page 34: Software Configuration Management

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.

Page 35: Software Configuration Management

AE6382

Subversion

Set Subversion Properties

Page 36: Software Configuration Management

AE6382

Subversion

To set properties on svn controlled files

Page 37: Software Configuration Management

AE6382

Subversion

To set properties on svn controlled files.

Page 38: Software Configuration Management

AE6382

Subversion

To set properties on svn controlled files.

The drop-down box shows the available properties.

Page 39: Software Configuration Management

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.

Page 40: Software Configuration Management

AE6382

Subversion

For this file svn:keywords has been set to Id and svn:eol-style has been set to native.

Page 41: Software Configuration Management

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.

Page 42: Software Configuration Management

AE6382

Subversion

Add a New File to a Working Directory

Page 43: Software Configuration Management

AE6382

Subversion

To add a new file, readme.txt, to the repository. Create the file in the working directory, then use svn add

Page 44: Software Configuration Management

AE6382

Subversion

The dialog box that lists the files to be added to the repository. And the result of the add operation.

Page 45: Software Configuration Management

AE6382

Subversion

The freshly added file has a “+” icon to indicate its status. Now set the properties of the file then commit it.

Page 46: Software Configuration Management

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.

Page 47: Software Configuration Management

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.

Page 48: Software Configuration Management

AE6382

Subversion

Commit Changes to Repository

Page 49: Software Configuration Management

AE6382

Subversion

Now commit the changed file to the repository.

Page 50: Software Configuration Management

AE6382

Subversion

The dialog that results from the commit operation allows you to enter a log message that describes the changes made.

Page 51: Software Configuration Management

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 $";

Page 52: Software Configuration Management

AE6382

Subversion

Listing the Contents of the Repository

Page 53: Software Configuration Management

AE6382

Subversion

The contents of the repository can be viewed by using the repository browser.

Page 54: Software Configuration Management

AE6382

Subversion

The list of files in the repository.

Page 55: Software Configuration Management

AE6382

Subversion

Show Log for File

Page 56: Software Configuration Management

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.

Page 57: Software Configuration Management

AE6382

Subversion

Revert to a Previous Version

Page 58: Software Configuration Management

AE6382

Subversion

Right click on the file to revert, then select the revision number that you want.

Page 59: Software Configuration Management

AE6382

Subversion

Resolving Conflicts

(todo)