Page History

Turn Off History

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

Bulk changing target versions

A script is in progress. See #1443.

General ticket editing

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

First some constants:

# Our site
SITE=http://condor-wiki.cs.wisc.edu/index.cgi
# COOKIE_FILE can be just about any path you can write to
COOKIE_FILE=$HOME/my-cookies
# TICKET is the ticket number you want to work on
TICKET=1337

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