Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- repo_path = ARGV[0]
- transaction = ARGV[1]
- svnlook = '/usr/bin/svnlook'
- mysql = '/usr/bin/mysql'
- commit_log = `#{svnlook} log #{repo_path} -t #{transaction}`
- if (commit_log == nil || commit_log.length < 2)
- STDERR.puts("Log message cannot be empty.")
- exit(1)
- end
- if (commit_log =~ /^(Issue)\s#(\d+)\:\s(Added|Removed|Fixed|Changed|Updated)\:\s[A-ZĂĂĂ].*\./)
- issue_number = $2
- sql = "SELECT COUNT(*) AS result FROM issues I INNER JOIN issue_statuses S ON S.id = I.status_id WHERE S.is_closed = 0 AND I.id = #{issue_number};"
- redmine_issue_open = `#{mysql} --database=... --user=... --password=... -e "#{sql};" --skip-column-names`.strip()
- if (redmine_issue_open.eql?("0"))
- STDERR.puts("Redmine issue #{issue_number} is not in an open state.")
- exit(1)
- end
- else
- STDERR.puts("You didn't specify a Redmine issue number on the first line, e.g.:
- Issue #1234 ...")
- exit(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement