![]() |
|||
Working with SubversionIntroductionThe SVN server maintains a central "repository", which is the main database containing the published common codebase of the project. Individual developers have their own "working copies", which are local copies of the database from a specific time together with local changes that the developer hasn't yet uploaded to the server. When a developer wants to share his changes with the rest of the team, he simply "commits" his changes to the server using the client program, which takes care of uploading them and merging them with changes done by other developers. The softwareUNIXIf you are running Linux, FreeBSD or any other modern UNIX clone, you simply need to install the official SVN software, version 1.0 or higher, for your OS. All common Linux distributions come with SVN packaged. There's also a cross-platform GUI front-end for Subversion called RapidSVN, available for Unixes (GNU/Linux distributions, FreeBSD, Sun Solaris and others), Mac OS X and Windows. przypis The server runs Subversion 1.1, which can be accessed by a client with the version 1.0, 1.1 or 1.2. AmigaOSIf you are running AmigaOS, you will need a TCP/IP stack and some SVN port installed. One option is the Amiga port by Olaf Barthel, which can be found on AmiNET (search for "subversion"). WindowsIf you run Microsoft Windows, you can use the TortoiseSVN SVN client, especially if you like using Windows Explorer. This program is Open Source and free, feature rich and well supported. Please also make sure that text files you submit have the svn:eol-style property set (see the Setting Properties section), otherwise you can break code generation. If files you're changing have eol-style:native SVN property set (not new files anyway) then you can forget about it, and line endings (EOLs) will be automatically converted. MacOS XIf you run MacOS X you can use one of several SVN ports available such as Martin Ott's Subversion port. After doing so you may also want to install an additional SVN GUI client such as svnX. svnX is the most up-to-date SVN client for OS X and also supports integration with, among others, the freeware Textwrangler texteditor (former BBedit Lite). The RapidSVN client is also available, as noted above. Note that when using Textwrangler or other Mac text-editors, you will need to change the character encoding from 'Macos roman' to 'ISO latin 1' (ISO8859) for your documents (change this in preferences). For Textwrangler all other settings are correct by default. All named applications are freeware and available as Universal Binaries for PPC and Intel Macs. Logging into the serverUnlike CVS, you don't need to log into the server. Instead, SVN will ask when it needs to know your login and password. przypis The AROS repository is running on a password protected SVN server, which means that you need to apply for access to it to be able to collaborate in the development. At the request of Amiga Inc., anonymous read-only access to the repository has been disabled. Getting the AROS sourcesTo get a copy of the AROS sources you use the "checkout" command, like this: > svn checkout https://svn.aros.org/svn/aros/trunk/AROS This will create a directory called AROS and populate it with all the sources, which might take quite some time if you have a slow network connection. In addition to the main repository, there is also the "contrib" repository, containing third-party programs that have been ported to AROS. To compile AROS, it is essential to check out at least the "necessary" subdirectory of this source tree. To check out only the necessary directory, use the following commands: > cd AROS > mkdir contrib > cd contrib > svn checkout https://svn.aros.org/svn/aros/trunk/contrib/necessary Alternatively, the entire "contrib" directory can be checked out as follows: > cd AROS > svn checkout https://svn.aros.org/svn/aros/trunk/contrib wskazówka After the checkout, SVN will remember where the source came from. Getting the extra sourcesApart from the AROS main sources which we checked out in the previous section, there is also other things on the SVN server not directly related to the core of the operating system. For example, the "binaries" module which contains images like screenshots, backdrops and similar, and the "documentation" module which contains the sources to the website. You can get a list of the available modules with: > svn ls https://svn.aros.org/svn/aros/trunk/ Updating the sourcesAfter having checked out the sources, you will probably want to periodically update them to get the latest changes the other developers have committed. For this you use the "update" command: > cd AROS > svn update . contrib/necessary This will merge any changes that other developers have made into your sources and also check out new directories and files that have been added. If someone committed changes to a file that you also have changed locally, SVN will try to merge the changes automatically. If both of you changed the same lines SVN might fail in merging the sources. When this happens, SVN will complain and put both versions in the file separated by <<<< You need to edit the file and resolve the conflict manually. Once this is done, you also need to use the "svn resolve" command to tell SVN that all is well. ostrzeżenie Just because SVN successfully merged the other developers changes with your doesn't mean everything is fine. SVN only cares about the textual content; there could still be logical conflicts after the merge (eg. the other developer might have changed the semantics of some function that you use in your changes). You should always inspect files that were merged and see if it still makes sense. Committing changesIf you have made some changes and feel that you want to share your work with the other developers, you should use the "commit" command: > svn commit You can specify a list of files to commit; otherwise SVN will recurse down from the current directory and find all files you have changed and commit them. Before sending your changes to the server for incorporation, SVN will ask you to input a log message. This log message should contain a brief description of what you have changed and in certain cases a rationale for them. Well written log messages are very important, since they make it much easier for the other developers quickly can see what you have done and perhaps why. The log messages are collected and then sent in a daily mail to the development mailing list so everyone can keep up with developments to the code base. Before committing your changes in a directory, you should first do an update there to see if anyone else has changed the files in the meantime since you've been working on them. In case that happens, you need to resolve any problems before committing. Also please make sure you have tested your changes before committing them; at least so that they do not break the build. Adding new files and directoriesTo add new files and directories to the repository, use the "add" command: > svn add file.c > svn add dir SVN will not automatically recurse into newly added directories and add the contents; you have to do that yourself. After having added the file, you need to use the "commit" command to actually add them to the repository. przypis Don't add generated files (usually mmakefile, strings.h) to the repository. Otherwise these files won't be updated when the source file has changed. Setting propertiesSubversion should be set up so that it automatically adds appropriate properties to new files. To do this, the file ".subversion/config" needs to be edited (the .subversion directory is located in your home directory). Firstly, make sure that the [miscellany] section of this file contains the following line: enable-auto-props = yes Secondly, add these lines to the [auto-props] section of the file: *.c = svn:eol-style=native;svn:keywords=Id Date Revision Author *.cpp = svn:eol-style=native;svn:keywords=Id Date Revision Author *.h = svn:eol-style=native;svn:keywords=Id Date Revision Author *.i = svn:eol-style=native;svn:keywords=Id Date Revision Author *.sh = svn:eol-style=native;svn:executable;svn:keywords=Id Date Revision Author *.txt = svn:eol-style=native;svn:keywords=Id Date Revision Author *.png = svn:mime-type=image/png *.jpg = svn:mime-type=image/jpeg Makefile = svn:eol-style=native;svn:keywords=Id Date Revision Author mmakefile.in = svn:eol-style=native;svn:keywords=Id Date Revision Author mmakefile = svn:eol-style=native;svn:keywords=Id Date Revision Author *.src = svn:eol-style=native;svn:keywords=Id Date Revision Author *.py = svn:eol-style=native;svn:keywords=Id Date Revision Author *.conf = svn:eol-style=native;svn:keywords=Id Date Revision Author *.css = svn:eol-style=native;svn:keywords=Id Date Revision Author *.cd = svn:eol-style=native;svn:keywords=Id Date Revision Author *.ct = svn:eol-style=native;svn:keywords=Id Date Revision Author *.en = svn:eol-style=native;svn:keywords=Id Date Revision Author If you are editing documentation files, add a line similar to the last one for each language you intend to use, replacing 'en' with the appropriate two-letter language code. The above rules will ensure that new files you add to the repository will get correct properties in most cases. However, sometimes it's necessary to specify properties manually for files not handled by the default rules. The most common properties that need to be set are svn:eol-style, svn:keywords and svn:ignore. Operating systems differ in which codes are used for line endings. To ensure that text files that aren't generated/modified on Linux have the right line ending it is necessary to do: svn propset svn:eol-style native <source.c> Subversion can substitute special keywords in source files. To enable this you need to do: svn propset svn:keywords "Author Date Id Revision" <main.c> ImportingWhen you want to add a larger collection of files, e.g. the source code of some existing software, "svn add" quickly becomes tiresome. For this you should use the "svn import" command. Unfortunately, the section about the import command in the SVN manual is quite poorly written, so an example is in order:
Further readingMore detailed information about SVN can of course be found in the manual pages and info files distributed with SVN itself, and there are also numerous sites containing useful tutorials and guides which might be easier to read. The following pages are highly recommended: |
Copyright (C) 1995-2009, The AROS Development Team. Wszystkie prawa zastrzeżone. Amiga(R), AmigaOS(R), Workbench i Intuition are znakami towarowymi Amiga Inc. Wszystkie inne znaki towarowe należą do ich prawnych właścicieli. |