SVN Migration
The Plan
- Repository reorganisation
- We won't use cvs2svn to migrate but simply import the whole source into svn to have a clean start.
- Lazarus gets its own repository.
- The following repositories are planned:
- fpc
- fpcdocs
- lazarus
- contrib
- projects
- html (web page contents)
- logs
- another packages dir: packages/contrib with contains packages which are maintained externally. Something like the Delphi Companion CD. The long term goal is however to flatten the packages hierarchy (packages/base and packages/contrib?), work only with "build units/packages" in each directory. Making e.g. the fcl and fv a usual package as well.
- Stuff in packages/contrib which isn't maintained actively anymore is moved to the contrib repository.
- In the first step only ssh based authentification will be possible.
- After everything is setup and working, a read-only cvs mirror will be installed.
- The SVN project is updated regularily and releases new versions, so it's necessary to have policy when to update the SVN server. The proposed policy is to keep up always with the latest stable svn version.
- Each repository gets it's own unix user group so permissions can be easily managed.
Usage
svn can be used very similiar to cvs. This wiki page gives some example commands to use the new subversion respository. For a complete list of commands use
svn help svn help <command>
or read _the_ svn book can be found here: http://svnbook.red-bean.com/en/1.1/svn-book.html.
A sandbox repository is setup on idefix so you can test svn if you've an idefix account. The URL of this repository is svn+ssh://svn.freepascal.org/FPC/svn/sandbox1
Repository layout
For the repository layout the defacto standard layout with trunk, tags and branches (virtual) directories will be used.
fpc/ trunk/ compiler/ rtl/ ... tags/ release_2_0_0/ compiler/ rtl/ ... branches/ fixes_2_0/ compiler/ rtl/ ... temporarydevelopment/ compiler/ rtl/ ...
fpcdocs/ trunk/ Makefile *.tex ... tags/ release_2_0_0/ branches/
logs/ Changes.fpc Changes.fpcdocs ...
The Read-Only (anonymous) URL prefix is:
http://svn.freepascal.org/svn/
The URL prefix needed to be able to commit changes is:
svn+ssh://username@svn.freepascal.org/FPC/svn/
This URL will be used in all examples below.
On the local machine the repositories can be found with the URL
file:///FPC/svn
To get a list of the directory layout the list command or its abbreviation ls can be used:
svn ls svn+ssh://username@svn.freepascal.org/FPC/svn/fpcdocs/ svn ls svn+ssh://username@svn.freepascal.org/FPC/svn/fpc/trunk/
Tip: Put the URL you need in an environment variable in your shell profile like
export SVNROOT=svn+ssh://username@svn.freepascal.org/FPC/svn export SVNFPC=$SVNROOT/fpc export SVNFPCDOCS=$SVNROOT/fpcdocs
This way you can shorten the lines you need to type
svn ls $SVNFPC svn ls $SVNFPCDOCS
Migration of CVS data
First release_2_0_0 tag will be imported, branched (fixes_2_0) and tagged (release_2_0_0). After that all changes made to CVS HEAD will be commited to the trunk and merged to the fixes_2_0 branch.
The CVS repository for fpc is locked to prevent new commits.
Checkout
To checkout the trunk (main development) of fpc use the following command:
svn co svn+ssh://username@svn.freepascal.org/FPC/svn/fpc/trunk/ fpc
To checkout the latest stable that will make up the next release use the following command:
svn co svn+ssh://username@svn.freepascal.org/FPC/svn/fpc/branches/fixes_2_0/ fpc-2.0
Doing this with the win32 command line client is more tricky: first, get putty and install it and copy the plink.exe to the same directory as the svn client. Then create a new session in Putty, name it e.g. Idefix. Configure this session to auto login on idefix. Futher, create an enviroment variable SVN_SSH with the value plink.exe. Then do
svn co svn+ssh://Idefix:/FPC/svn/fpc/trunk/ fpc
Updating and commiting
Updating and commiting works the same as with CVS with one expection. The exception is for files that had conflicts. Subversion requires you to explicitly mark files (or directories) that had conflicts as resolved.
To update the current directory use the follwing command:
svn up
To only update the compiler directory use the following command:
svn up compiler
To commit your changes
svn ci
To mark a conflict as resolved:
svn resolved <file>
Branching and tagging
For all major development tasks a branch will be created. This is to have the trunk allways be in a buildable state to don't disturb snapshot building. Only in branch it is allowed to not have code that can't be build.
Branching will only be done on a complete repository. Example command to branch:
svn copy svn+ssh://username@svn.freepascal.org/FPC/svn/fpc/trunk/ \ svn+ssh://username@svn.freepascal.org/FPC/svn/fpc/branches/newdevelopment/
Tagging works the same as branching:
svn copy svn+ssh://username@svn.freepascal.org/FPC/svn/fpc/trunk/ \ svn+ssh://username@svn.freepascal.org/FPC/svn/fpc/tags/newrelease/
After a branch or tag created it can be checkout with the following command:
svn checkout svn+ssh://username@svn.freepascal.org/FPC/svn/fpc/branches/newdevelopment/ fpc-newdevelopment
Merging
For the compiler the policy is that all fixes and development will be done in the trunk. Small fixes can be merged to the fixes branch directly. Big fixes and minor development changes are also allowed to be merged if the core developpers agree.
For the RTL, FCL and other packages. All fixes and new development can be merged as long as it also works with the latest released compiler.
Merging will be done using the svnmerge script (http://www.dellroad.org/svnmerge/svnmerge). This shell script keeps track of all revisions that are already merged to the branch. The script needs to be run in the top directory of the working directory of a branch. The script can also produce a commit message with the merged revision numbers included. This message needs to be used when commiting.
To initialize a just created branch for merging from the branch (or trunk) where it was copied from:
svnmerge init -f svn-comment svn ci -F svn-comment
To initialize or reset an already existing branch and specify the revisions that are already included:
svnmerge init -r 1:<Highest_revision_included> -f svn-comment svn ci -F svn-comment
To list the available revisions for merging use. Add -l to see also the log information per revision.
svnmerge avail svnmerge avail -l
To merge one revision in the working copy and commit:
svnmerge merge -r <revision_to_merge> -f svn-comment <review the changes manually> svn ci -F svn-comment
To merge multiple revisions separate them with commas or use ranges:
svnmerge merge -r <low_rev>-<high_rev>,<other_rev> -f svn-comment <review the changes manually> svn ci -F svn-comment
Note: If no revisions are specified all available revisions will be merged!
Tools
Some people prefer gui tools instead of command line clients. RapidSVN is gui that works under windows and linux, it can be found at http://rapidsvn.tigris.org. A good client with explorer integration for win32 is TortoiseSVN (http://tortoisesvn.tigris.org/ ). How to use it with ssh authenfication can be found at http://tortoisesvn.berlios.de/faq/index.php?action=artikel&cat=8&id=30&artlang=en.