SVN
From Triangle Wiki
IntroductionSubversion (SVN) is a version control system initiated in 2000 by CollabNet Inc. It is used to maintain current and historical versions of files such as source code, web pages, and documentation. This document will give information on Subversion, such as install and usage for an Ubuntu server. InstallationWe use Apache with SVN for the following reasons:
Create Directory
Add Apache Modules
Setup SSL Access
Create /var/lib/svn/.svn-policy-file
The * in the / section is matched to anonymous users. Any access above and beyond read only will be prompted for a user/pass by apache AuthType Basic. The triangle section inherits permissions from those above, so anonymous users have read only permission to it. I granted myself read/write permissions to the repo. Create a Repository svnadmin create /home/svn/repositories/test Set Permissions The Apache user needs permissions over the new repository. chown -R nobody.nobody /home/svn/repositories/test Create a Directory structure for project, Create the following directory structure on your development machine. branches tags trunk You can create them like this. cd /path/to/directoryofchoice mkdir branches tags trunk Populate Directory Put your source files into the created trunk directory. cp -R /home/cactus/project/test/code/* trunk [edit] Import the Project svn import -m "Initial import" https://yourdomain.net/svn/test/ [edit] Test SVN Checkout cd /path/to/directory_of_choice cd .. rm -rf /path/to/directory_of_choice svn co https://yourdomain.net/svn/test/ AuthenticationCreate /mnt/files/svn/.svn-auth-file htpasswd -cs /home/svn/.svn-auth-file cactus The above creates the file (-c) and uses sha1 for storing the password (-s). The user cactus is created. To add additional users, leave off the (-c) flag. htpasswd -s /home/svn/.svn-auth-file userX Subversion CommandsSVNAdmin To view a list of the available commands via the SVNAdmin type svnadmin --help into the terminal window. SVN To view a list of the available commands via the SVN type svn --help into the terminal window. Server ConfigurationWhen using SVNServe the following ports must be open to allow connections to the SVNService.
Setting Up A RepositoryThe common way to set up an SVN repository is as follows:
Best practices dictate that commits should happen often and logically; i.e. when a certain bug has been completed, new feature added etc.
[general] anon-access = none auth-access = write password-db = ../../passwd realm = Admin [miscellany] enable-auto-props = yes
[users] user1 = password1 user2 = password2 Diffs and PatchesSVN Repository PatchesUpdating a subversion repository with your changes isn't the only way to share your work. You may want to create a patch file based on a diff (a comparison between two files or folders), which can then be applied to someone else's working copy. To do this we use the tortoiseSVN client on windows, but it can be done with any svn client, including the command-line clients on any supporting OS. Once you have checked out the latest revision of the file(s) you want to change, and have made your changes in your working copy, you select the file(s), then select the subversion sub-menu "Make Patch". A file browsing dialog will then appear, asking you where you want to save your file, and suggesting a .patch or a .diff extension. SVN doesn't care which extension you use, but it will generate a GNU/diffutils compatible patch file. The extension is important if you plan to use diffutils to apply the patch. The person receiving the patch need to have the same revisions as the ones you originally modified. They just select the folder in which the patch is to be applied, select the tortoisesvn context menu "Apply Patch" and select the .diff or .patch file. The files will be automatically modified with the same modifications. One great advantage of this method is that the patch files are very small, containing only the information necessary to change the file to a new state. Winmerge and diffutilsAlternatively, you may want to create a patch for a file which is not under version control. GNU/diffutils is the tool most commonly used for creating and applying patches, but I prefer using WinMerge, a windows visual diff/merge tool, to create the patch files. See the external links section for download URLs. Open WinMerge, then select Tools -> Generate Patch. Enter the original file or folder location in the first box, then the file or folder to be compared in the second box. Then enter the name of the patch file to create (.diff), and select whether you want to append it to an existing file. There are a number of other options which I haven't tried yet, but you're welcome to play around with them and edit this article with your findings. Then click OK and your file is generated. WinMerge cannot apply patches, you need to use either svn or diffutils, or another program that can perform this operation. There is a version of diffutils for windows platforms, as part of a large package called GnuWin32, available on sourceforge. The URL is in the External Links section. ToolsRemove all SVN folders
External Links |
|

