At the moment this is a bit of a junk draw collecting notes on programmatically interacting with GitTrac

Bulk changing target versions

See ticket-target-mover.

cvs -d /p/condor/repository/CONDOR_SRC checkout tools/ticket-target-mover

Usage: ./ticket-target-mover --from-ver=<version ID> --to-ver=<version ID> [options]

ticket-target-mover uses the web interface, so the ticket history is correctly updated. It also adds a remark noting somethin like: "2010-Aug-23 17:06:39 by adesmet: Bulk change of target version from v070400 to v070404 using ./ticket_target_mover."

General ticket editing

(This section is based on Matt Farrellee's email "scripting gittrac & unassigned resolved tickets".)

Note that our GitTrac install has been modified by mattf to allow updating individual fields without needing to resubmit all of the fields. The below will probably not work on other CVSTrac installations.

First some constants:

# Our site
# COOKIE_FILE can be just about any path you can write to
# TICKET is the ticket number you want to work on

First, login is a must. you need a cookie to access functions such as tktedit. to get a login cookie use:

curl -c $COOKIE_FILE -d u=$USER -d "p=$PASS" -d in= http://$SITE/login

second, once you have a cookie, it is necessary to get a CSRF secret, which gittrac uses to avoid cross-site scripting attacks. to get one use:

curl -b $COOKIE_FILE "http://$SITE/tktedit?tn=$TICKET" 2>&1 | \
  grep 'type="hidden"' | grep -v -e 'name="tn"' -e 'name="le"'

the above two steps give you all the information you need to start editing tickets without the web UI.

to actually perform an edit use this command:

curl -b $COOKIE_FILE -d tn=$TICKET -d le=0 -d submit= -d \
  "$CSRF_NAME=$CSRF_VALUE" -d "$FIELD" http://$SITE/tktedit

CSRF_NAME is from the previous output, as well as CSRF_VALUE.

The last parameter is FIELD, which is always of the form X=Y where X is a field name and Y is the new value. field names are:

CGI Database
Field Field Meaning
y type Type
s status Status
d derivedfrom Parent ticket
v version Earliest known version with problem
a assignedto Assigned to
e severity Target version for fix
p priority Priority
m subsystem Subsystem
w owner Submitter
t title Title/Summary
c description Long description
r remarks Long remarks
n contact ?
x1 extra1 Associated rust ticket
x2 extra2 Customer Group
x3 extra3 Visibility (Public/Private)
x4 extra4 Notify (email list)
x5 extra5 Due Date