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]
- --username=<GitTrac username> - default is your Unix username (adesmet)
- --password=<GitTrac password> - default is contents of ~/.gtmover/password
- --url-base=<NEW URL> - default https://condor-wiki.cs.wisc.edu/index.cgi/
- --force-version - allow unusual version IDs.
- --execute - Actually do the work. Defaults to only reporting a plan
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 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 |