SourceCodeControl
From CodeTurtle
Contents |
What is a source code repository?
Source code repositories are used to collect and share code for a project. Developers download the code to their local machines, make any changes or additions necessary, and then upload the changes back to the server. This way, there is an organized way to share changes between multiple developers on a project. To make that easier, source code repositories will also keep track of all of the changes (the "history" of the file) in case you need to see an older version. The client applications that connect to the repository from the developer's machine will typically have pretty powerful merging features, often automatically inserting your changes into the file without interrupting changes another developer may have made at the same time.
As with most things in computing, there are a bunch of different applications out there that do this. Some of the most popular ones include:
- Subversion - Pretty simple to use and has client support on multiple platforms.
- CVS - Still in use but an older repository, Subversion was largely built on top of CVS. But since Subversion was created to get around some of CVS's lack of functionality, it can feel clunky.
- Git - Pretty popular in the Linux community. It's a mental shift from Subversion but once you get used to it, it's pretty powerful.
It might make more sense if you look in terms of a normal workday for a developer.
- When first starting out on a project, the project code is "checked out" of the repository. That creates a local copy of the code that the developer can change without fear of messing up other developers (you have to explicitly upload it back to the repository before anyone else sees the changes). The code is only checked out once; after that the developer will often "update" the code. Updating is when the local code is synchronized with the latest code in the repository. The source code client running on the local machine will attempt to take care of merging any changes from the repository into the local copy of the code.
- The developer makes some changes, such as bug fixes or writing new code. And let's be honest, probably introduces some new bugs as well.
- When the developer is confident the changes won't totally break the code, they are "commited" to the repository. The next time any developer updates their code, the new changes will be merged into their local copy of the code.
How do I set up a source code repository (server)?
You won't need to. The project admin will take care of this. In CodeTurtle's case, SourceForge is used to act as the Subversion repository.
Ok, how do I set up the source code client then?
It depends on the type of repository (Subversion, CVS, etc). There are client applications for all of them that must be installed. Once they are installed, you can access the commands through the command line. For instance, to check out a new copy of the entire CodeTurtle source code tree, the following command would be run:
svn checkout https://codeturtle.svn.sourceforge.net/svnroot/codeturtle codeturtle
That is a call to the Subversion client (svn) with the flags indicating to do a checkout and the location of the repository.
There's a lot more to it than just that, but that's more than I want to get into here. Check out either the manual for the client itself or just google around for tutorials.
Um... is there a way to do this from a GUI?
There are GUI tools, but I'm not familiar with them. Real geeks use a command line.
What I can say is that your IDE will typically provide built in support for common repository types. I often use IntelliJ directly when committing/updating a Subversion repository.

