The SVN url has been changed by SourceForge. In your repository root, or in an individual module, run the command:
svn switch --relocate https://apertium.svn.sourceforge.net/svnroot/apertium/ https://svn.code.sf.net/p/apertium/svn/

Using SVN

From Apertium
(Redirected from SVN)
Jump to: navigation, search

Contents

Apertium development code is kept in SVN. The following is a basic cheatsheet for using SVN. The SVN repository is arranged into several sub-directories:

  • trunk — this holds the main development tree for released translation pairs,
  • languages — this holds the main development tree for individual languages (depended on by translation pairs),
  • builds — holds binary releases (of packages not suited for our normal Sourceforge file releases downloads),
  • tags — this holds archived versions of releases,
  • branches — this holds branches that people are working of any of the modules in trunk,
  • incubator, nursery, staging — these hold work-in-progress modules (mostly language pairs) that have not yet made it into trunk or languages.

If you're new to Apertium and SVN, you probably just want to look at the trunk sub-directory. To browse the tree, you can just go to: raw or ViewSVN

[edit] What is SVN

SVN is a version control system. Linux and Mac users should have it installed already (otherwise, it will be available through your package manager), Windows users should use tortoisesvn (see Using SVN with TortoiseSVN).

[edit] Everyone

If you have limited bandwidth or disk space, please see Minimal installation from SVN.

To check out the whole tree:

$ svn co https://svn.code.sf.net/p/apertium/svn/ apertium

Note: The whole tree is over 8GB, if you're on a slow connection or have transfer limits, probably it is best to only check out the modules that you need — for a basic installation, the modules "lttoolbox" and "apertium" suffice[1].

To check out a module:

$ svn co https://svn.code.sf.net/p/apertium/svn/trunk/<modulename>

So, for example, to check out the Basque-Spanish one, write

$ svn co https://svn.code.sf.net/p/apertium/svn/trunk/apertium-eu-es

To perform an update:

$ svn update

[edit] Developers

To commit your changes (send them to the server):

$ svn commit

Note: Remember to write a nice log message!

To add a file or directory (to an existing module):

$ svn add <file or directory name>

To delete a file or directory from the server:

$ svn delete <file or directory name>

Note: This deletes the file locally aswell!

To import a new module into SVN:

$ svn mkdir https://svn.code.sf.net/p/apertium/svn/<subrepository>/<modulename>

Then cd to the directory you want to import.

$ svn import . https://svn.code.sf.net/p/apertium/svn/<subrepository>//<modulename>

[edit] Shortcuts

If you use SVN regularly, it might be worth learning some shortcuts, to save yourself some time.

Instead of svn commit you can use:

$ svn ci

Instead of svn delete, you can use

$ svn rm

If you don't want to wait for your text editor to open when you're committing, you can specify the commit message at the command line:

$ svn ci -m "My commit message"

It's worth noting here that, if you don't understand the shell fully, it's probably better to stick to the text editor.

[edit] Committing only part of your changes

If you have changed a number of files, and don't want to commit everything at once, you can give a list of filenames to svn commit, and only those files will be committed:

$ svn ci file1 file2

Sometimes, it's better to commit this way; to put related changes in the same commit, and keep unrelated changes separate. This makes it easier to undo your changes later, if it turns out there was a problem.

[edit] Undo local changes

If you've made changes that you don't want to keep - and you haven't committed those changes - you can use:

svn revert <file>

This will reset the files to the last version you fetched from the server.

For directories, use:

svn revert -R <directory>

[edit] Undo all or part of a commit

First work out the revision you want to rollback to (probably the revision that you just committed minus one), cd back to the apertium/ directory.

mv <modulename> <modulename>.new
svn co -r <revision> https://svn.code.sf.net/p/apertium/svn/<modulename>

Now copy all the files that you want to "revert" from the old revision (<modulename>) back into the new revision (<modulename>.new), then do:

rm -rf <modulename>
mv <modulename>.new <modulename>
cd <modulename>
svn commit

[edit] Using ssh-keys instead of passwords

Little-known secret: SVN can check out over ssh just like git :-) So you can get passwordless logins just like with regular ssh or git, without having to deal with SVN's various password storage methods.

[edit] Make a keypair

If you haven't done so already, create a keypair with

ssh-keygen

Select some passphrase for it in case someone steals your harddrive or something. If you run Ubuntu or similar it'll suggest storing it in your login keychain the first time you use it so you don't ever have to type it in again.

You'll end up with two files in ~/.ssh, named e.g. ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub. The first file is your private key (encrypted with your passphrase), don't share it! The second, id_rsa.pub, is your public key, this one you should share with the servers you want to log in to.

[edit] Upload your public key to Sourceforge

Go to https://sourceforge.net/auth/shell_services and paste the contents of id_rsa.pub in the field there. You may have to wait some minutes for this to get rolled out to their SVN servers.

[edit] Check out using SVN+SSH

Now you can check out your SVN module using the svn+ssh method (instead of https):

svn checkout svn+ssh://SFUSERNAME@svn.code.sf.net/p/apertium/svn/incubator/apertium-lol-wat

Replace SFUSERNAME with your sourceforge username (the SFUSERNAME@ is probably optional if your sourceforge username is the same as the login to your computer).


The nice thing about this is if you use ssh (or git) a lot anyway, you can use the same key all the time, no need for remembering multiple passwords.

[edit] Now where did we put pair XXX-YYY?

And was it named XXX-YYY or YYY-XXX? A common modern-day frustration.

Here's a little bash function called "ca" that lets you type "ca eng tha" and be sent to incubator/apertium-tha-eng, or "ca bak" and be sent to languages/apertium-bak and so on: https://gist.github.com/unhammer/f5ade1c20f0f5d653b8c

(Assuming you have checked out all of apertium SVN somewhere and edited the APERTIUM_SVNROOT path in that script.)

[edit] svn up in dependent dirs as well as pair itself with one command

See the "up" script

[edit] Keeping track of new changes

You can keep track of new commits being made through

[edit] Troubleshooting

[edit] 502 Bad Gateway Errors

When executing certain operations (such as SVN COPY or branching/tagging, which use SVN COPY), you may get a 502 Bad Gateway error if you used HTTP instead of HTTPS to checkout your working copy. Relocate your working copy to HTTPS and try again. (See this ticket on the Sourceforge trac for more information. See this article for a more detailed explanation as to why this happens.)

$ svn switch --relocate http://svn.code.sf.net/p/apertium/svn/ https://svn.code.sf.net/p/apertium/svn/

[edit] Host not found when using Squid proxy

If you get

svn: OPTIONS of 'https://svn.code.sf.net/p/apertium/svn/trunk/lttoolbox':
	 Could not resolve hostname `svn.code.sf.net': Host not found (http://apertium.svn.sourceforge.net)

and are using a Squid proxy, add

[global]
http-proxy-host=proxyhost
http-proxy-port=3128

to the file ~/.subversion/servers.

SVN is picky about the format of this file. Make sure you don't have e.g. spaces in front of the lines, you'll get svn: ~/.subversion/servers:144: Option expected.

[edit] Could not authenticate to server: rejected Basic challenge

This happens because you have checked out with http and not https, you need to switch as follows:

$ svn switch --relocate http://svn.code.sf.net/p/apertium/svn/ https://svn.code.sf.net/p/apertium/svn/
  1. (Developers) As an alternative to checking out particular modules as separate working directories consider the sparce directories feature of svn
Personal tools