Wiki copymirror

This is a mirror of the wiki at pascal.chat. Editing, history and sign-in are there.

SVN Migration

The Plan

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

text
 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.

text
fpc/
  trunk/
    compiler/
    rtl/
    ...
  tags/
    release_2_0_0/
      compiler/
      rtl/
      ...
  branches/
    fixes_2_0/
      compiler/
      rtl/
      ...
    temporarydevelopment/
      compiler/
      rtl/
      ...
text
fpcdocs/
  trunk/
    Makefile
    *.tex
    ...
  tags/
    release_2_0_0/
  branches/
text
fpcbuild/
  trunk/
    Makefile
    demo
    ...
  tags/
    release_2_0_0/
  branches/
text
logs/
  Changes.fpc
  Changes.fpcdocs
  ...

The Read-Only (anonymous) URL prefix is:

text
http://svn.freepascal.org/svn/

The actual urls are

text
http://svn.freepascal.org/svn/fpc/
http://svn.freepascal.org/svn/lazarus/

The URL prefix needed to be able to commit changes is:

text
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

text
file:///FPC/svn

If you want to switch the URL prefix, for example change the logs repository svn+ssh to http, you can do this on windows with:

text
cd logs
svn switch --relocate svn+ssh://svn.freepascal.org:/FPC/svn/logs http://svn.freepascal.org/svn/logs .

where svn.freepascal.org is in this case the name of the session of the svn server in Putty.

On unix do:

text
cd logs
svn switch --relocate svn+ssh://svn.freepascal.org/FPC/svn/logs http://svn.freepascal.org/svn/logs .

Note: Don't make a mistake when typing the second url else you've to re-checkout.

To get a list of the directory layout the list command or its abbreviation ls can be used:

text
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

text
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

text
 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:

text
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:

text
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

text
 svn co svn+ssh://Idefix:/FPC/svn/fpc/trunk/ fpc

Example read-only checkout commands:

text
2.1.x: svn co http://svn.freepascal.org/svn/fpc/trunk/
2.0.x: svn co http://svn.freepascal.org/svn/fpc/branches/fixes_2_0/
2.0.0: svn co http://svn.freepascal.org/svn/fpc/tags/release_2_0_0/

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:

text
svn up

To only update the compiler directory use the following command:

text
svn up compiler

To commit your changes

text
 svn ci

To mark a conflict as resolved:

text
 svn resolved <file>

For committing with proper mime settings, you should enable auto-prop'ing in your svn client configuration (unix: ~/.subversion/config; Windows: %AppData%/subversion/config). Make the following settings:

pascal
[miscellany]
enable-auto-props = yes
[auto-props]
*.sh = svn:eol-style=native;svn:executable
*.pp = svn:eol-style=native;svn:mime-type=text/pascal
*.pas = svn:eol-style=native;svn:mime-type=text/pascal
*.fpc = svn:eol-style=native;svn:mime-type=text/plain
*.inc = svn:eol-style=native;svn:mime-type=text/plain
*.ini = svn:eol-style=native;svn:mime-type=text/plain
*.xml = svn:eol-style=native;svn:mime-type=text/plain
*.tex = svn:eol-style=native;svn:mime-type=text/plain
*.log = svn:eol-style=native;svn:mime-type=text/plain
*.htm = svn:eol-style=native;svn:mime-type=text/plain
*.html = svn:eol-style=native;svn:mime-type=text/plain
*.fig = svn:eol-style=native;svn:mime-type=text/plain
*.php = svn:eol-style=native;svn:mime-type=text/plain
*.php3 = svn:eol-style=native;svn:mime-type=text/plain
*.tmpl = svn:eol-style=native;svn:mime-type=text/plain
*.fpc = svn:eol-style=native;svn:mime-type=text/plain
*.fp = svn:eol-style=native;svn:mime-type=text/plain
*.sql = svn:eol-style=native;svn:mime-type=text/plain
*.txt = svn:eol-style=native;svn:mime-type=text/plain
*.png = svn:mime-type=image/png
*.jpg = svn:mime-type=image/jpeg
*.gif = svn:mime-type=image/gif
*.ico = svn:mime-type=image/ico
*.o = svn:mime-type=application/octet-stream
Makefile = svn:eol-style=native;svn:mime-type=text/plain
*.lfm = svn:eol-style=native;svn:mime-type=text/plain
*.lrs = svn:eol-style=native;svn:mime-type=text/pascal
*.lpk = svn:eol-style=native;svn:mime-type=text/plain
*.lpi = svn:eol-style=native;svn:mime-type=text/plain
*.lpl = svn:eol-style=native;svn:mime-type=text/plain
*.lpr = svn:eol-style=native;svn:mime-type=text/pascal
*.cfg = svn:eol-style=native;svn:mime-type=text/plain
*.rc = svn:eol-style=native;svn:mime-type=text/plain
*.manifest = svn:eol-style=native;svn:mime-type=text/plain

The following Delphi specific types are useful when porting delphi code:

pascal
 *.bdsproj = svn:eol-style=native;svn:mime-type=text/plain
 *.dof = svn:eol-style=native;svn:mime-type=text/plain
 *.dpr = svn:eol-style=native;svn:mime-type=text/pascal
 *.dfm = svn:eol-style=native;svn:mime-type=text/plain
 *.dpk = svn:eol-style=native;svn:mime-type=text/plain
 *.bpg = svn:eol-style=native;svn:mime-type=text/plain

For adding new directories it is sometimes needed to add ignores for generated files or directories. The following textfile and script can be used to add the svn:ignore property recursivly

text
> cat ignore.txt 
*.bak
*.exe
*.ppu
*.o
*.s
fpcmade.*
units
pascal
> cat updignore.sh
#!/bin/sh
for f in `find . -type d | grep -v svn`; do
  svn ps svn:ignore -F ignore.txt $f
done

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 have code that can't be build.

Branching will only be done on a complete repository. Example command to branch:

text
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:

text
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:

text
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 automatically created files

When merging commits containing automatically created files like Makefiles or the msg*.inc files of the compiler, you usually get conflicts when merging them. To solve this you've to revert the merges of the automatically created files, recreate them and then commit everything.

For a merge containing a change to Makefile.fpc the steps would be:

Merge with plain svn

svn [help] merge

svn [help] mergeinfo

When committing the merge, in case of doing a selective commit (merged files only) include directories (including top-level). They contain svn-properties about the merge status

The root dir has a property

svn:mergeinfo

containing what was already merged. It will be modified and must be committed

Using mergeinfo (which revisions have or have not been merged)

Raw list of all merged rev:

text
svn mergeinfo  trunk_dir  fixes_0_9_30_dir

Raw list of all not yet merged rev

text
svn mergeinfo  --show-revs eligible  trunk_dir  fixes_0_9_30_dir

On Linux, to get log for mergeinfo

text
svn mergeinfo  --show-revs eligible  trunk_dir  fixes_0_9_30_dir  |  awk 'gsub("r", "-r ")' | xargs svn log trunk_dir

Using merge

text
svn merge  trunk_dir  fixes_0_9_30_dir  -c 123[,124,128] [--force] [--dry-run] [--record-only]

-c 123

The change that made rev 123 (change between r122 and r123 / equals "-r 122:123")

Use "-r 123:130" to merge changes after r123 up to (including) 130

--record-only

mark as merged, without merging (block this from being merged)

Tools

Some people prefer GUItools instead of command line clients.

(Cygwin also has an SVN client)

Committing over http

For people behind firewalls and proxies, SVN access over HTTP was also configured:

pascal
http://svn.freepascal.org/FPC/svn/<repository>

When committing you will be prompted for username and passwd.

Note that some HTTP proxies don't support webdav correctly, so a HTTP connection cannot be used and ssh remains the only alternative for committing.


From the Free Pascal wiki, page "SVN Migration", as it stood on 2014-08-11 after a change by BigChimp, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 2, last changed by WikiArchive .