-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Brien Wankel
committed
May 7, 2013
1 parent
d1c513b
commit d6a6d16
Showing
5 changed files
with
46 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Pry.commands.alias_command 'c', 'continue' | ||
Pry.commands.alias_command 's', 'step' | ||
Pry.commands.alias_command 'n', 'next' | ||
Pry.commands.alias_command 'f', 'finish' | ||
Pry.commands.alias_command 'exit', 'exit-program' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
trac2tracker | ||
============ | ||
|
||
A simple script to import a Trac sqlite database into a Pivotal Tracker project | ||
A simple ruby script to import a Trac sqlite database into a Pivotal Tracker project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
|
||
pt_email = '[email protected]' | ||
# pt_project_id = '784261' # CPF spt | ||
pt_project_id = '820749' # CPF Test | ||
pt_project_id = '821611' # CPF Test | ||
|
||
unless pt_email | ||
print "Pivotal Email: " | ||
|
@@ -46,9 +46,10 @@ | |
memberships = (project.memberships.all).collect(&:name).map(&:downcase) | ||
# TODO: verify memberships | ||
|
||
|
||
story = nil | ||
errors = 0 | ||
error_ids = [] | ||
comment_failures = [] | ||
ticket_progress = ProgressBar.create(:title => "Tickets: ", | ||
:format => "%t %c/%C (%p%) |%b>>%i|", :total => ticket_count.to_i) | ||
|
||
|
@@ -127,6 +128,8 @@ | |
# bugs and releases can't have estimate | ||
estimate = nil if ['bug', 'release', 'chore'].include? story_type | ||
|
||
# update progress bar with new ticket id | ||
ticket_progress.title = "Ticket #{id}" | ||
begin | ||
story = project.stories.create( | ||
name: story, | ||
|
@@ -140,23 +143,30 @@ | |
# owner: owner, | ||
description: description.chomp + "\n[trac#{id}] Imported from trac, original id #{id}" | ||
) | ||
rescue | ||
puts $!.backtrace | ||
puts "Ticket: #{id}" | ||
binding.pry | ||
end | ||
# # migrate comments | ||
# db.execute(query = 'select newvalue from ticket_change where field=="comment" and newvalue != \'\' and ticket=' + id.to_s + ' and newvalue !=' + id.to_s) do |comment| | ||
# story.notes.create(:text => comment[0]) unless comment[0].empty? | ||
# end | ||
|
||
if story.errors.count > 0 | ||
puts "Failed on ticket #{id}" | ||
puts story.errors | ||
binding.pry | ||
errors = errors + 1 | ||
error_ids << id | ||
else | ||
ticket_progress.title = "Ticket #{id}" | ||
# migrate comments | ||
begin | ||
db.execute(query = 'select newvalue from ticket_change where field=="comment" and newvalue != \'\' and ticket=' + id.to_s + ' and newvalue !=' + id.to_s) do |comment| | ||
story.notes.create(:text => comment[0]) unless comment[0].empty? | ||
end | ||
rescue | ||
puts "failed adding comments to ticket #{id}" | ||
comment_failures << id | ||
end | ||
ticket_progress.increment | ||
end | ||
rescue | ||
# puts $!.backtrace | ||
puts "Failed on ticket: #{id}" | ||
end | ||
|
||
end | ||
puts "Errors: #{errors}" | ||
puts "\nErrors: #{errors}" if errors > 0 | ||
puts "Ticket IDs: " + error_ids.join(',') if error_ids.length > 0 | ||
puts "failed adding comments to: " + comment_failures.join(',') if comment_failures.length > 0 |