Hi,
I have created a script that links tasks with stories, so that you do
not have to enter them manually after you import from CSV. The import
did not work for i_links and o_links (it may now though) so I created
a script to recteate them. You just provide story ID and range of task
IDs.

It runs on Linux or requires Cygwin with curl for Windows
(unfortunately my case). Just run without params to get usage help.

One limatation is that it works only with Agilo with HTTP
authentication, not form based authorization, because this is what I
use. This is just when you install Agilo on plain Trac. It wouldn't be
a big deal to update it though, probably just adding proper post data
to login request would make it.

There is also no fancy input check but it wasn't supposed to be bullet
proof tool.

I hope it will help someone. I have saved hours with that probably.

Marcin


#!/bin/sh
# author: Marcin Okraszewski - okrasz_news -at- o2 -dot- pl

if [ $# -lt 6 ] ; then
  echo "This script creates links between story and tasks (hopefully
other links as well)."
  echo "This version works only with digest authentication, not
through web form."
  echo
  echo "Syntax:"
  echo "   $0 AGILO_URL USER PASS STORY_ID TASK_ID_FROM TASK_ID_TO"
  echo "Where:"
  echo "   AGILO_URL - base URL to your Agilo project"
  echo "   USER - your user name"
  echo "   PASS - your password"
  echo "   STORY_ID - ID of the story that will have tasked linked"
  echo "   TASK_ID_FROM - ID of the first of tasks to link to story
(inclusive)"
  echo "   TASK_ID_TO - ID of the last task to link to the story
(inclusive)"
  echo
  echo "Example:"
  echo "    $0 http://localhost/demo admin adminPass 1 3 5"
  echo "This example will link tasks 3-5 to a story 1  "
  echo "in Agilo project http://localhost/demo";
  echo
  echo "NOTE: to link a single task, use the same number "
  echo "in TASK_ID_FROM and TASK_ID_TO"
  echo
  echo "(c) Marcin Okraszewski - okrasz_news -at- o2 -dot- pl"
  exit
fi

agilo=$1
user=$2
pass=$3
dst=$4
from=$5
to=$6

cookies=cookies.txt

# login
echo "Logging into $agilo"
curl --digest -u "$user:$pass" -c "$cookies" $agilo/login > /dev/null
# get form token
echo "Obtaining form token"
curl --digest -u "$user:$pass" -b "$cookies" -c "$cookies" $agilo > /
dev/null
formtoken=$( cat cookies.txt | grep trac_form_token | cut -f 7 | tr -d
"\r" )

# create links
for (( i=$from ; i <= $to ; i++ )) ; do
  echo -n -e "\nlink $i to $dst "
  data="__FORM_TOKEN=$formtoken&url_orig=%2Fav%2Fticket%2F438%3Fpane
%3Dedit&src=$dst&dest=$i&autocomplete_parameter=&cmd=create+link"
  curl  -e "$agilo/ticket/$dst"'?pane=edit' -b "$cookies" -d "$data"
$agilo/links 2>/dev/null
done

rm "$cookies"

-- 
Follow Agilo on Twitter: http://twitter.com/agiloforscrum
-----
You received this message because you are subscribed to the Google
Groups "Agilo for Scrum" group. This group is moderated by agile42 GmbH 
http://www.agile42.com and is focused in supporting Agilo for Scrum users.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/agilo?hl=en

Reply via email to