Tag Archive for 'hook scripts'

WANdisco Launches Enterprise Subversion Training On-Demand

If you’ve ever attended our Enterprise Training sessions, which are delivered by our SVN experts at a place and time to suit you, you’ll know that we’re dedicated to making it easy for Enterprises to get the information, best practices and practical, hands-on experience they need to get the most out of the world’s most popular version control system. So, we’re excited to announce a brand new series of enterprise-class, on-demand Subversion training that makes it easier than ever to get the training you need.

Designed with the enterprise in mind, our step-by-step video modules cover all the crucial SVN topics, including:

  • Basic Operations and Command Line
  • Handling Merge Conflicts
  • Advanced Repository Management
  • SVN Changelists
  • Hook Scripts
  • and more!

Each class is delivered as an on-demand, 30 minute video, which can be watched within our Video Streaming Platform or delivered as a SCORM compliant SCO file for onward integration into your LMS. The content is provided in an interactive slide presentation at an easy-to-follow pace, with visual indications to highlight where specific topics stop and start. We can also provide quiz questions as part of the training, so you can test your progress.

Sign up before December 15th, to claim one month of Subversion eTraining for free, with a 6 month agreement, or 3 months free with a 12 month agreement. Visit our Subversion eTraining page now to request a quote, or to view the complete course list.

New Subversion Live Session: Beyond Scrum

Subversion Live 2012, the global conference series for the Subversion community,  is fast approaching, and today we’re excited to bring you news of a brand new Subversion Live session. Andy Singleton, Founder and CEO of Assembla will be presenting ‘Beyond Scrum: The Move to Scalable Agile with Continuous Delivery,’ joining our list of exciting speakers, which includes:

  • Greg Stein – Vice President of Subversion and former ASF Chairman
  • Hyrum Wright – Software Engineer at Google
  • Stefan Fuhrmann – TortoiseSVN contributor since 2003 and committer to the Subversion project since 2010
  • Julian Foad – lead developer for enhancements to Subversion’s merge capabilities at WANdisco
  • Philip Martin – part of the team that developed the first version of Subversion

Andy Singleton’s session will cover how the new and improved code merge system in the upcoming Subversion 1.8 release will facilitate the continuous delivery process for the first time, transforming the possibilities for scalable and agile development processes for the enterprise.

In addition to Andy’s cutting-edge SVN 1.8-focused session, Subversion Live will cover a wide range of topics:

  • Merge & Performance Improvements
  • Hook Scripts
  • Branching & Merging Best Practices
  • Best Practices for Large Subversion Deployments
  • ……and more!

Taking place in San Francisco (October 10th and 11th) Greenwich, CT (October 16th and 17th) and London (October 23rd and 24th) Subversion Live is a two day series of conferences especially for the Apache Subversion community. If you haven’t already registered, there’s still time to get your tickets, or learn more about this exciting event.

WANdisco To Attend San Francisco Jenkins User Conference

September and October are shaping up to be a busy few months for the open source community – not only are we gearing up for three Subversion Live conferences, but there’s just a few weeks to go until the Jenkins User Conference (JUC) in San Francisco.

After attending the JUC in New York, WANdisco are excited to be meeting the Jenkins community again in San Francisco. Be sure to look out for the WANdisco table, if you’re attending the San Francisco JUC. And if you haven’t got your ticket yet, you can use the  “JUC-2012SF” code when registering to claim a $100 discount!

Speaking of discount codes, listen to our recent podcast with Greg Stein, Vice President of Subversion at the ASF, for a special 30% discount code for Subversion Live. If you haven’t already heard, Subversion Live is a global series of conferences for the SVN community. This year’s conference series is bigger and better than ever, with events taking place in San Francisco (October 10th & 11th) Greenwich Connecticut (October 16th & 17th) and London (October 23rd & 24th).

Confirmed sessions include:

  • What’s coming in 1.8
  • Best Practices for Large SVN Deployments
  • Merge & Performance Improvements
  • Apache Bloodhound
  • Hook Scripts
  • ….and more!

Visit http://www.wandisco.com/svn-live-2012 for more info!

Apache Subversion: Access Control Options

Subversion Access Control is a security solution for Apache Subversion that goes well beyond what SVN can provide on its own. To fully understand the benefits of Subversion Access Control, we’ll first look at the fundamental technical differences between Subversion’s built-in security functionality, and WANdisco’s Subversion Access Control product.

Apache Subversion…….

In Apache Subversion, user authentication is performed either through a local passwd file or from an LDAP or Active Directory server. Apache also provides an Authorization Layer for defining more granular control of repository objects, but managing text based rules through the Authz file can become difficult as the number of users and repositories inevitably increases.

…..v.s Subversion Access Control

Subversion Access Control is implemented as a proxy from the local Subversion server. It works directly with your LDAP or Active Directory, meaning you can keep your existing setup.

But what can Subversion Access Control offer you? Here are our ten top features of Subversion Access Control:

1) Easy to install, with no retraining required! Subversion Access Control requires no changes to clients or backend servers, meaning that you can continue to use the Subversion technology you’re familiar with.

2) Easy to use, point and click interface.

3) Access control made easy! The ability to implement and maintain complex security policies with minimal effort.

4) Audit capabilities – every repository access attempt down to the file level is reported, showing user ID, Subversion command, date and time, IP address of the client machine used, and whether access was allowed or denied

5) Unlimited access control – Subversion Access Control can support any size of development organization with any number of repositories and access control rules.

6) Delegated admin – this option allows the root administrator to create teams and delegate admin authority to team leaders.

7) Automatic LDAP synchronization – Subversion Access Control automatically picks up LDAP user and group membership changes and assigns new users to the Subversion team that corresponds to their LDAP group.

8) Instant alerts – your security administrators receive immediate alerts for any access violations.

9) Integrated seamlessly with Subversion MultiSite – Subversion Access Control can be implemented standalone, or in combination with Subversion MultiSite for distributed development teams. With Subversion MultiSite, security policy changes made at one location are immediately replicated to every other to enforce consistency across all sites.

10) Available for uberSVN! – uberSVN is the free, open ALM platform for Apache Subversion that has won a string of industry awards and received an overwhelmingly positive response from the Subversion community. For those who want to combine this award winning platform with a fully functional security solution, Access Control is available through the uberAPPS store.

Here’s just some of the benefits of deploying this enterprise-level Access Control functionality with uberSVN:

  • Full authorization/authentication
  • Define Access Control rules through a simple point-and-click interface
  • Delegated admin control
  • Define control within each Team/sub-Team to a granular level
  • Assign Team Leaders
  • Audit capabilities
  • Support for ecosystems without internet access

Interested in finding out more about access control options? We’ll be running a free Subversion training webinar on November 15th that covers the pros and cons of the following methods of access control:

  • Apache Subversion access control
  • Hook scripts
  • uberSVN
  • Subversion Access Control from WANdisco

Visit the ‘Access Control Options with Subversion’ webinar page now to register. Remember that spaces are limited, so register now to avoid missing out.

WANdisco’s June Roundup

Happy summer! As well as enjoying the nice weather and longer days, this month we announced an exciting update for the uberSVN community.

uberSVN keeps going from strength to strength and, with an ever-growing community of users, we need your feedback more than ever to ensure we continue to deliver the features and functionality you need. Have some thoughts on the uberSVN user interface? Head over to SVNForum.org now to read our proposals for a redesigned Users/Teams tab and a redesigned Admin tab. If you’re a registered SVNForum.org user you can join the discussion by posting at the relevant thread (if you’re not already registered, then signing up is quick and easy!) Alternatively, send us your feedback directly.

We also announced a dedicated channel for keeping in touch with the uberSVN community, the Latest Release Channel. Everyone signed up to the Latest Release Channel will get a sneak preview of upcoming releases at least a few weeks before the rest of the uberSVN user base. This gives you the opportunity to test new features and see how they fit into your ALM environment before the update becomes widely available.

Members of the Latest Release Channel already have access to an update to uberSVN Chimney House. This update features a list of improvements and new functionality, including:

  • Improvements to uberSVN APIs and internal development of uberSVN SDK.
  • Further improvements to the way uberSVN handles LDAP and LDAPS.
  • New manageAPPS page allows you to see metadata attached to your APP license.
  • The latest Apache Subversion 1.7.5 binaries set to active by default.
  • …..and more!

Not on the Latest Release Channel? Expect to see the uberSVN Chimney House update in the Stable Release Channel within the next two weeks. We’ve had a great uptake on the Latest Release Channel so far – if you’re an uberSVN user who wants to make your voice heard, then head over to our blog announcement to find out more.

But it hasn’t all been about uberSVN, we’re pleased to announce that registration for Subversion Live 2012 will be opening shortly!

After getting a great response from the Apache Subversion community in 2011, this year’s conference series is bigger and better than ever, with events taking place in San Francisco (October 10th & 11th) Greenwich, Connecticut: (October 16th & 17th) and London (October 23rd & 24th).

This year’s sessions will include:

  • What’s coming in 1.8
  • Merge & Performance Improvements
  • Hook Scripts
  • Branching & Merging Best Practices

We look forward to meeting up with the Apache Subversion community later this year! In the meantime, be sure to follow @WANdisco and @uberSVN for all the latest conference news.

If you can’t wait until the conference for your Subversion training, we’ve just announced another set of free SVN training webinars for the Apache Subversion community. After receiving lots of feedback, we’ve added another one hour course on branching and merging, alongside plenty of other webinar goodness:

Finally, fancy winning an iPad or a Kindle Fire? You may remember we announced the 2012 Worldwide Developer Survey last month. The survey will help us to build a picture of the developer’s perspective on software development, and trends in the software change and configuration control management tools market. We already announced that, at the end of the Worldwide Developer Survey we’ll make the results available to everyone who took part but we’ve been so pleased with the response that we’re also entering all respondents into a prize draw. The top prize will be an iPad, with two lucky runners-up receiving a Kindle Fire. If you haven’t completed the survey, make sure you send us your answers before 13th July 2012 to be in with a chance of winning an iPad or Kindle Fire.

Good luck!

WANdisco Announces Free Webinars for SVN Community

We hope you’re enjoying our bi-weekly free Subversion webinars! Thank you to everyone who has attended and sent us feedback on what they enjoyed, and what they’d like to see more of. Based on your feedback, we’ve devised another set of free training webinars for the Subversion community.

Here’s what’s coming up over the next couple of months (don’t forget, it’s free to register for any of our Apache Subversion webinars):

1) Hidden Subversion – get ahead of the game, as we share some tricks and techniques that many Subversion users aren’t even aware of.

2) Locking – we cover the Subversion Lock command in detail, including:

  • What is a lock?
  • How do you lock and unlock files?
  • Best practices for avoiding lock conflicts

3) Using Repository Browsers – drill down into the functionality of the Repo Browser, in this one-hour course.

4) Subversion Difference Command – get an overview of the various ways Subversion can compare files and generate meaningful reports.

5) Hook Scripts – these server-side executables can be used for a variety of tasks, including:

  • Automatic email notifications
  • Checkin content validation
  • Automatic backup
  • Specific access control

6) Introduction to uberSVN – an introductory webinar for uberSVN, the open ALM platform for Apache Subversion that’s easy to install, easy to use and easy to extend. This webinar will cover uberSVN’s core capabilities, including:

  • Installation and setup
  • Simplified repository creation and management
  • Team and user administration
  • Social coding capabilities
  • Extendibility with your favorite ALM tools

7) Access Control option with Subversion – need to control access to Apache Subversion repo information, but not sure which option is right for you? This session will weigh up the pros and cons of:

  • Subversion Access Control
  • Hook Scripts
  • uberSVN
  • …and more!

8 ) Branching and Merging – get an intro to the basic concepts of branching and merging, including when to perform a merge and create a branch, the different merge types, and some all-important best practices.

9) Subversion Properties – everything you need to know about SVN Properties! This one hour course will cover:

  • Defining properties
  • Property and “Standards and Procedures”
  • Property name rules
  • Automatic Properties
  • Recursively defining properties
  • ….and more!

Places are limited, so register now to avoid disappointment! And don’t forget to Contact Us if you have any comments, questions or suggestions for future webinars!

Intro to Pre-Commit Hook Scripts

Hook scripts are executable programs that Apache Subversion users can configure to be triggered by a specific repository event.

When you install Subversion, a ‘hook’ directory is created automatically that contains templates of all the available hook scripts. These .tmpl files contain info about that particular hook script, alongside details on the data that’s passed from Subversion when the hook script is executed.

One hook script is the pre-commit hook script, which executes when a commit transaction happens, but before any changes are applied to the repository. With pre-commit hook scripts, Subversion passes two pieces of information to the hook script: the name of the repository and a uniquely generated name or code for the transaction being committed.

A Basic Pre-Commit Hook Script

Hook scripts work by either exiting with a ‘0,’ which allows the transaction to happen, or by exiting with a ‘1’ which blocks all commits. In this basic example, we’ll show how the ‘exit 1’ command can be used to prevent all transactions.

Locate the pre-commit hook script in the hook directory.

Open the file and replace the text with:

exit 1

This will block all commits, from all users. When you try and commit, you should see a similar message to the one below:

Need more info?

A free replay of our ‘All About Hook Scripts’ webinar is available now. This webinar offers further examples of hook scripts, including start-commit, pre-revproper-change, and pre- and post-lock hook scripts.

Subversion Live: Back for 2012

We’re pleased to announce that, after getting a great response from the Apache Subversion community in 2011, Subversion Live is back for 2012!

Last year, Subversion Live brought the Apache Subversion community sessions covering everything from SVN’s future, to expert-led best practices workshops focused on getting the most out of Subversion, and a unique ‘Roundtable with the Committers’ session.

This year’s conference will take place in San Francisco, Greenwich and London during October. The core Apache Subversion committers will be in attendance, including director of the Apache Software Foundation, Greg Stein, and Apache Subversion Release Manager Hyrum Wright.

Confirmed sessions include:

  • What’s coming in 1.8 with Hyrum Wright, Stefan Fuhrmann, Julian Foad and Philip Martin
  • New Developments in SVN clients
  • Best Practices for Large SVN Deployments
  • Subversion Server Tuning Demo
  • Merge & Performance Improvements
  • Branching & Merging Best Practices
  • Hook Scripts
  • …and more!

Registration for Subversion Live will be opening soon! Be sure to follow @WANdisco and @uberSVN for all the latest, breaking news on Subversion Live 2012.

An Introduction to Subversion Hook Scripts on Windows

So you recently started running Subversion on Windows? You’re keen to unlock the power of hook scripts but don’t know where to start? Well dear reader, you can start right here…

Subversion hook script?

In a nutshell, it’s a program that performs an action which is triggered by a specified repository event. You can think of hook scripts as Subversion’s tool chest for setting up tighter control of a repository or integration with third-party applications, such as auto-closing tickets in a defect tracker when someone commits a change with “Fixes #123” in the log, or triggering builds in a continuous integration system. The most common and powerful hook scripts are server side, although it’s also possible to run client side hook scripts.

Server side hook scripts usually have the permissions of the web server, which gives them power and flexibility, being able to affect other repositories on the server – of course the flip side to this power is the risk that a badly designed hook could slow the server to a crawl or in extreme cases, corrupt the repository.

What can hook scripts do?

  • Report on events, such as emailing alerts when a commit occurs, sending a report on the commit to a third-party.
  • Test for a pre-condition before allowing a commit to occur. For example, checking that a commit has been commented, or follows coding guidelines.
  • Block certain actions. Maybe prevent a commit that contains multi-gigabyte files that could block other SVN traffic for hours, or prevent locks from being stolen.

What hook scripts can’t (shouldn’t) do

  • Hook scripts shouldn’t modify files being committed. Right now, if a hook script actually changed a commit transaction, there’s no way of communicating the change back to the client. So while it might be tempting to write a script that automatically corrects errors or applies positive changes to a committed file, it will result in two different versions of the file in the same revision one version written to the repository and another in the user’s cache. The result of this loss of consistency can be as horrible as it is unpredictable.

Where are the hook scripts located?

When a new repository is created, a hooks subdirectory is included, e.g. if you create a repository called chancode, hooks will live in the /repositories/chancode/hooks/ directory. By default a non executable template (.tmpl) for each type of hook script is automatically created with the directory.


Hook types

  • Start-commit Invoked before a transaction is created, pre-pre-commit, if you will. Commonly used to check if a user has sufficient privileges to perform a commit.
  • pre-commit / post-commit Invoked before or after a commit is completed.
  • pre-revprop-change / post-revprop-change Invoked before or after a revision propertly is added, modified or deleted.
  • pre-lock / post-lock Invoked when a user attempts to lock a path or after a lock has been created.
  • pre-unlock / post-unlock Invoked when a user attempts to destroy an exclusive lock, or immediately after the lock’s destruction.

There’s a good source of pre-written scripts available online, although the vast majority have been written for Unix/Linux, so aren’t immediately usable on Windows. Hooks can be written in anything, although cross-platform languages like Perl, Python and Ruby are quite popular. For simple scripts, it’s possible to use Windows’ plain old batch scripting.

Testing the water

We’ll do a simple test to show a hook script in action. We’ll introduce a pre-commit hook that checks for a log message that is n characters long – in this case, at least 6 characters.

  1. On your Windows Subversion/uberSVN server navigate your way to the hooks directory in your repository.
    i.e. C:\Program Files (x86)\WANdisco\uberSVN\repositories\chancode\hooks
  2. Open the pre-commit.tmpl file – you’ll recall that this is the script that gets triggered before a commit is completed.
  3. The template file contains lots of useful information, as well as an example script that does exactly what we’re going to do, unfortunately it’s aimed at the Unix/Linux /bin/sh interpreter, so we can’t use it for Windows without a rewrite.
  4. Delete all the contents of the file and copy in the following Windows batch scripting:
    @echo off  
     :: Stops commits that don't include a log message of at least 6 characters.        
     @echo off  
     rem Subversion sends through the repository path and transaction id  
     set REPOS=%1  
     set TXN=%2           
     svnlook log %REPOS% -t %TXN% | findstr ...... > nul  
     if %errorlevel% gtr 0 (goto err) else exit 0  
     echo --------------------------------------------------------------------------- 1>&2   
     echo Your commit has been blocked because it didn't include a log message. 1>&2  
     echo Do the commit again, this time with a log message that describes your changes. 1>&2
     echo --------------------------------------------------------------------------- 1>&2  
     exit 1    

    The script uses Svnlook, the incredibly useful command line tool to examine the commit transaction’s log message, then calls upon the findstr command to look for a string of at least 6 characters – the length of the minimum message length is set by the number of “.” characters after the findstr command.

  5. Save the file so that it can be executable. Windows supports .exe or .bat files.
  6. Testing time. Make an arbitrary change in a file, commit the change with a log message that is either blank or contains fewer than 6 characters. You’ll get the following error message:

    Tortoise 01

  7. Repeat the commit with the necessary number of characters, the commit will then succeed.
  8. Of course, this is a super-simple example. Lazy developers soon learn to leave comments along the lines of ‘update update update’ or ‘blah blah blah.’ You can use more complex scripts for better checking.

Parting Tips

Debugging and troubleshooting hook problems is notoriously difficult as there’s no formal error logging. These points are worth keeping in mind when setting up hook scripts.

  • If you’re completely stuck when trying to convert a hook script for use with Windows, remember there’s always Cygwin, a set of tools for running Linux tools on Windows, which will let you run many Linux scripts on Windows without the need to rewrite them.
  • Empty environment problem – Subversion executes hook programs with no environment variables. That’s a good security precaution but often leaves administrators pulling their hair out with frustration when a manually tested hook script absolutely refuses to work with Subversion. So ensure that any necessary environment variables are set in your hook script and/or use absolute paths.