chore: remove deprecated files + add excluded patterns for deploy (#3589)
15
control
|
@ -1,15 +0,0 @@
|
|||
Version: 2.32
|
||||
Section: text
|
||||
Ietf: critical
|
||||
Priority: optional
|
||||
Maintainer: Robert Sparks <rjsparks@nostrum.com>
|
||||
Package: ietfdb
|
||||
Architecture: any
|
||||
Depends: django python
|
||||
Category: support
|
||||
Url: https://datatracker.ietf.org/
|
||||
Repository: https://svn.tools.ietf.org/svn/tools/ietfdb/branch/2.00/
|
||||
Description: IETF Database
|
||||
The IETF Database holds information related to documents, authors,
|
||||
positions and messages within the IETF. It currently consists of
|
||||
a MySql backend and a Django frontend, and some legacy perl scripts.
|
|
@ -1,150 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# POST-COMMIT HOOK
|
||||
#
|
||||
# The post-commit hook is invoked after a commit. Subversion runs
|
||||
# this hook by invoking a program (script, executable, binary, etc.)
|
||||
# named 'post-commit' (for which this file is a template) with the
|
||||
# following ordered arguments:
|
||||
#
|
||||
# [1] REPOS-PATH (the path to this repository)
|
||||
# [2] REV (the number of the revision just committed)
|
||||
#
|
||||
# The default working directory for the invocation is undefined, so
|
||||
# the program should set one explicitly if it cares.
|
||||
#
|
||||
# Because the commit has already completed and cannot be undone,
|
||||
# the exit code of the hook program is ignored. The hook program
|
||||
# can use the 'svnlook' utility to help it examine the
|
||||
# newly-committed tree.
|
||||
#
|
||||
# On a Unix system, the normal procedure is to have 'post-commit'
|
||||
# invoke other programs to do the real work, though it may do the
|
||||
# work itself too.
|
||||
#
|
||||
# Note that 'post-commit' must be executable by the user(s) who will
|
||||
# invoke it (typically the user httpd runs as), and that user must
|
||||
# have filesystem-level permission to access the repository.
|
||||
#
|
||||
# On a Windows system, you should name the hook program
|
||||
# 'post-commit.bat' or 'post-commit.exe',
|
||||
# but the basic idea is the same.
|
||||
#
|
||||
# The hook program typically does not inherit the environment of
|
||||
# its parent process. For example, a common problem is for the
|
||||
# PATH environment variable to not be set to its usual value, so
|
||||
# that subprograms fail to launch unless invoked via absolute path.
|
||||
# If you're having unexpected problems with a hook program, the
|
||||
# culprit may be unusual (or missing) environment variables.
|
||||
#
|
||||
# Here is an example hook script, for a Unix /bin/sh interpreter.
|
||||
# For more examples and pre-written hooks, see those in
|
||||
# the Subversion repository at
|
||||
# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and
|
||||
# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/
|
||||
|
||||
# Log everything for debug, otherwise use explicit logging (further down)
|
||||
#[ "$LOGGING" ] || LOGGING=1 { exec $0 "$@" 2>&1 | logger -p user.info -t "commit"; }
|
||||
|
||||
logger -p user.info -t "hook" "${0##*/} $*"
|
||||
|
||||
repo="$1"
|
||||
rev="$2"
|
||||
|
||||
# Settings
|
||||
program=${0##*/}
|
||||
progdir=${0%/*}
|
||||
thishost="$(/bin/hostname)"
|
||||
thishost="${thishost%%.*}"
|
||||
svnpath="/a/svn/tools/ietfdb"
|
||||
trac="/a/www/www6s/trac/ietfdb/"
|
||||
svn_url="https://svn.ietf.org/svn/tools/ietfdb"
|
||||
trac_url="https://trac.ietf.org/trac/ietfdb"
|
||||
|
||||
# Do a local backup
|
||||
#relpath=${repo#$svnpath/}
|
||||
#bckpath="$svnpath/.backup/$thishost/$relpath"
|
||||
#[ -d $bckpath ] || mkdir -p $bckpath
|
||||
#/usr/bin/svn-fast-backup -q $repo $bckpath
|
||||
|
||||
# Inform trac about a new changeset
|
||||
trac-admin $trac changeset added ietfdb $rev
|
||||
|
||||
committer=$(/usr/bin/svnlook author $repo -r $rev)
|
||||
comments=$(/usr/bin/svnlook log $repo -r $rev)
|
||||
files=$(/usr/bin/svnlook changed $repo -r $rev)
|
||||
|
||||
dirs=$(/usr/bin/svnlook dirs-changed -r$rev $repo)
|
||||
logger -p user.info -t "commit" "dirs '$dirs'"
|
||||
|
||||
# Look for 'requirements.txt' above the committed change. Looking only for
|
||||
# filechanges, not for dirchanges, filters out commits which are just tree
|
||||
# copies, such as when creating new dev branches for the code sprint.
|
||||
branch=$($progdir/svnfind --filechange --dirpath $repo $rev "requirements.txt")
|
||||
|
||||
if [ -n "$branch" ]; then
|
||||
# Update trac tickets
|
||||
/usr/bin/python2.7 $progdir/trac-post-commit-hook -p "$trac" -r "$rev" 2>&1 | logger -t "svn post-commit" -p "user.error" -i
|
||||
|
||||
# Notify buildbot
|
||||
# filenames=$(/usr/bin/svnlook changed $repo -r $rev | sed -r -e 's/^ *[^ ]+ +//' -e "s|$branch/||")
|
||||
# # Notify local build master
|
||||
/usr/local/bin/buildbot sendchange \
|
||||
# --master="zinfandel.tools.ietf.org:9989" --auth="ietfdb:BRiR6XcT7x3$" \
|
||||
# --who="$committer" --repository="https://svn.tools.ietf.org/svn/tools/ietfdb/" \
|
||||
# --vc=svn --branch="$branch" --revision=$rev \
|
||||
# --revlink="https://trac.tools.ietf.org/tools/ietfdb/changeset/$rev" \
|
||||
# --comments="$comments" $filenames > /dev/null
|
||||
# Notify remote build master (must use the remote buildbot binary to match version)
|
||||
# ssh henrik@dunkelfelder.tools.ietf.org /usr/local/bin/buildbot sendchange \
|
||||
# --master="dunkelfelder.tools.ietf.org:9989" --auth="ietfdb:BRiR6XcT7x3$" \
|
||||
# --who="$committer" --repository="https://svn.tools.ietf.org/svn/tools/ietfdb/" \
|
||||
# --vc=svn --branch="$branch" --revision=$rev \
|
||||
# --revlink="https://trac.tools.ietf.org/tools/ietfdb/changeset/$rev" \
|
||||
# --comments="$comments" $filenames > /dev/null
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# Log the commit
|
||||
logger -p user.info -t "commit" "$relpath r$rev $committer"
|
||||
logger -p user.info -t "commit" "branch: $branch"
|
||||
|
||||
# Notify committers
|
||||
|
||||
if [[ $comments =~ ready.(for|to).merge ]]; then
|
||||
mail $(< $progdir/notify-email.txt) -s "[svnhook] Svn commit ready for merge: $relpath | $committer: ${comments:0:42}..." <<-EOF | logger -p user.info -t "ready for merge email"
|
||||
|
||||
$committer has a commit ready for merge:
|
||||
$relpath/$branch [$rev]:
|
||||
|
||||
$comments
|
||||
|
||||
Svn: $svn_url/$branch
|
||||
Trac: $trac_url/changeset/$rev/$branch
|
||||
|
||||
Files:
|
||||
|
||||
$files
|
||||
|
||||
EOF
|
||||
|
||||
else
|
||||
|
||||
mail $(< $progdir/notify-email.txt) -s "[svnhook] Svn commit to $relpath | $committer: ${comments:0:42}..." <<-EOF | logger -p user.info -t "commit email"
|
||||
|
||||
$committer has made a new SVN commit in
|
||||
$relpath/$branch [$rev]:
|
||||
|
||||
$comments
|
||||
|
||||
Svn: $svn_url/$branch
|
||||
Trac: $trac_url/changeset/$rev/$branch
|
||||
|
||||
Files:
|
||||
|
||||
$files
|
||||
|
||||
EOF
|
||||
|
||||
fi
|
|
@ -1,69 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Prevents some SHA-1 collisions to be commited
|
||||
# Test fo the 320 byte prefix found on https://shattered.io/
|
||||
# If the files are committed in the same transaction, svnlook
|
||||
# will error out itself due to the apparent corruption in the
|
||||
# candidate revision
|
||||
|
||||
REPOS="$1"
|
||||
TXN="$2"
|
||||
SVNLOOK=/usr/bin/svnlook
|
||||
YEAR=$(date +%Y)
|
||||
|
||||
$SVNLOOK changed -t "$TXN" "$REPOS"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "svnlook failed, possible SHA-1 collision" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
FILES=$($SVNLOOK changed -t "$TXN" "$REPOS" | grep -Ev '^D ' | /usr/bin/awk '{print $2}')
|
||||
for FILE in $FILES; do
|
||||
if [ -f $FILE ]; then
|
||||
# Check against known sha-1 collision attack. Someone committing 2 different files with this
|
||||
# known hash collision could otherwise break the repository.
|
||||
PREFIX=$($SVNLOOK cat -t "$TXN" "$REPOS" "$FILE" | head -c320 | /usr/bin/sha1sum | cut -c-40)
|
||||
if [ "$PREFIX" = 'f92d74e3874587aaf443d1db961d4e26dde13e9c' ]; then
|
||||
echo "known SHA-1 collision rejected" >&2
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# Verify copyright year
|
||||
if [[ $FILE == */ietf/*.py || -s $FILE ]]; then
|
||||
$SVNLOOK cat -t "$TXN" "$REPOS" "$FILE" | head -n 3 | grep -q "Copyright .*IETF Trust .*$YEAR.*" || {
|
||||
echo "
|
||||
Bad or missing copyright note in $FILE.
|
||||
Expected 'Copyright The IETF Trust ... $YEAR, All Rights Reserved',
|
||||
(or similar) at the start of the file.
|
||||
|
||||
For bulk correction of copyright statements, try bin/check-copyright with
|
||||
patching:
|
||||
|
||||
\$ bin/check-copyright -p \$(svn st | cut -c 9- | grep '\.py\$' ) | patch -p0
|
||||
|
||||
" >&2
|
||||
exit 3
|
||||
}
|
||||
fi
|
||||
fi
|
||||
done
|
|
@ -1,72 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# PRE-REVPROP-CHANGE HOOK
|
||||
#
|
||||
# The pre-revprop-change hook is invoked before a revision property
|
||||
# is added, modified or deleted. Subversion runs this hook by invoking
|
||||
# a program (script, executable, binary, etc.) named 'pre-revprop-change'
|
||||
# (for which this file is a template), with the following ordered
|
||||
# arguments:
|
||||
#
|
||||
# [1] REPOS-PATH (the path to this repository)
|
||||
# [2] REVISION (the revision being tweaked)
|
||||
# [3] USER (the username of the person tweaking the property)
|
||||
# [4] PROPNAME (the property being set on the revision)
|
||||
# [5] ACTION (the property is being 'A'dded, 'M'odified, or 'D'eleted)
|
||||
#
|
||||
# [STDIN] PROPVAL ** the new property value is passed via STDIN.
|
||||
#
|
||||
# If the hook program exits with success, the propchange happens; but
|
||||
# if it exits with failure (non-zero), the propchange doesn't happen.
|
||||
# The hook program can use the 'svnlook' utility to examine the
|
||||
# existing value of the revision property.
|
||||
#
|
||||
# WARNING: unlike other hooks, this hook MUST exist for revision
|
||||
# properties to be changed. If the hook does not exist, Subversion
|
||||
# will behave as if the hook were present, but failed. The reason
|
||||
# for this is that revision properties are UNVERSIONED, meaning that
|
||||
# a successful propchange is destructive; the old value is gone
|
||||
# forever. We recommend the hook back up the old value somewhere.
|
||||
#
|
||||
# On a Unix system, the normal procedure is to have 'pre-revprop-change'
|
||||
# invoke other programs to do the real work, though it may do the
|
||||
# work itself too.
|
||||
#
|
||||
# Note that 'pre-revprop-change' must be executable by the user(s) who will
|
||||
# invoke it (typically the user httpd runs as), and that user must
|
||||
# have filesystem-level permission to access the repository.
|
||||
#
|
||||
# On a Windows system, you should name the hook program
|
||||
# 'pre-revprop-change.bat' or 'pre-revprop-change.exe',
|
||||
# but the basic idea is the same.
|
||||
#
|
||||
# The hook program typically does not inherit the environment of
|
||||
# its parent process. For example, a common problem is for the
|
||||
# PATH environment variable to not be set to its usual value, so
|
||||
# that subprograms fail to launch unless invoked via absolute path.
|
||||
# If you're having unexpected problems with a hook program, the
|
||||
# culprit may be unusual (or missing) environment variables.
|
||||
#
|
||||
# Here is an example hook script, for a Unix /bin/sh interpreter.
|
||||
# For more examples and pre-written hooks, see those in
|
||||
# the Subversion repository at
|
||||
# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and
|
||||
# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/
|
||||
|
||||
|
||||
REPOS="$1"
|
||||
REV="$2"
|
||||
USER="$3"
|
||||
PROPNAME="$4"
|
||||
ACTION="$5"
|
||||
|
||||
if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi
|
||||
if [ "$ACTION" = "M" -a "${PROPNAME%:*}" = "test" ]; then exit 0; fi
|
||||
if [ "$ACTION" = "A" -a "${PROPNAME%:*}" = "test" ]; then exit 0; fi
|
||||
|
||||
echo "
|
||||
Changing revision properties other than svn:log and test:* is prohibited.
|
||||
Got ACTION: $ACTION, PROPNAME: $PROPNAME
|
||||
" >&2
|
||||
|
||||
exit 1
|
159
hooks/svnfind
|
@ -1,159 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- python -*-
|
||||
|
||||
"""
|
||||
NAME
|
||||
%(program)s - find a filename close to a given a SVN repository commit
|
||||
|
||||
SYNOPSIS
|
||||
%(program)s [OPTIONS] REPO REV NAME
|
||||
|
||||
DESCRIPTION
|
||||
Supposing we have a subversion repository containing a trunk and
|
||||
various branches. Given the repository url and the revision number of
|
||||
a commit, what is the top of the branch? $(program)s attempts to
|
||||
answer this by letting you search for a specific file name which is
|
||||
assumed to be unique within the branch and be situated at the top of
|
||||
the branch subtree.
|
||||
|
||||
%(options)s
|
||||
|
||||
AUTHOR
|
||||
Written by Henrik Levkowetz, <henrik@zinfandel.tools.ietf.org>
|
||||
|
||||
COPYRIGHT
|
||||
Copyright 2015 Henrik Levkowetz
|
||||
|
||||
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 2 of the License, or (at
|
||||
your option) any later version. There is NO WARRANTY; not even the
|
||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
"""
|
||||
|
||||
import sys, os.path, getopt, re
|
||||
|
||||
version = "0.13"
|
||||
program = os.path.basename(sys.argv[0])
|
||||
progdir = os.path.dirname(sys.argv[0])
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Parse options
|
||||
|
||||
options = ""
|
||||
for line in re.findall("\n +(if|elif) +opt in \[(.+)\]:\s+#(.+)\n", open(sys.argv[0]).read()):
|
||||
if not options:
|
||||
options += "OPTIONS\n"
|
||||
options += " %-16s %s\n" % (line[1].replace('"', ''), line[2])
|
||||
options = options.strip()
|
||||
|
||||
# with ' < 1:' on the next line, this is a no-op:
|
||||
if len(sys.argv) <= 1:
|
||||
help()
|
||||
|
||||
try:
|
||||
opts, files = getopt.gnu_getopt(sys.argv[1:], "dfDhv", ["dirchange", "filechange", "dirpath", "help", "version",])
|
||||
except Exception, e:
|
||||
print "%s: %s" % (program, e)
|
||||
sys.exit(1)
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Handle options
|
||||
|
||||
# set default values, if any
|
||||
opt_dirpath = False
|
||||
opt_dirchange = False
|
||||
opt_filechange = False
|
||||
opt_verbose = False
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def help(msg=None, err=0):
|
||||
if msg:
|
||||
print(msg+'\n')
|
||||
print(__doc__ % globals())
|
||||
sys.exit(err)
|
||||
|
||||
# handle individual options
|
||||
for opt, value in opts:
|
||||
if opt in ["-h", "--help"]: # Output this help, then exit
|
||||
help()
|
||||
elif opt in ["-v", "--version"]: # Output version information, then exit
|
||||
print program, version
|
||||
sys.exit(0)
|
||||
elif opt in ["-d", "--dirchange"]: # Look only for directory changes
|
||||
opt_dirchange = True
|
||||
elif opt in ["-f", "--filechange"]: #Look only for file changes
|
||||
opt_filechange = True
|
||||
elif opt in ["-D", "--dirpath"]: # Output the directory path, not the file path
|
||||
opt_dirpath = True
|
||||
|
||||
# if neither filechange nor dirchange have been specified, look for both
|
||||
if not opt_filechange and not opt_dirchange:
|
||||
opt_filechange = True
|
||||
opt_dirchange = True
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def help(msg=None, err=0):
|
||||
if msg:
|
||||
print(msg+'\n')
|
||||
print(__doc__ % globals())
|
||||
sys.exit(err)
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def say(s):
|
||||
sys.stderr.write("%s\n" % (s))
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def note(s):
|
||||
if opt_verbose:
|
||||
sys.stderr.write("%s\n" % (s))
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def die(s, error=1):
|
||||
sys.stderr.write("\n%s: Error: %s\n\n" % (program, s))
|
||||
sys.exit(error)
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Bad args
|
||||
|
||||
if len(files) < 3:
|
||||
help("Not enogh arguments\n\nExpected %s REPO REV NAME" %program, 1)
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# The program itself
|
||||
|
||||
import pysvn
|
||||
#import debug
|
||||
|
||||
repo, rev, name = files
|
||||
|
||||
changeset = pysvn.Transaction(repo, rev, True)
|
||||
changed = changeset.changed()
|
||||
|
||||
# Each dictionary entry is a tuple, with elements as follows:
|
||||
CHG_ACTION, CHG_KIND, CHG_TEXTMOD, CHG_PROPMOD = range(4)
|
||||
|
||||
node = None
|
||||
for key in changed:
|
||||
if opt_dirchange and changed[key][CHG_KIND] == pysvn.node_kind.dir:
|
||||
node = key
|
||||
break
|
||||
if opt_filechange and changed[key][CHG_KIND] == pysvn.node_kind.file:
|
||||
node = '/'.join(key.split('/')[:-1])
|
||||
break
|
||||
|
||||
while node:
|
||||
#debug.show('node')
|
||||
list = changeset.list(node)
|
||||
if name in list:
|
||||
if opt_dirpath:
|
||||
print node
|
||||
else:
|
||||
sys.stdout.write(node)
|
||||
sys.stdout.write('/')
|
||||
sys.stdout.write(name)
|
||||
sys.stdout.write('\n')
|
||||
break
|
||||
node = '/'.join(node.split('/')[:-1])
|
|
@ -1,245 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# trac-post-commit-hook
|
||||
# ----------------------------------------------------------------------------
|
||||
# Copyright (c) 2004 Stephen Hansen
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
# IN THE SOFTWARE.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# This Subversion post-commit hook script is meant to interface to the
|
||||
# Trac (http://www.edgewall.com/products/trac/) issue tracking/wiki/etc
|
||||
# system.
|
||||
#
|
||||
# It should be called from the 'post-commit' script in Subversion, such as
|
||||
# via:
|
||||
#
|
||||
# REPOS="$1"
|
||||
# REV="$2"
|
||||
# TRAC_ENV="/path/to/tracenv"
|
||||
#
|
||||
# /usr/bin/python /usr/local/src/trac/contrib/trac-post-commit-hook \
|
||||
# -p "$TRAC_ENV" -r "$REV"
|
||||
#
|
||||
# (all the other arguments are now deprecated and not needed anymore)
|
||||
#
|
||||
# It searches commit messages for text in the form of:
|
||||
# command #1
|
||||
# command #1, #2
|
||||
# command #1 & #2
|
||||
# command #1 and #2
|
||||
#
|
||||
# Instead of the short-hand syntax "#1", "ticket:1" can be used as well, e.g.:
|
||||
# command ticket:1
|
||||
# command ticket:1, ticket:2
|
||||
# command ticket:1 & ticket:2
|
||||
# command ticket:1 and ticket:2
|
||||
#
|
||||
# In addition, the ':' character can be omitted and issue or bug can be used
|
||||
# instead of ticket.
|
||||
#
|
||||
# You can have more then one command in a message. The following commands
|
||||
# are supported. There is more then one spelling for each command, to make
|
||||
# this as user-friendly as possible.
|
||||
#
|
||||
# close, closed, closes, fix, fixed, fixes
|
||||
# The specified issue numbers are closed with the contents of this
|
||||
# commit message being added to it.
|
||||
# references, refs, addresses, re, see
|
||||
# The specified issue numbers are left in their current status, but
|
||||
# the contents of this commit message are added to their notes.
|
||||
#
|
||||
# A fairly complicated example of what you can do is with a commit message
|
||||
# of:
|
||||
#
|
||||
# Changed blah and foo to do this or that. Fixes #10 and #12, and refs #12.
|
||||
#
|
||||
# This will close #10 and #12, and add a note to #12.
|
||||
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from optparse import OptionParser, OptionGroup
|
||||
import syslog
|
||||
|
||||
syslog.openlog("post-commit-trac", syslog.LOG_PID, syslog.LOG_USER)
|
||||
log = syslog.syslog
|
||||
|
||||
parser = OptionParser()
|
||||
depr = '(not used anymore)'
|
||||
parser.add_option('-e', '--require-envelope', dest='envelope', default='',
|
||||
help="""
|
||||
Require commands to be enclosed in an envelope.
|
||||
If -e[], then commands must be in the form of [closes #4].
|
||||
Must be two characters.""")
|
||||
parser.add_option('-p', '--project', dest='project',
|
||||
help='Path to the Trac project.')
|
||||
parser.add_option('-r', '--revision', dest='rev',
|
||||
help='Repository revision number.')
|
||||
parser.add_option('-a', '--action', dest='action', default=None, help='The action to take on a ticket (default: none)')
|
||||
parser.add_option('-R', '--repository-name', dest='repo_name', default=None, help='Which repository to look in, if the trac instance has multiple repositories')
|
||||
|
||||
group = OptionGroup(parser, "DEPRECATED OPTIONS")
|
||||
group.add_option('-u', '--user', dest='user',
|
||||
help='The user who is responsible for this action '+depr)
|
||||
group.add_option('-m', '--msg', dest='msg',
|
||||
help='The log message to search '+depr)
|
||||
group.add_option('-c', '--encoding', dest='encoding',
|
||||
help='The encoding used by the log message '+depr)
|
||||
group.add_option('-s', '--siteurl', dest='url',
|
||||
help=depr+' the base_url from trac.ini will always be used.')
|
||||
|
||||
parser.add_option_group(group)
|
||||
|
||||
(options, args) = parser.parse_args(sys.argv[1:])
|
||||
|
||||
if options.project and not 'PYTHON_EGG_CACHE' in os.environ:
|
||||
os.environ['PYTHON_EGG_CACHE'] = os.path.join(options.project, '.egg-cache')
|
||||
|
||||
from trac.env import open_environment
|
||||
from trac.ticket.notification import TicketNotifyEmail
|
||||
from trac.ticket import Ticket
|
||||
from trac.ticket.web_ui import TicketModule
|
||||
# TODO: move grouped_changelog_entries to model.py
|
||||
from trac.util.text import to_unicode
|
||||
from trac.util.datefmt import utc
|
||||
from trac.versioncontrol.api import NoSuchChangeset
|
||||
|
||||
ticket_prefix = '(?:#|(?:ticket|issue|bug)s?[: ]?#?)'
|
||||
ticket_reference = ticket_prefix + '[0-9]+'
|
||||
action_pattern = "(?:(?i)(?:fix(?: for| to)?|fixes|fixed|close|closes|completes|addresses|references|refs|re|relates to|related to|see|described in))"
|
||||
ticket_command = (r'(?P<action>%s).?(?P<ticket>%s(?:(?:[, &]*|[, ]+and[ ]?)%s)*)' % (action_pattern, ticket_reference, ticket_reference))
|
||||
|
||||
if options.envelope:
|
||||
ticket_command = r'\%s%s\%s' % (options.envelope[0], ticket_command,
|
||||
options.envelope[1])
|
||||
|
||||
command_re = re.compile(ticket_command)
|
||||
ticket_re = re.compile(ticket_prefix + '([0-9]+)')
|
||||
|
||||
class CommitHook:
|
||||
# _supported_cmds = {'close': '_cmdClose',
|
||||
# 'closed': '_cmdClose',
|
||||
# 'closes': '_cmdClose',
|
||||
# 'fix': '_cmdClose',
|
||||
# 'fixed': '_cmdClose',
|
||||
# 'fixes': '_cmdClose',
|
||||
# 'addresses': '_cmdRefs',
|
||||
# 're': '_cmdRefs',
|
||||
# 'references': '_cmdRefs',
|
||||
# 'refs': '_cmdRefs',
|
||||
# 'see': '_cmdRefs'}
|
||||
|
||||
_supported_cmds = {'fix': '_cmdClose',
|
||||
'fix for': '_cmdClose',
|
||||
'fix to': '_cmdClose',
|
||||
'fixes': '_cmdClose',
|
||||
'fixed': '_cmdClose',
|
||||
'close': '_cmdClose',
|
||||
'closes': '_cmdClose',
|
||||
'completes': '_cmdClose',
|
||||
|
||||
'addresses': '_cmdRefs',
|
||||
'described in': '_cmdRefs',
|
||||
'references': '_cmdRefs',
|
||||
'refs': '_cmdRefs',
|
||||
're': '_cmdRefs',
|
||||
'relates to': '_cmdRefs',
|
||||
'related to': '_cmdRefs',
|
||||
'see': '_cmdRefs',
|
||||
}
|
||||
|
||||
def __init__(self, project=options.project, author=options.user,
|
||||
rev=options.rev, url=options.url):
|
||||
self.env = open_environment(project)
|
||||
repos = self.env.get_repository(options.repo_name)
|
||||
repos.sync()
|
||||
|
||||
# Instead of bothering with the encoding, we'll use unicode data
|
||||
# as provided by the Trac versioncontrol API (#1310).
|
||||
try:
|
||||
chgset = repos.get_changeset(rev)
|
||||
except NoSuchChangeset:
|
||||
return # out of scope changesets are not cached
|
||||
self.author = chgset.author
|
||||
self.rev = rev
|
||||
self.msg = "From [%s]:\n\n%s" % (rev, chgset.message)
|
||||
self.now = datetime.now(utc)
|
||||
|
||||
cmd_groups = command_re.findall(self.msg)
|
||||
|
||||
tickets = {}
|
||||
for cmd, tkts in cmd_groups:
|
||||
funcname = CommitHook._supported_cmds.get(cmd.lower(), '')
|
||||
if funcname:
|
||||
for tkt_id in ticket_re.findall(tkts):
|
||||
func = getattr(self, funcname)
|
||||
tickets.setdefault(tkt_id, []).append(func)
|
||||
|
||||
for tkt_id, cmds in tickets.iteritems():
|
||||
try:
|
||||
fixes = False
|
||||
db = self.env.get_db_cnx()
|
||||
|
||||
ticket = Ticket(self.env, int(tkt_id), db)
|
||||
for cmd in cmds:
|
||||
if cmd == self._cmdClose:
|
||||
fixes = True
|
||||
cmd(ticket)
|
||||
|
||||
# determine sequence number...
|
||||
cnum = 0
|
||||
tm = TicketModule(self.env)
|
||||
for change in tm.grouped_changelog_entries(ticket, db):
|
||||
if change['permanent']:
|
||||
cnum += 1
|
||||
|
||||
if fixes:
|
||||
self.msg = "Fixed in [%s]:\n\n%s" % (rev, chgset.message)
|
||||
|
||||
log("Updating ticket #%s: %s" % (tkt_id, chgset.message))
|
||||
|
||||
ticket.save_changes(self.author, self.msg, self.now, db, cnum+1)
|
||||
db.commit()
|
||||
|
||||
tn = TicketNotifyEmail(self.env)
|
||||
tn.notify(ticket, newticket=0, modtime=self.now)
|
||||
except Exception, e:
|
||||
# import traceback
|
||||
# traceback.print_exc(file=sys.stderr)
|
||||
print>>sys.stderr, 'Unexpected error while processing ticket ' \
|
||||
'ID %s: %s' % (tkt_id, e)
|
||||
|
||||
|
||||
def _cmdClose(self, ticket):
|
||||
ticket['status'] = 'closed'
|
||||
ticket['resolution'] = 'fixed'
|
||||
|
||||
def _cmdRefs(self, ticket):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 5:
|
||||
print "For usage: %s --help" % (sys.argv[0])
|
||||
print
|
||||
print "Note that the deprecated options will be removed in Trac 0.12."
|
||||
else:
|
||||
CommitHook()
|
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 6.1 KiB |
|
@ -1,82 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="100%" height="100%" viewBox="0 0 1024 250" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;">
|
||||
<g transform="matrix(1.39872,0,0,1.39872,-433.548,-258.273)">
|
||||
<text x="573px" y="304px" style="font-family:'SquadaOne-Regular', 'Squada One';font-size:96px;fill:url(#_Linear1);">DATATRACKER</text>
|
||||
</g>
|
||||
<g transform="matrix(1,0,0,1,0,-90)">
|
||||
<g transform="matrix(0.0384615,0,0,1,323.077,0)">
|
||||
<rect x="336" y="90" width="26" height="247" style="fill:url(#_Linear2);"/>
|
||||
</g>
|
||||
<g transform="matrix(0.0384615,0,0,1,324.077,0)">
|
||||
<rect x="336" y="90" width="26" height="247" style="fill:url(#_Linear3);"/>
|
||||
</g>
|
||||
</g>
|
||||
<g transform="matrix(0.60874,0,0,0.60874,-179.578,38.2694)">
|
||||
<g id="squares" transform="matrix(1,0,0,1,295,5)">
|
||||
<g transform="matrix(0.707107,-0.707107,0.707107,0.707107,-270.59,-94.37)">
|
||||
<rect x="77.53" y="317.2" width="48.94" height="48.94" style="fill:rgb(188,190,192);"/>
|
||||
</g>
|
||||
<g transform="matrix(0.707107,-0.707107,0.707107,0.707107,-151.08,194.17)">
|
||||
<rect x="485.59" y="317.2" width="48.94" height="48.94" style="fill:rgb(188,190,192);"/>
|
||||
</g>
|
||||
<g transform="matrix(0.707107,-0.707107,0.707107,0.707107,-246.72,-36.73)">
|
||||
<rect x="159.04" y="317.2" width="48.94" height="48.94" style="fill:rgb(188,190,192);"/>
|
||||
</g>
|
||||
<g transform="matrix(0.707107,-0.707107,0.707107,0.707107,-222.85,20.9)">
|
||||
<rect x="240.54" y="317.2" width="48.94" height="48.94" style="fill:rgb(188,190,192);"/>
|
||||
</g>
|
||||
<g transform="matrix(0.707107,-0.707107,0.707107,0.707107,-198.98,78.53)">
|
||||
<rect x="322.05" y="317.2" width="48.94" height="48.94" style="fill:rgb(188,190,192);"/>
|
||||
</g>
|
||||
<g transform="matrix(0.707107,-0.707107,0.707107,0.707107,-175.11,136.16)">
|
||||
<rect x="403.55" y="317.2" width="48.94" height="48.94" style="fill:rgb(188,190,192);"/>
|
||||
</g>
|
||||
<g transform="matrix(0.707107,-0.707107,0.707107,0.707107,-263.62,4.28)">
|
||||
<rect x="200.09" y="358.11" width="48.94" height="48.94" style="fill:rgb(188,190,192);"/>
|
||||
</g>
|
||||
<g transform="matrix(0.707107,-0.707107,0.707107,0.707107,-239.75,61.9)">
|
||||
<rect x="281.59" y="358.11" width="48.94" height="48.94" style="fill:rgb(188,190,192);"/>
|
||||
</g>
|
||||
<g transform="matrix(0.707107,-0.707107,0.707107,0.707107,-215.88,119.53)">
|
||||
<rect x="363.09" y="358.11" width="48.94" height="48.94" style="fill:rgb(188,190,192);"/>
|
||||
</g>
|
||||
<g transform="matrix(0.707107,-0.707107,0.707107,0.707107,-206.06,-19.57)">
|
||||
<rect x="200.09" y="276.7" width="48.94" height="48.94" style="fill:rgb(188,190,192);"/>
|
||||
</g>
|
||||
<g transform="matrix(0.707107,-0.707107,0.707107,0.707107,-182.19,38.06)">
|
||||
<rect x="281.59" y="276.7" width="48.94" height="48.94" style="fill:rgb(188,190,192);"/>
|
||||
</g>
|
||||
<g transform="matrix(0.707107,-0.707107,0.707107,0.707107,-158.32,95.69)">
|
||||
<rect x="363.09" y="276.7" width="48.94" height="48.94" style="fill:rgb(188,190,192);"/>
|
||||
</g>
|
||||
</g>
|
||||
<g id="line" transform="matrix(1,0,0,1,295,5)">
|
||||
<path d="M14.49,71.07L85.72,71.07L124.93,110.28L165.43,69.79L206.14,110.51L287.98,28.67L328.9,69.59L369.39,29.1L411.79,71.5L481.33,71.5L481.33,79.55L408.4,79.55L369.18,40.33L328.47,81.04L287.77,40.33L206.36,121.74L165.65,81.04L125.16,121.53L82.54,78.92L14.06,78.92L14.49,71.07Z" style="fill:rgb(255,210,79);fill-rule:nonzero;stroke:black;stroke-width:1.5px;"/>
|
||||
<rect x="0" y="67.79" width="16.54" height="15.26" style="fill:rgb(35,31,32);"/>
|
||||
<rect x="476.49" y="67.79" width="16.54" height="15.26" style="fill:rgb(35,31,32);"/>
|
||||
</g>
|
||||
<g id="text" transform="matrix(1,0,0,1,295,5)">
|
||||
<g transform="matrix(1,0,0,1,-58.87,-266.56)">
|
||||
<rect x="73.39" y="479" width="20.21" height="57.67" style="fill:rgb(35,31,32);fill-rule:nonzero;"/>
|
||||
</g>
|
||||
<g transform="matrix(1,0,0,1,-58.87,-266.56)">
|
||||
<path d="M198.8,479L242,479L242,491.18L219,491.18L219,501.33L240.05,501.33L240.05,513.5L219,513.5L219,524.5L242.34,524.5L242.34,536.67L198.8,536.67L198.8,479Z" style="fill:rgb(35,31,32);fill-rule:nonzero;"/>
|
||||
</g>
|
||||
<g transform="matrix(1,0,0,1,-58.87,-266.56)">
|
||||
<path d="M341.62,493.44L341.62,479L397.86,479L397.86,493.46L379.86,493.46L379.86,536.67L359.64,536.67L359.64,493.44L341.62,493.44Z" style="fill:rgb(35,31,32);fill-rule:nonzero;"/>
|
||||
</g>
|
||||
<g transform="matrix(1,0,0,1,-58.87,-266.56)">
|
||||
<path d="M499.08,479L541.19,479L541.19,491.18L519.29,491.18L519.29,501.66L539.84,501.66L539.84,513.84L519.29,513.84L519.29,536.67L499.08,536.67L499.08,479Z" style="fill:rgb(35,31,32);fill-rule:nonzero;"/>
|
||||
</g>
|
||||
<g transform="matrix(1,0,0,1,-58.87,-266.56)">
|
||||
<path d="M558.87,478.4C563.995,478.405 568.21,482.625 568.21,487.75C568.21,492.879 563.989,497.1 558.86,497.1C553.735,497.1 549.515,492.885 549.51,487.76C549.51,482.625 553.735,478.4 558.87,478.4ZM558.87,495.29C562.999,495.279 566.39,491.879 566.39,487.75C566.39,483.614 562.986,480.21 558.85,480.21C554.714,480.21 551.31,483.614 551.31,487.75C551.31,487.753 551.31,487.757 551.31,487.76C551.321,491.898 554.732,495.295 558.87,495.29ZM560.8,492.73L559.97,491.12C559.07,489.37 558.36,488.64 557.34,488.64L556.66,488.64L556.66,492.73L554.66,492.73L554.66,482.73L559.66,482.73C559.723,482.726 559.787,482.724 559.85,482.724C561.381,482.724 562.641,483.984 562.641,485.515C562.641,486.975 561.496,488.201 560.04,488.3L560.04,488.35C560.89,488.65 561.09,488.9 562.15,490.68L563.32,492.68L560.8,492.73ZM558.62,487.06C559.92,487.06 560.62,486.53 560.62,485.68C560.62,484.83 559.94,484.32 558.54,484.32L556.71,484.32L556.71,487.06L558.62,487.06Z" style="fill:rgb(35,31,32);fill-rule:nonzero;"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<defs>
|
||||
<linearGradient id="_Linear1" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(4.92112e-15,80.368,-7.5457,4.62041e-16,939.048,235.264)"><stop offset="0" style="stop-color:rgb(61,0,121);stop-opacity:1"/><stop offset="1" style="stop-color:black;stop-opacity:1"/></linearGradient>
|
||||
<linearGradient id="_Linear2" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.51244e-14,247,-247,1.51244e-14,349,90)"><stop offset="0" style="stop-color:white;stop-opacity:1"/><stop offset="0.5" style="stop-color:rgb(199,199,199);stop-opacity:1"/><stop offset="1" style="stop-color:white;stop-opacity:1"/></linearGradient>
|
||||
<linearGradient id="_Linear3" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.51244e-14,247,-247,1.51244e-14,349,90)"><stop offset="0" style="stop-color:white;stop-opacity:1"/><stop offset="0.5" style="stop-color:rgb(146,146,146);stop-opacity:1"/><stop offset="1" style="stop-color:white;stop-opacity:1"/></linearGradient>
|
||||
</defs>
|
||||
</svg>
|
Before Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 112 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 89 KiB |