tools/trac/IcuCodeTools/0.12/icucodetools/templates/review.html -text
tools/trac/IcuCodeTools/0.12/icucodetools/ticketmgr.py -text
tools/trac/IcuCodeTools/0.12/icucodetools/tktlist.py -text
+tools/trac/IcuCodeTools/0.12/icucodetools/traccheck.py -text
tools/trac/IcuCodeTools/0.12/license.html -text
tools/trac/IcuCodeTools/0.12/readme.txt -text
tools/trac/IcuCodeTools/0.12/setup.cfg -text
tools/trac/IcuCodeTools/0.11/icucodetools/*.pyc
tools/trac/IcuCodeTools/0.12/*.egg-info
tools/trac/IcuCodeTools/0.12/build
+tools/trac/IcuCodeTools/0.12/dist
tools/trac/IcuCodeTools/0.12/icucodetools/*.pyc
tools/unicode/c/genprops/*.d
tools/unicode/c/genprops/*.ncb
--- /dev/null
+#!/usr/bin/python
+
+# Copyright (C) 2014 IBM Corporation and Others. All Rights Reserved.
+#
+
+# This script should be invoked from the subversion pre-commit hook just like the trac plugin
+#
+# REPOS="$1"
+# TXN="$2"
+# TRAC_ENV="/somewhere/trac/project/"
+# LOG=`/usr/bin/svnlook log -t "$TXN" "$REPOS"`
+# /path/to/traccheck "$TRAC_ENV" "$LOG" >&2 || exit 1
+
+import sys, re
+from trac.core import TracError
+from trac.env import open_environment
+from trac.resource import ResourceNotFound
+from trac.ticket.model import Ticket
+from trac.util.text import exception_to_unicode
+
+okstatus = ['new','accepted','reviewing']
+
+def run(args=None):
+ """trac check script"""
+ if args is None:
+ args = sys.argv[1:]
+ env = open_environment(args[0])
+
+ ticket_pattern = env.config.get('icucodetools', 'ticket_pattern', 'NoneFound')
+ ticket_match = None
+
+ def lusage():
+ print "Please make your message match /%s/\n and use an open ticket (One of these: %s)" % (ticket_pattern, str(okstatus))
+ print "See %s/wiki/TracCheck for more details." % env.project_url
+
+ try:
+ ticket_match = re.compile(ticket_pattern)
+ except Exception, e:
+ # not sorry?
+ raise TracError('*** INTERNAL ERROR: Could not compile icucodetools.ticket_pattern=/%s/: %s' % (ticket_pattern, exception_to_unicode(e, traceback=True)))
+ res = ticket_match.match(args[1].strip())
+ if res:
+ tickname = res.group(1)
+ try:
+ int(res.group(1)) # should be int
+ except Exception, e:
+ print('*** Sorry, "%s" is not a valid number when parsing "%s": %s.' %
+ (tickname, args[1], e))
+ lusage()
+ sys.exit(1)
+ else:
+ print('*** Sorry, could not parse a ticket number from your commit message "%s".' %
+ (args[1]))
+ lusage()
+ sys.exit(1)
+ id = int(res.group(1))
+ try:
+ ticket = Ticket(env, id)
+ status = ticket.values['status']
+ if status in okstatus:
+ print "Okay! You are committing against ticket #%d which is in state '%s': %s" % (id,status,ticket.values['summary'])
+ sys.exit(0)
+ else:
+ print "*** Sorry, ticket #%d is '%s' and is not open for commits: %s" % (id,status,ticket.values['summary'])
+ lusage()
+ sys.exit(1)
+ except (ResourceNotFound):
+ print "*** Sorry, ticket #%d does not exist." % (id)
+ lusage()
+ sys.exit(1)
+ sys.exit(0)
+
+# make this file runnable
+if __name__ == '__main__':
+ sys.exit(run())
ICU Code Tools plugin
-Copyright (C) 2010 IBM Corporation and Others. All Rights Reserved.
+Copyright (C) 2010-2014 IBM Corporation and Others. All Rights Reserved.
See license.html for the license file. This file is part of the
ICU project and is under the same license.
a. There is no source release at this time: I recommend
that you check out this code with svn
- and in this directory, run:
+ and in this directory, run:
"python setup.py develop"
-
+
b. In trac.ini under '[components]' add:
icucodetools.review.reviewmodule = enabled
icucodetools.ticketmgr.ticketmanager = enabled
-
- NOTE: DCUT and TKTLIST parts are not working yet.
+
+ NOTE: DCUT and TKTLIST parts are not working yet.
Don't bother to enable them.
- 2. in your trac.ini describe how your changesets describe a ticket.
+ 2. in your trac.ini describe how your changesets describe a ticket.
Our changesets look like this: "ticket:1234: fixed the broken code"
We use this regex:
[icucodetools]
ticket_pattern = ^ticket:(\d+)
- 3. you may need to run trac-admin <environment> upgrade
+ 3. you may need to run trac-admin <environment> upgrade
- 4. Grant permission of ICUREVIEW_VIEW to whomever you want to
- be able to review tickets.
+ 4. Grant permission of ICUREVIEW_VIEW to whomever you want to
+ be able to review tickets.
5. Now, any ticket will have something in the top right corner which says:
"No commits" - no commits against this ticket
"Review n commits" - there are more than one commits against this
ticket.
-
+
Troubleshooting:
Q: My commits aren't being found!
0. back up your path/to/env/db/trac.db
1. $ sqlite3 path/to/env/db/trac.db
-
+
2. sqlite> delete from rev2ticket;
3. sqlite> update system set value='-1' where name='icu_tktmgr_youngest';
Now the ticket manager will re-sync the first time you hit a ticket.
+RESTRICT CHECKINS
+ See the comments at the top of icucodetools/traccheck.py.
+ note that /path/to/traccheck is the path to the installed "traccheck" script,
+ not the 'traccheck.py' source file.
+
FILING BUGS/FEATURE REQUESTS:
- Use ICU's trac repository at http://bugs.icu-project.org/trac
- Use the 'infrastructure' component and clearly identify the 'ICU Code Tools
for Trac' when you file the bug.
-
-
-
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2007-2012 IBM and Others. All Rights Reserved.
+# Copyright (C) 2007-2014 IBM and Others. All Rights Reserved.
# All rights reserved.
#
'icucodetools.review = icucodetools.review',
'icucodetools.tktlist = icucodetools.tktlist',
'icucodetools.dcut = icucodetools.dcut'
+ ],
+ 'console_scripts': [
+ 'traccheck = icucodetools.traccheck:run'
]
}
)