Source code file content

Revision: 5 (of 5)

subversion hooks
» Project Revision History

» Checkout URL

sources / blog-sources / subversion / hook-repository-locker.rb

Size: 1897 bytes, 1 line
# This start-commit hook verifies that the repository is open
# $HeadURL: http://svn.jyskebank.dk/repos/JB/TI/jb.itu.ti.subversion-tailoring/trunk/jb-scripts/hook-repository-locker.rb $
# $LastChangedRevision: 9788 $
#
# Written by Jesper Skov <jskov@jyskebank.dk>
# Copyright 2009 Jyske Bank
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

require "optparse"

LOCK_NAME = "jb.lock"

options = {}
ARGV.options do |opts|
  opts.banner = "Usage: repository-locker.rb [options]"
  opts.on("-u=username", "--user=username", "Username wanting to commit") do | username |
    options[:username] = username.downcase()
  end
  opts.def_option("-r=repository", "--repository=repository", "Repository for commit") do | repository |
    options[:repository] = repository
  end
  opts.on_tail("-h", "--help", "Show this message") do
    puts(opts)
    exit(0)
  end
  opts.parse!
end

if not (options[:username] and options[:repository])
  $stderr.puts("Must specify username and repository")
  exit(1)
end

lock_file = File.join(options[:repository], LOCK_NAME)
if File.exist?(lock_file)
  $stderr.puts("-----------------------")
  $stderr.puts("Repository locked since #{File.stat(lock_file).mtime}")
  $stderr.puts(File.read(lock_file))
  exit(1)
end

exit(0)
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20100127.c5638cb)
 
 
loading
Please Confirm