The Semb + Wever Family
[ start | index | login ]
start > java > Integrating Subversion and S

Integrating Subversion and S

Created by michaelwever. Last edited by michaelwever, 8 years and 362 days ago. Viewed 8,645 times. #11
[diff] [history] [edit] [rdf]
labels
attachments

Prerequisites

Subversion

You need
  • to copy extensions/scripts/scarab-post-commit.py into your subversion repository's hooks directory,
  • python with >>xmlrpclib and svn libraries (ie the swig.py bindings),
If subversion and scarab will run on seperate machines, you need to:
  • check the firewall (outbound-traffic) is open to the machine running your scarab installation to the defined xmlrpc port (the default is 12345),

Scarab

If subversion and scarab will run on seperate machines, you need to:
  • edit src/conf/conf/componentConfiguration.xml so that in <XmlRpcComponent> the element <acceptedClients clientIP="127.0.0.1"/> allows the ipaddress of your subversion machine to connect. (This is also the file to edit if you want to change the port scarab's xmlrpc is running on). Scarab will need to be rebuilt and restarted after these changes,
  • check the firewall (inbound-traffic) is open from the machine running your subversion installation on the defined xmlrpc port (the default is 12345).

Checking Prerequisites

  • From your subversion repository's hooks directory running the scarab-post-commit.py script should give the output:
user@subversion$ ./scarab-post-commit.py
Publish Subversion commits into to Scarab.
USAGE: ./scarab-post-commit.py REPOS-DIR REVISION
If this doesn't work then you need to check the python libraries are installed correctly.
  • After restarting Scarab, check scarab/logs/scarab.log contains:
[main] INFO  org.tigris.scarab.util.SimpleHandler - SimpleHandler: loading
If this is missing, then look closer at the turbine.log to see if the XmlRpc component is being properly initialised. It'll all look something like:
[main] INFO  ...DefaultXmlRpcServerComponent - Attempting to initialize the XML-RPC server.
[main] INFO  ...DefaultXmlRpcServerComponent - We have 1 handlers to configure.
[main] INFO  ...DefaultXmlRpcServerComponent - registered: simple with class: org.tigris.scarab.util.SimpleHandler
[main] INFO  ...DefaultXmlRpcServerComponent - Operating in a state of paranoia
[main] INFO  ...DefaultXmlRpcServerComponent - Accepting client -> 127.0.0.1
If this doesn't help then you will atleast have useful information to post to dev@scarab.tigris.org to get further help with.
Note: Or should it be users@scarab.tigris.org ? I've presumed configuring Turbine/Yaafi components within scarab is more dev than user...

Setup

The only setup needed, beyond checking the prequisites, is a few variables in the scarab-post-commit.py and finally calling this script from post-commit.sh.

scarab-post-commit.py variables

There are two sections of variables in the beginning of the script, "basic configuration" and "i18n strings". We are only interested in the former, the latter is only when you want to localise the output to another language.
  1. VIEWCVS_URL = "http://scarab.tigris.org/source/browse/scarab/"
    The viewcvs or websvn URL base. The comments posted to scarab contain a list of hyperlinks to the diffs committed in that subversion transaction. This is the base URL prepended to those hyperlinks.
  2. SCARAB_XMLRPC_URL = "http://localhost:12345"
    The address of the scarab machine and port running the xmlrpc service. If scarab and subversion are running on the same machine it is sufficient to use the above.
  3. DISABLE_EMAILS = 1
    Each time a comment is added to an issue in scarab by default an email is sent to everyone associated to the issue. The author of the integration didn't feel it was appropriate that all associated personnel were notified of every commit. Especially since the commit will often be followed by a manual change by the commitor of the status attribute to the issue in question, and associated personnel are more interested in these events. But if this is not the case for you change the variable to 0.
NOTE Only the global setting of email-enabled is checked (and temporarily disabled), so if your modules override this setting emails will continued to be sent. See >>http://scarab.tigris.org/servlets/ReadMsg?list=dev&msgNo=11971 for more… (This will be fixed in the future).

Calling scarab-post-commit.py

In your subversion repository's hooks directory, append to the file post-commit
REPO="$1"
REV="$2"
# Call Scarab integration
cd <your-repository>/hooks/
./scarab-post-commit.py $REPO $REV >> post-commit.log 2>&1
If the file doesn't exist, create it from a copy of post-commit.tmpl, and remove the last two lines before appending the above.
Note: it's important to background the call to scarab-post-commit.py to prevent blocking of subversion while xmlrpc tries to connect and communicates with scarab…

When it's working

When its working look in target/scarab/logs/scarab.log The output should be similar to
2005-09-03 14:59:31,855 [Thread-9] INFO  org.tigris.scarab.util.SimpleHandler - SimpleHandler: addComment:  issues=SMBW1657 test commit, user=mick, comment="Subversion commit 6011:    h ttp://samboweb/viewcvs/?view=rev&rev=6011
-------------------------------------------------------------------------
SMBW1657 test commit
-------------------------------------------------------------------------
Modified: trunk/build.xml    h ttp://samboweb/viewcvs/trunk/build.xml?view=diff&rev=6011&p1=trunk/build.xml&r1=6010&p2=trunk/build.xml&r2=6011
, disableEmails=1

Subversion -to- Scarab Username mappings

This part of the integration is still primitive. By far the best solution is to enforce subversion and scarab usernames are the same, either manually or via using a LDAP service. If this is not the case, the currently primitive solution is to enter the mapping relationships manually into scarab-post-commit.py. An example already exists commented under "### Do any Subversion-to-Scarab author mappings here ###".
!! The author would like anyone with python experience to separate this mapping into a separate python script that can be easily called if it is present, so that updating scarab-post-commit.py is less error-prone !!
See >>http://www.solitone.org/scarab/issues/id/SCB1436 for more...

Credits

The scarab subversion integration was inspired and based upon work originally done by Rob Clark.
Next to all of the scarab-post-commit.py was done by C.Michael Pilato, also the author of the subversion-python bindings.
no comments | post comment
Semb Wever Family:
>>Family Tree, >>Wedding, & >>Photos
>>Music & Movies
>>Hosted GnuPG Keys

< September 2014 >
SunMonTueWedThuFriSat
123456
78910111213
14151617181920
21222324252627
282930

Corporate links:
Finn
Bokklubben

Opensource projects:
Apache Tiles
Scarab
NetBeans


Describe here what your SnipSnap is about!

Configure this box!

  1. Login in
  2. Click here: snipsnap-portlet-2
  3. Edit this box



>>The only thing worse than using cracked/stolen software is actually paying for it.
>>Liberate yourself. Free Software Foundation.


XHTML 1.0 validated CSS validated RSS 2.0 validated SnipSnap Get Firefox! RSS Feed
Powered by Gentoo Linux/GNU






Rainforest Site