Subversion

From Mandriva Community Wiki

Revision as of 18:10, 27 July 2011 by Cristian Gherman (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search
This page contains a short summary of what you need to know to grab a snapshot from subversion.

Contents

Subversion, rpm and associated tools

Subversion is split into several rpms. The client is in subversion.rpm. It will ask you to choose a library, to access a remote repository.

Since most of the time you will use webdav as a protocol, please choose subversion-client-dav.

There are some gui tools (like Rapidsvn) and svm, to mirror the repository. You may also be interested in svk, which enables use of subversion in a distributed fashion (Distributed Version Control with svk and SVK Wiki)

Subversion command

Subversion was designed to look like cvs. So, the command to check out a release is

svn checkout http://svn.server.org/path/to/file/

Subversion doesn't handle tags and branches like cvs does. If you want to keep a version, just use svn cp. That is why most of the time, you see 3 top level directories:

  • trunk/ contains the working copies
  • branches/ contains experimental branches, that will be merged in the main trunk once they are valid
  • tags/ contains version tagged like cvs does. If you want the version labeled 0.1, it should be usually here

It is not mandatory to use this scheme. However, this is the recommended layout of the official documentation, so this is widely used.

cvs stores all information in a CVS subdirectory. subversion uses the .svn subdirectory. You should not include them, and RpmLint will give you a warning if you keep them.

Subversion commits are atomic. This means the whole repository is versioned. So there is only one version number for all files, called the revision. You see it when browsing the repository. You can use the -r switch to get an older revision

svn checkout -r 345 http://svn.server.org/path/to/file/trunk/

All files will be in a trunk subdirectory, if you checkout trunk.

More documentation about subversion can be found on Version Control with Subversion and on subversion site.

Subversion and RpmBuildUpdate

RpmBuildUpdate can be used to automatically retrieve svn snapshots. You need to follow some rules, however, as explained on RpmBuildUpdate.

Subversion for translators

If you are starting, and do not have an account yep but you still want have your local copy of the package potfiles via svn(witch the translated ones you send manually for your sponsor) use

export URL=http://svn.mandriva.com/svn/soft/
instead of:
export URL=svn+ssh://svn.mandriva.com/svn/soft/

This will make you be able to checkout, but not to commit, to get commit access, later you will ask access to your sponsor, when he sees you are good to go alone :)

Once you have your username and password to access svn, you should follow these steps:

First, define your username to avoid having to enter it each time:

export SVN_SSH="ssh -l username"

You can avoid having to define that each time, by adding the line to your ~/.bashrc

Next, chekout the relevant modules. You have to do this checkout only once for each module (later on, you can update the module already on your disk).

Currently most modules were migrated from cvs to svn. You can check them out like this:

mkdir ~/svn-mandriva
cd ~/svn-mandriva
export URL=svn+ssh://svn.mandriva.com/svn/soft/
export DRAKX_URL=$URL/drakx/trunk/perl-install/
svn co $DRAKX_URL/install/share/po DrakX
svn co $DRAKX_URL/share/po libDrakX
svn co $DRAKX_URL/standalone/po libDrakX-standalone
svn co $URL/control-center/trunk/po control-center
svn co $URL/doc_isos/po doc_isos
svn co $URL/drak3d/trunk/po drak3d
svn co $URL/drakbackup/trunk/po drakbackup
svn co $URL/drakbt/trunk/po drakbt
svn co $URL/drakfax/trunk/po drakfax
svn co $URL/drakguard/trunk/po drakguard
svn co $URL/draklive-install/trunk/po draklive-install
svn co $URL/draklive-resize/trunk/po draklive-resize
svn co $URL/drakmenustyle/trunk/po drakmenustyle
svn co $URL/drakmsync/trunk/po drakmsync
svn co $URL/drakoo/trunk/po drakoo
svn co $URL/draksnapshot/trunk/po draksnapshot
svn co $URL/drakstats/trunk/po drakstats
svn co $URL/draktermserv/trunk/po draktermserv
svn co $URL/drakvirt/trunk/po drakvirt
svn co $URL/drakwizard/trunk/po drakwizard
svn co $URL/drakx-kbd-mouse-x11/trunk/po drakx-kbd-mouse-x11
svn co $URL/drakx-net/trunk/po network-tools
svn co $URL/external-l10n/trunk/kcm_touchpad/po kcm_touchpad
svn co $URL/ftw/trunk/po drakfirstboot
svn co $URL/ftw-web/trunk/po ftw-web
svn co $URL/GtkMdkWidgets/trunk/po gtkmdkwidgets
svn co $URL/hcl/trunk/po hcl
svn co $URL/indexhtml/trunk/about/po/ indexhtml
svn co $URL/initscripts/trunk/mandriva/po initscripts
svn co $URL/kde4-splash-mdv/trunk/po/ kde4-splash-mdv
svn co $URL/mandriva-galaxy-data/trunk/po mandriva-galaxy-data
svn co $URL/mandriva-galaxy-kde4/trunk/po mandriva-galaxy-kde4
svn co $URL/mandriva-kde-translation/trunk/po mandriva-kde-translation
svn co $URL/mdkhtmlbrowser/trunk/po mdkhtmlbrowser
svn co $URL/mdkonline/trunk/po mdkonline
svn co $URL/menu-messages/trunk/contrib menu-contrib
svn co $URL/menu-messages/trunk/main menu-main
svn co $URL/menu-messages/trunk/non-free menu-non-free
svn co $URL/msec/trunk/po msec
svn co $URL/nepomuk/ginkgo/po nepomuk-ginkgo
svn co $URL/nepomuk/khtml_nepomuk_task_linker nepomuk-tasklinker
svn co $URL/nepomuk/nepomuksmartfilemodule nepomuk-smartfilemodule
svn co $URL/nepomuk/plasma_applet_nepomukcontextchooser nepomuk-contextchooser
svn co $URL/nepomuk/scribo_opencalaistextmatchplugin nepomuk-scribo
svn co $URL/nepomuk/tasktop nepomuk-tasktop
svn co $URL/park-rpmdrake/trunk/po park-rpmdrake
svn co $URL/printerdrake/trunk/po printerdrake
svn co $URL/rfbdrake/trunk/po rfbdrake
svn co $URL/rpmdrake/trunk/po rpmdrake
svn co $URL/rpm-summary/trunk/rpm-summary-contrib rpm-summary-contrib
svn co $URL/rpm-summary/trunk/rpm-summary-devel rpm-summary-devel
svn co $URL/rpm-summary/trunk/rpm-summary-main rpm-summary-main
svn co $URL/rpm-summary/trunk/rpm-summary-non-free rpm-summary-non-free
svn co $URL/system-config-printer/po system-config-printer
svn co $URL/rpm/urpmi/trunk/po urpmi
svn co $URL/theme/mandriva-gfxboot-theme/trunk/po mandriva-gfxboot-theme
svn co $URL/transfugdrake/trunk/po transfugdrake
svn co $URL/userdrake2/trunk/po userdrake2

The commands above will also create a directory in your home named svn-mandriva where the checked out modules will exist. You can use any other directory as you wish.

After each svn co command, you will need to enter your svn password (possibly several times).

To work on a specific module, you should edit the language file of your team, then check it in.

Estimated space in disk: 550MB

Common subversion commands for translators

The following are common commands you are likely to run from the directory where the po file is:

  • To update a directory, in your local copy, to the latest version of Mandriva's svn:

svn update

  • To check which changes will be commited (one must do that, please avoid changing files that do not belong to your team!)

svn status

  • It would be wise to execute "svn diff", before finally commiting a change, in case there is an error in the files.

svn diff

  • To commit changes (make sure the message has your own language listed in):

svn commit --message "update translation for xxxx language"

  • If a ".po" file does not already exist, for your language:

. . . a. Copy your language's ".po" to your local svn directory
. . . b. Add it to your local svn using...(where "xx" is the two letters for your language)

svn add xx.po

. . . c. Commit as described above

  • If you want to change your subversion password, please ssh to host kenobi, i.e.:

ssh kenobi.mandriva.com
yppasswd

  • To retrieve information, about your local svn copy...

svn info

More subversion commands for translators

  • Short summary for those who don't want to read it up:

Please:
- run

svn diff

...before committing in order to check what you're going to commit

- if you get messages like

-
#~ msgid "Xfce Home folder"
#~ msgstr "Xfce Κατάλογος Χρήστη"
-
#~ msgid "Xfce Network Servers"
#~ msgstr "Xfce Εξυπηρετητές Δικτύου"

- use

make merge POFILES=xx.po

where...
xx the two+ letters specifying your language

...if needed in order to revert any unwanted wrapping

  • The problem:

Some translators (eg: some of the country between France & Poland)
keep rewrapping the po files when committing (rewrapping with their own
tool settings instead of the common gettext standard wrapping).

  • What I means by rewrapping:

- changing original english string wrapping (aka altering the msgid)
  obviously that's bad since translators should only change
  _translated_ string
- changing wrapping of translations that hasn't change otherwise.

  • Why is this bad?

- it means commit diffs are harder to read because there're lot of
  unrelated not real changes (smaller signal-to-noise ratio)
- it means history is quite less useful (smaller SNR)
  (eg: it makes harder to spot when & why an error was introduced)
- it means SVN disk space is wasted for no good reasons

  • It's not wanted / Solutions.

I can understand that there's people that think it's good if anyone
can write in the format it please to him and let others fix the merge
but I don't think anyone actually _want_ this behaviour.

So there's 2 points:
- either some tools' default settings are bad regarding wrapping
  (which is quite possible since I complained quite a lot of time
  along the years)
- people should run "svn diff" before committing

"svn diff" is cheap.  Unlike CVS, SVN doesn't need to perform any
network action in order to output the patch of what you changed.  It
doesn't need any password too (which shouldn't be needed with SSH keys
anyway).

"svn diff" is cheap and is useful. You can check that you won't
commit any bad stuff.

"OK but my editor is bogus and did unintended changes. What can I do?"

Simple: I've altered most foobar/po/Makefile so that you can just run
the following command to revert any rewrapping (for eg: french
language):

    make merge POFILES=fr.po

The command is "make merge POFILES=<LL>.po" where <LL> is the ISO 639
language code of your language (aka the basename of your
translation. eg: "ru.po" => "ru", "de.po" => "de", ...)

Btw, it will just make merging cheap & easy. Ie if when you're
committing your changes, SVN complains you're not up to date and you
fear any conflicts, you can just backup your file, update, and then
make sure to merge w/o any conflicts.  Eg for Brazil Portuguese:

     cp pt_BR.po pt_BR.po.backup
     svn up
     # if there's a conflict, just run "svn revert pt_BR.po; svn resolved pt_BR.po"
     cp pt_BR.po.backup pt_BR.po
     make merge POFILES=pt_BR.po
     

And voila!

So please run "svn diff" before committing in order to check what
you're going to commit use "make merge POFILES=<your_language>.po" if
needed in order to revert any unwanted wrapping.

--- --- --- ---

Alternatively, you could see the:
manually_correcting_rewrapped_.po_files

Anonymous checkouts for those without a SVN account

If you do not have a SVN account, just replace "export URL=svn+ssh://svn.mandriva.com/svn/soft/" with "export URL=http://svn.mandriva.com/svn/soft/" in the above instructions. This will enable you to use anonymous checkouts (you won't be able to commit directly but you'll have to send your patches[1] to i18n-patches@mandrivalinux.org) Eg:

mkdir ~/svn-mandriva
cd ~/svn-mandriva
export URL=http://svn.mandriva.com/svn/soft/
export DRAKX_URL=$URL/drakx/trunk/perl-install/
svn co $URL/theme/mandriva-gfxboot-theme/trunk/po bootloader
svn co $DRAKX_URL/install/share/po DrakX
(...)

See also

Some useful references

References

    Personal tools
    In other languages