[[PageOutline(2-3)]] = Trac and Subversion = Trac has supported the [http://subversion.tigris.org Subversion] VersioningSystemBackend since day one. Actually, Trac was even named `svntrac` back then! This page is intended to collect all the specific tips and tricks about Subversion support ''in Trac''. This is not the place for general Subversion help. You can get [wiki:TracSubversion#AskingforMoreSupportAboutSubversion more support] options elsewhere. At the time of this writing, the preferred Subversion version for Trac is still 1.2.3. If you are willing to make a few changes to the stock 1.3.0, that version works also pretty well. == Getting Subversion == From subversion.tigris.org, in the [http://subversion.tigris.org/servlets/ProjectDocumentList download] area: - [http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=260&expandFolder=260&folderID=91 Source] archives. - Pre-built binaries for [http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91&expandFolder=91&folderID=74 Windows]. It's worth noting that starting with 1.4.0, there's now pre-built bindings for Python-2.4. == Building Subversion == The point is not to repeat the excellent build instructions found elsewhere, but rather to clarify the general approach: Trac actually needs the SWIG bindings for Subversion that are bundled with the Subversion distribution. In order to build them, you (obviously) need to build first Subversion, then the bindings. * Read the `INSTALL` file that sits at toplevel of the Subversion source distribution * Do `./configure ...; make; make install`; if you intend to use Subversion together with Apache, be sure to configure Subversion so that it will use a compatible version of `apr` and `apr-utils`, ideally those of Apache. If not, you'll be able to build Subversion and the bindings, but you most certainly have issues later on, when using mod_python (e.g. #2920). * Read `./subversion/bindings/swig/INSTALL` in order to build the bindings. In particular, pay attention to the version of SWIG which can be required (1.3.0 comes with pregenerated wrappers, though). Do not install swig 1.3.28 or 1.3.29. Version 1.3.27 seems to works fine (Although not in all cases. The subversion users mailing lists suggest going back to 1.3.25, which may be necessary). * Do `make swig-py; make install-swig-py` * Adapt your `PYTHONPATH` so that it contains the `svn-python` folder (the one containing the `svn` and `libsvn` packages). If you're using TracModPython, be sure that Apache will also see this environment variable, or alternatively use the [TracModPython#Subversionissues PythonPath] mod_python directive. == Trac and specific Subversion versions == {{{ #!comment The following info about pre 1.3.0 versions is all ''by heart'' and is probably inaccurate at places. This is mostly to get the page started. Feel free to correct me and publicly humiliate me :) }}} === Trac and Subversion 1.0 === This is the oldest supported Subversion version. === Trac and Subversion 1.1 === This release introduced the `fsfs` repository backend, which is to be preferred over the `bdb` one (see #571 for example). When creating a repository with this Subversion version, take care of using the `--fs-type fsfs` switch with the `svnadmin create` command. Version 1.1.4 is the last stable one for that maintenance branch. === Trac and Subversion 1.2 === This release makes the `fsfs` storage the default. Version 1.2.3 is the last stable one for that maintenance branch. If you switched from a previous version to this one, chances are that you had a Berkeley DB repository. It would be a good idea to switch that repository to the FSFS backend. google:svn+convert+bdb+to+fsfs. === Trac and Subversion 1.3 === This is the newest major release for Subversion, and it is currently support by Trac 0.9.x and beyond, with a few caveats. ==== Trac and Subversion 1.3.0 ==== There are a few known issues with the stock 1.3.0 version: * Issue #2472 (spurious exception) [[BR]] which can be fixed by applying this [/trac/ticket/2472#change_12 patch] to `subversion/bindings/swig/python/svn/core.py` [[BR]] Should be fixed in Subversion 1.3.1 (!r17992). * Issue #2620 (memory leak) [[BR]] which can be fixed by applying this [/trac/ticket/2620#change_10 patch] to `subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c`. [[BR]] Should be fixed in Subversion 1.3.1 (!r18230). With those fixes, I've been able to use the Subversion backend flawlessly "in production", since end of January 2006. However, some people are seeing yet another problem, which requires one more fix: * Issue #2611 (intermittent fatal error, manifesting itself with `"argument number 0: a 'apr_pool_t *' is expected"` messages in the log and segfault of the apache server) [[BR]] was supposedly fixed by applying this [attachment:ticket:2611:application_pool_race_condition_fix.txt patch] to `subversion/bindings/swig/include/proxy_apr.swg`. Note that after applying this patch, the SWIG bindings would have to be regenerated, as explained [comment:ticket:2611:16 here]. It should be emphasized that a compatible version of SWIG must be used (`1.3.24`, `1.3.25`). [[BR]] The issue was supposed to be fixed in Subversion 1.3.1, as the above patch was integrated as !r18721, but actually the patch was not enough to solve the issue. See below. ==== Trac and Subversion 1.3.1 ==== As mentioned above, the issues found with 1.3.0 should be fixed by 1.3.1. This is mostly true, except for #2611. '''Issue #2611 was confirmed to still exists in Subversion 1.3.1''' and also in the stock 1.3.2, when compiled using the pre-generated bindings that were produced using SWIG 1.3.25[[br]] So it seems the patch discussed above was not enough to solve the problem. Also, ''the issue is most certainly related to the use of multiple python sub-interpreters'', either because those are created by default when different virtual hosts are used (#2965, #3455) or because different `"PythonInterpreter"` directives are used in different sections (#2713). '''A workaround consists to force the use of a single Python interpreter''', using the `"PythonInterpreter"` directive with the same argument for all the virtual hosts, as explained [comment:ticket:3455:5 here]. ==== Trac and Subversion 1.3.2 ==== This version adds support for SWIG 1.3.28. It remains to be seen if a binding built with wrappers generated by 1.3.28 are enough to fix #2611, but I'm skeptical at this point. See also: [http://svn.collab.net/repos/svn/tags/1.3.2/CHANGES release notes for 1.3.2] === Trac and Subversion 1.4 === I just built the Subversion-1.4.0-rc5, run tracd with it, and everything was running well, even a `resync`. I've noticed that there has been some improvements to the `ra` layer ... unfortunately not available yet for the Python bindings Also, that version supports SWIG 1.3.29, but so far I used the 1.3.25 pre-generated wrappers that are bundled with the tarball. Same remark as above concerning #2611, if I have some time, I'll try to reproduce the issue. Update: according to comment:ticket:2965:14, the problem is still there for 1.4. See also: [http://svn.collab.net/repos/svn/tags/1.4.0/CHANGES release notes for 1.4.0] == Troubleshooting == ==== `SubversionException: ("Expected version '3' of repository; found version '5'", ...` ==== #version-mismatch The bindings used are older than the Subversion version used to create the repository (#3943). ==== `ImportError: /usr/local/lib/libsvn_ra_dav-1.so.0: undefined symbol: gss_delete_sec_context` ==== #gss-link There was a problem while building neon. Either disable it, or install the missing packages (#3706). == Known Issues == [[TicketQuery(status=!closed&keywords=~svn&type=defect)]] == Asking for More Support About Subversion == * !ReadTheFineBook: http://svnbook.red-bean.com and/or the [http://subversion.tigris.org/faq.html FAQ] * There's also a `#svn` channel on the `freenode` IRC network * If you think you've found a bug in Subversion, read these [http://subversion.tigris.org/project_issues.html instructions]