What Is Source Control?


Source control is first and primarily a way to ensure that your source code remains safesafe from loss by reversion, deletion, accidental or malicious loss, or theft. There are also a number of services source control software provides for dealing with the realities of software development, such as labeling, branching, merging, and diffing. For the benefit of those who might be unfamiliar with source control, source control software is composed of a source repository and a set of features for managing the source, as discussed in the following sections.

The Source Repository

This is where the source is stored. In large-scale source control systems, this might be built on top of a sophisticated database server such as SQL Server, or for smaller systems, it could be a simple proprietarily formatted file that contains cumulative file deltas. Besides the actual source files, the source repository stores the differences, histories, comments, and other information necessary for safely managing the code.

Syncing

Syncing is what you do to get the source out of the source repository. You sync whenever you want to retrieve the source repository version of the source files. Generally, the result of a sync is that out-of-date files on your local machine get overwritten by files that have changed in the source repository.

Checking Out/Checking In

When you need to make changes to a source file, you check it out. When you're done, you check it in with the changes. The source control system tracks which files get checked out and tracks a history of the differences between the file when it was checked out and checked in. To see the differences in the earlier and later files, you do a diff.

Diffing

Diffing is when you compare two files to determine the differences between the two. This is often part of the merging process but also can be used for code reviewing changes or when viewing change histories. At its heart, source control is about retaining the difference histories of the files in a project throughout the project lifetime so you can reconstruct the product at any stage within the lifetime.

Labeling

Labeling is a source-control feature for creating named code snapshots. A code snapshot is a way to mark code in a project as of a certain date and time so that you can later retrieve the code in that state. Labeling refers to the feature that lets you give the snapshot a name to make it easier to reference the snapshot. Labeling is often used to mark build numbers so that it is easy to reproduce a build from a given date by "syncing" to the code snapshot.

Branching

Branching is a feature used for making copies of all or parts of the code project. In most cases, the intention is to create a sandbox of code that will later be integrated back into the mainline. Integration is just another word for a checkin, but implies a larger scale. Because integration is a partial or complete remerge of the files from a branch back into the mainline, integrations usually involve a lot of files with a lot of changes and generally also present a few more challenges. When checking in a file or two, if there are any code changes that collide with changes someone else made, you can usually correctly determine which code should be retained. With integrations, especially for large teams, it can be more complex because of all the changes, files, and potential conflicts involved.

Merging

Merging is how the changes are added to the source. The source system must always merge changes into the source when the checked-out code is checked in. Sometimes, merges result in change collisions. If more than one developer checks out a source file and they make changes to code in the same part of the file, there will be a change collision that will require a merge resolution. The source control system provides a way to view the two changes and select which one is correct. Sometimes, this requires that the person doing the merge manually change the code, especially if both changes are valid.



Microsoft SQL Server 2005 Integration Services
Microsoft SQL Server 2005 Integration Services
ISBN: 0672327813
EAN: 2147483647
Year: 2006
Pages: 200
Authors: Kirk Haselden

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net