Differences between revisions 11 and 12
Revision 11 as of 2009-06-09 06:48:33
Size: 6832
Editor: ?JuanRicart
Comment: fixed syntax errors
Revision 12 as of 2010-08-31 19:41:51
Size: 6717
Comment: Correct external links
Deletions are marked like this. Additions are marked like this.
Line 12: Line 12:
Note: more information about [[http://svnbook.red-bean.com/nightly/en/svn.intro.features.html|the features]] can be found in the [[http://svnbook.red-bean.com/nightly/en/index.html|SVN Book]]. Note: more information about [[http://svnbook.red-bean.com/en/1.2/svn.intro.features.html|the features]] can be found in the [[http://svnbook.red-bean.com/en/1.2/index.html|SVN Book]].
Line 14: Line 14:
''Note: If you are looking for an administration tutorial, look at [[SmallSVNAdministrationTutorial]]. of the [[http://svnbook.red-bean.com/nightly/en/index.html|Subversion book]]'' ''Note: If you are looking for an administration tutorial, look at [[SmallSVNAdministrationTutorial]]. of the [[http://svnbook.red-bean.com/en/1.2/index.html|Subversion book]]''
Line 20: Line 20:
Each project must start its life in SVN by an import command. It is recommended that each project should have a structure that would allow branching and tagging in a convenient manner; see the chapter [[http://svnbook.red-bean.com/nightly/en/svn.reposadmin.projects.html#svn.reposadmin.projects.chooselayout|choosing repository layout]] more info. Each project must start its life in SVN by an import command. It is recommended that each project should have a structure that would allow branching and tagging in a convenient manner; see the chapter [[http://svnbook.red-bean.com/en/1.2/svn.reposadmin.projects.html|choosing repository layout]] more info.
Line 33: Line 33:
  * [[http://svnbook.red-bean.com/nightly/en/svn.ref.svn.c.import.html|svn import]]
  * [[http://svnbook.red-bean.com/nightly/en/svn.reposadmin.projects.html#svn.reposadmin.projects.chooselayout|Choosing repository layout]]
  * [[http://svnbook.red-bean.com/en/1.2/svn.ref.svn.c.import.html|svn import]]
  * [[http://svnbook.red-bean.com/en/1.2/svn.reposadmin.projects.html#svn.reposadmin.projects.chooselayout|Choosing repository layout]]
Line 54: Line 54:
  * [[http://svnbook.red-bean.com/nightly/en/svn.ref.svn.c.checkout.html|svn checkout]]
  * [[http://svnbook.red-bean.com/nightly/en/svn.tour.initial.html|initial checkout]]
  * [[http://svnbook.red-bean.com/en/1.2/svn.ref.svn.c.checkout.html|svn checkout]]
  * [[http://svnbook.red-bean.com/en/1.2/svn.tour.initial.html|initial checkout]]
Line 69: Line 69:
  * [[http://svnbook.red-bean.com/nightly/en/svn.ref.svn.c.status.html|svn status]]
  * [[http://svnbook.red-bean.com/nightly/en/svn.tour.cycle.html#svn.tour.cycle.examine.status|the meaning of the letters on the first column]]
  * [[http://svnbook.red-bean.com/en/1.2/svn.ref.svn.c.status.html|svn status]]
  * [[http://svnbook.red-bean.com/en/1.2/svn.tour.cycle.html#svn.tour.cycle.examine.status|the meaning of the letters on the first column]]
Line 84: Line 84:
  * [[http://svnbook.red-bean.com/nightly/en/svn.ref.svn.c.diff.html|svn diff]]
  * [[http://svnbook.red-bean.com/nightly/en/svn.tour.cycle.html#svn.tour.cycle.examine.diff|svn diff at work]]
  * [[http://svnbook.red-bean.com/en/1.2svn.ref.svn.c.diff.html|svn diff]]
  * [[http://svnbook.red-bean.com/en/1.2/svn.tour.cycle.html#svn.tour.cycle.examine.diff|svn diff at work]]
Line 107: Line 107:
  * [[http://svnbook.red-bean.com/nightly/en/svn.ref.svn.c.commit.html|svn commit]]
  * [[http://svnbook.red-bean.com/nightly/en/svn.tour.cycle.html#svn.tour.cycle.commit|commit your changes]]
  * [[http://svnbook.red-bean.com/en/1.2svn.ref.svn.c.commit.html|svn commit]]
  * [[http://svnbook.red-bean.com/en/1.2/svn.tour.cycle.html#svn.tour.cycle.commit|commit your changes]]
Line 136: Line 136:
  * [[http://svnbook.red-bean.com/nightly/en/svn.ref.svn.c.copy.html|svn copy]]
  * [[http://svnbook.red-bean.com/nightly/en/svn.branchmerge.using.html|branching and merging]]
  * [[http://svnbook.red-bean.com/en/1.2/svn.ref.svn.c.copy.html|svn copy]]
  * [[http://svnbook.red-bean.com/en/1.2/svn.branchmerge.using.html|branching and merging]]
Line 142: Line 142:
The SVN book [[http://svnbook.red-bean.com/nightly/en/svn.tour.cycle.html|describes]] very well the basic working cycle; more informations are available [[http://svnbook.red-bean.com/nightly/en/svn.tour.cycle.html|there]]. The SVN book [[http://svnbook.red-bean.com/en/1.2/svn.tour.cycle.html|describes]] very well the basic working cycle; more informations are available [[http://svnbook.red-bean.com/en/1.2/svn.tour.cycle.html|there]].
Line 146: Line 146:
 * [[http://svnbook.red-bean.com/nightly/en/svn.serverconfig.svnserve.html#svn.serverconfig.svnserve.sshauth|enabling ssh key access]] and using an ssh agent will spare you from entering a password at each operation that involves the repository; also the user name can be set in settings in ~/.ssh/config, so when issuing commands that require server authentication, it will not be mandatory to insert all needed data (ssh remote port number, username, etc.), because this data is already in ~/.ssh/config  * [[http://svnbook.red-bean.com/en/1.2/svn.serverconfig.svnserve.html#svn.serverconfig.svnserve.sshauth|enabling ssh key access]] and using an ssh agent will spare you from entering a password at each operation that involves the repository; also the user name can be set in settings in ~/.ssh/config, so when issuing commands that require server authentication, it will not be mandatory to insert all needed data (ssh remote port number, username, etc.), because this data is already in ~/.ssh/config

Introduction

Subversion aka SVN (Debian package) is a version control system that is a compelling replacement for CVS in the open source community.

It has many features and improvements with respect to CVS, but most important ones are:

  • rename support
  • truly atomic commits
  • directory and file meta-data are versioned
  • efficient handling of binary files
  • internal commands resemble a lot with CVS' commands

Note: more information about the features can be found in the SVN Book.

Note: If you are looking for an administration tutorial, look at ?SmallSVNAdministrationTutorial. of the Subversion book

Basic commands and usage

Projects must start: svn import

Each project must start its life in SVN by an import command. It is recommended that each project should have a structure that would allow branching and tagging in a convenient manner; see the chapter choosing repository layout more info.

svn import -m "New import" localprojdir svn+ssh://svn.debian.org/svn/aliothproj/path/in/project/repository

After the initial import, the source just used for the import should be removed and a checked out version should be used for further modifications.

Summary:

Getting a working copy: svn checkout

Once the project is in subversion, a developer can get a copy of it by using the checkout command. This is necessary so subversion can track your local changes. Usually one would want to get the most recent version from trunk, but in some cases one would want to check out a branch. Checking out a branch is no different from checking out from trunk, one will use the svn checkout command.

svn checkout svn+ssh://developer@svn.debian.org/svn/aliothproj/trunk

Now you can make your modifications to the checked out directory.

Note: Checking out a single file is not possible, only directories can be checked out.

Summary:

Checking status: svn status

You made modification, but you want to see a summary of the local copy's status.

svn status

Summary:

Checking modifications: svn diff

You have found out that a file has some modifications since it was synced with the repository. Seeing the contents of the change can be done with svn diff.

svn diff

Saving your changes: svn commit

You have seen what changed and you decide is time to make your changes public to do that, use svn commit

svn commit -m "made foo changes to current directory"

If no parameter is specified, the current directory's (and subdirectories') changes are committed in subversion. The commit can be done also on a "per file" basis by specifying the names of the files/subdirectories to have their changes committed.

svn commit -m "made foo changes to some_modified_file" some_modified_file

Summary:

Branching and tagging: svn copy

From time to time it is necessary to isolate a certain snapshots (usually from trunk) of the project. This might be the case if in a project a release is wanted or a certain feature is to be developed in a branch.

Subversion does not distinguish between copying, tagging and branching and all of them can be accomplished through the usage of the copy command.

svn copy -m "Tag release 0.4" svn+ssh://svn.debian.org/svn/aliothproj/trunk svn+ssh://svn.debian.org/svn/aliothproj/tags/0.4

or, in order to be sure that the correct version is tagged:

svn copy -r123 -m "Tag release 0.4" svn+ssh://svn.debian.org/svn/aliothproj/trunk svn+ssh://svn.debian.org/svn/aliothproj/tags/0.4

Note: replace the -r argument (123) with the trunk revision number which needs to be tagged.

Summary:

Basic work cycle

The SVN book describes very well the basic working cycle; more informations are available there.

Tips and tricks

  • enabling ssh key access and using an ssh agent will spare you from entering a password at each operation that involves the repository; also the user name can be set in settings in ~/.ssh/config, so when issuing commands that require server authentication, it will not be mandatory to insert all needed data (ssh remote port number, username, etc.), because this data is already in ~/.ssh/config

  • always tag your releases
  • merging regularly the changes from trunk when working in a branch is a huge help at the time when the branch work will be integrated in trunk
  • DO NOT fiddle with or remove the contents of the .svn directories!