Importing XML data from Basecamp to Redmine

Added by Tim Perreault about 10 years ago

Hello,

My company would like to make the switch from Basecamp to Redmine, however, the one thing holding us back is data migration. We have a lot of projects and data that would need to bring into Redmine.

I've done some googling, searching the forums, and reading wikis, but I haven't found a concrete answer either way about being able to import basecamp XML data.

Does anyone have experience with this, or know of some software that could facilitate the move?

Regards,
Tim

Replies (26)

RE: Importing XML data from Basecamp to Redmine - Added by Eric Davis about 10 years ago

It would be possible but I haven't seen any code developed for it yet. The import script which would read your Basecamp XML data and convert it into Redmine's format to be saved to the database. If you want to contact me via email, I can take a look at your data and see what would be needed to import it.

Eric Davis

RE: Importing XML data from Basecamp to Redmine - Added by Ted Behling over 9 years ago

I am going to try taking a crack at this. Will try to post comments if I run into issues.

RE: Importing XML data from Basecamp to Redmine - Added by David Le Dieu over 9 years ago

Any joy with this as I'm hoping bring in all my basecamp projects?

RE: Importing XML data from Basecamp to Redmine - Added by Ted Behling over 9 years ago

Hi David,

Thanks for the interest. I've made a lot of progress but I don't feel comfortable it's ready for release yet.

It would be helpful if I knew how complex people's use of Basecamp is. Do you just have projects with associated task lists and tasks? Do you have multiple "clients" set up? Do your tasks have comments? Do you use the "writeboard" and other non-task features of Basecamp?

The point is, I would be likely to have a subset of Basecamp importing ready to use before complete functionality.

RE: Importing XML data from Basecamp to Redmine - Added by David Le Dieu over 9 years ago

Hi Ted,
Good to hear you are all over this :-)

Basically it's a yes to projects with task lists etc. In some projects I use Messages, To-Do's, Milestones, Writeboards and Files (I generally dont have a requirement for 'Time' within Basecamp but will use it in Redmine). I have multiple 'clients' and some tasks have comments.

It would be very productive/beneficial for me should this functionality become available - sadly my skills in operating in the background - while improving - are hopelessly inadequate to provide any meaningful assistance. Any questions you have will be gladly received and answered to the best of my ability.

Regards,
David

RE: Importing XML data from Basecamp to Redmine - Added by Gustavo Gawryszewski about 9 years ago

Does anyone accomplished this task? It would be great to have an importer directly from Redmine.

RE: Importing XML data from Basecamp to Redmine - Added by Ted Behling about 9 years ago

Hi Gustavo --

Sadly, I have not put much effort into my plugin in the past few months. I plan to pick it up again at some point though. If anybody would like the code I have written so far, please feel free to e-mail me.

RE: Importing XML data from Basecamp to Redmine - Added by Sam Bo about 9 years ago

I did this very thing recently but from unfuddle's xml export. It is quite easy to take xml and import it into redmine if you have minimal development experience because the redmine db tables are very straightforward, but to make that into a plugin is probably 50x more work. I just built a bunch of import statements and ran them in mysql studio and really didn't have much of an issue.

RE: Importing XML data from Basecamp to Redmine - Added by Ted Behling almost 9 years ago

I just completed work on a script to import Basecamp data into Redmine, which is attached here. This script will generate another Ruby script that does the actual importing. Imports occur by invoking Redmine's ActiveRecord models, which ensures that all validations pass, the same as if you used the Web interface manually.

To use this script:

- Put the basecamp2redmine.rb scrit in the root directory of your Redmine installation.
- Put your Basecamp XML file in the same directory
- Open a command prompt on the Redmine server, and change directory (cd) to that directory
- Run this command: ruby basecamp2redmine.rb my-basecamp-backup.xml > basecamp-import.rb
(replace my-basecamp-backup.xml with the name of your XML file)
- That command will generate the file "basecamp-import.rb". No actual importing has run yet.
- Optionally, inspect the basecamp-import.rb file to ensure it contains what you want to import.
- Then run: script/runner basecamp-import.rb

If you need to undo the import, there is a basecamp2redmine_undo.rb file, attached, which will generate an "undo" file you can run. Use it the same as basecamp2redmine.rb .

Thanks to Tactio Interaction Design (www.tactio.com.br) for funding this work!

basecamp2redmine.rb Magnifier - Import Basecamp XML backup file into Redmine (12 KB)

basecamp2redmine_undo.rb Magnifier - Undo import of Basecamp XML backup file into Redmine (630 Bytes)

RE: Importing XML data from Basecamp to Redmine - Added by Ted Behling almost 9 years ago

One additional point about the basecamp2redmine.rb script --

It assumes that you want your "Basecamp" todos to be indicated in Redmine. To that end, it will look for a Tracker called "Basecamp Todo", which must exist. You can create the tracker in the Redmine administration section. If you want to use another tracker instead, simply edit the basecamp2redmine.rb file, and edit the line near the top that says:

TRACKER = 'Basecamp Todo'

RE: Importing XML data from Basecamp to Redmine - Added by Jeremy Wilson almost 9 years ago

I tried using this script and got multiple pages of errors:


basecamp-import.rb:13054: syntax error, unexpected tIDENTIFIER, expecting kEND
<a href="http://www.blackberry.com/develope...
^
basecamp-import.rb:13054: unknown regexp options - www
basecamp-import.rb:13054: syntax error, unexpected tSTRING_BEG, expecting kEND
.../BBAppWorld_Getitat_white.zip">Get
^
basecamp-import.rb:13056: syntax error, unexpected tIDENTIFIER, expecting kEND
<a href="http://www.blackberry.com/develope...
^
basecamp-import.rb:13056: unknown regexp options - www
basecamp-import.rb:13056: unknown type of %string
...NamingAndLogoGuidelines%20-%20FOR%20VENDOR%20USE.pdf">BlackB...
^
basecamp-import.rb:13056: syntax error, unexpected $end
...NamingAndLogoGuidelines%20-%20FOR%20VENDOR%20USE.pdf">BlackB...
^
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `eval'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/runner.rb:46
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from script/runner:3


This is on CentOS 5.5. Any clues?

RE: Importing XML data from Basecamp to Redmine - Added by Ted Behling almost 9 years ago

Jeremy,

As I just e-mailed you, I'm sorry you had trouble with my script. I'd be happy to try to help. It sounds like the problem is that the code-generation isn't handling your input data properly. If you would like to send me your basecamp-import.rb file, and preferably also your Basecamp XML file, I will troubleshoot and try to get you a fix.

RE: Importing XML data from Basecamp to Redmine - Added by Pasi Oja-Nisula almost 9 years ago

Thanks for these scripts. They are great help. I found some issues, mainly due to character escaping.

1. We had many todo-lists that had the same name. Importing the data worked when I disabled "validates_uniqueness_of :name" like told in http://www.redmine.org/issues/show/630

2. We had quotes in the content and these had to be escaped.
content = content.gsub('"', '')
content = content.gsub('\'', '')

3. basecamp2redmine.rb has a line like this:
src << %{ todos['#{id}'] = Issue.new :subject => '#{content[0..255]}', :description => '#{content}',

This can break with multibyte charactes if they are split in the middle. This then leads to all kinds of funny error messages because the next ' is presumed to be the second byte of multibyte character and the end of string is lost.

I got the import working with this:
content_begin = content[0..255]
if content_begin[-1,1] == "\xc3" then
content_begin = content_begin[0..254]
end

And replacing content[0..255] with content_begin variable.

I'll attach a diff file if that was hard to understand. I haven't done anything with ruby, so there might be some better way to do that.

RE: Importing XML data from Basecamp to Redmine - Added by Pasi Oja-Nisula almost 9 years ago

About escaping those quotes, in our case they escaped real good. You could almost say they vanished :-)

And the multibyte fix is just a hack that made possible to import Finnish text. Probably there is some function that works with all multibyte issues.

RE: Importing XML data from Basecamp to Redmine - Added by Ted Behling over 8 years ago

Hi all,

I'm the original author of the basecamp2redmine.rb script. Following up on the bug report from Jeremy Wilson, above, I have updated the script to properly handle quote characters (' and "). The new version is attached here.

I will continue to work on a solution for the separate issue that Pasi Oja-Nisula reported, above, regarding multi-byte characters.

basecamp2redmine.rb Magnifier - Updated version of the basecamp2redmine.rb script. See above for usage details. (12.5 KB)

RE: Importing XML data from Basecamp to Redmine - Added by Ted Behling over 8 years ago

Hi Pasi,

As I e-mailed you, thanks for the patch you posted above, for the basecamp2redmine.rb script that I wrote. Based in the work you did, I would be happy to try to find a general-purpose solution for handling multi-byte data properly. If you are able to send me a copy of the Basecamp XML file that you had a problem using, then I would be happy to try to patch my script to properly handle that data.

Thanks,

Ted

RE: Importing XML data from Basecamp to Redmine - Added by bob user over 8 years ago

@Sam Bo:

Do you happen to have scripts written from your Unfuddle to Redmine migration? I'm considering the same migration and would prefer not to reinvent the wheel... any tips, hints, advice or scripts you could share would be greatly appreciated!

Thanks in advance!

RE: Importing XML data from Basecamp to Redmine - Added by Ben E about 8 years ago

Ted Behling wrote:

Jeremy,

As I just e-mailed you, I'm sorry you had trouble with my script. I'd be happy to try to help. It sounds like the problem is that the code-generation isn't handling your input data properly. If you would like to send me your basecamp-import.rb file, and preferably also your Basecamp XML file, I will troubleshoot and try to get you a fix.

Ted, I seem to be experiencing similar issues to Jeremy, any help??

Please let me know what I need to do, I can replicate the environment on another linux machine/osx if needed; or provide an xml file

My environment CentOs 5.6, mysql, ruby 1.8.7, rails 2.3.5

RE: Importing XML data from Basecamp to Redmine - Added by André Pitanga almost 8 years ago

Thanks for developing this script. My organization is ready to migrate to Redmine and the script is making that possible, because honestly I'd have no idea on how to code this : )

I'm getting caught on a mySQL error though and was hoping someone would be able to point me in the right direction. Here's what I'm getting:

Exception was raised at /root/basecamp-import.rb:18; deleting all imported projects...
/home/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log': Mysql::Error: Duplicate entry '60-10' for key 'projects_trackers_unique': INSERT INTO `projects_trackers` (`project_id`, `tracker_id`) VALUES (60, 10) (ActiveRecord::StatementInvalid)
    from /home/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:324:in `execute'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:259:in `insert_sql'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:334:in `insert_sql'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:44:in `insert_without_query_dirty'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:19:in `insert'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb:78:in `insert_record'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:146:in `send'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:146:in `send'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/autosave_association.rb:323:in `save_collection_association'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:392:in `method_missing'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:215:in `each'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:215:in `send'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:215:in `method_missing'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:392:in `method_missing'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/autosave_association.rb:314:in `save_collection_association'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/autosave_association.rb:176:in `autosave_associated_records_for_trackers'
    from /home/redmine/vendor/rails/activesupport/lib/active_support/callbacks.rb:178:in `send'
    from /home/redmine/vendor/rails/activesupport/lib/active_support/callbacks.rb:178:in `evaluate_method'
    from /home/redmine/vendor/rails/activesupport/lib/active_support/callbacks.rb:166:in `call'
    from /home/redmine/vendor/rails/activesupport/lib/active_support/callbacks.rb:93:in `run'
    from /home/redmine/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `each'
    from /home/redmine/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `send'
    from /home/redmine/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `run'
    from /home/redmine/vendor/rails/activesupport/lib/active_support/callbacks.rb:276:in `run_callbacks'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/callbacks.rb:344:in `callback'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/callbacks.rb:267:in `create'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/base.rb:2927:in `create_or_update_without_callbacks'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/callbacks.rb:250:in `create_or_update'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/base.rb:2594:in `save_without_validation!'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/validations.rb:1100:in `save_without_dirty!'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/dirty.rb:87:in `save_without_transactions!'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:200:in `save!'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:182:in `transaction'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:200:in `save!'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'
    from /home/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:200:in `save!'
    from /root/basecamp-import.rb:18
    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `eval'
    from /home/redmine/vendor/rails/railties/lib/commands/runner.rb:46
    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from script/runner:3

This DB table has a unique index:

mysql> show index from projects_trackers;
+-------------------+------------+------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table             | Non_unique | Key_name                     | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+-------------------+------------+------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| projects_trackers |          0 | projects_trackers_unique     |            1 | project_id  | A         |          59 |     NULL | NULL   |      | BTREE      |         |
| projects_trackers |          0 | projects_trackers_unique     |            2 | tracker_id  | A         |         179 |     NULL | NULL   |      | BTREE      |         |
| projects_trackers |          1 | projects_trackers_project_id |            1 | project_id  | A         |          59 |     NULL | NULL   |      | BTREE      |         |
+-------------------+------------+------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
3 rows in set (0.00 sec)

But I'm not sure why I'm getting the duplicate entry issue, since the project_id in question doesn't currently exist on the table!

-AP

RE: Importing XML data from Basecamp to Redmine - Added by Lukas Schejbal almost 8 years ago

Andre,

did you manage to solve your problem? I was asked to migrate basecamp data to redmine, where few projects exists but I am experiencing the same problem as you. Any hint would be welcomed.

Lukas

RE: Importing XML data from Basecamp to Redmine - Added by André Pitanga over 7 years ago

Lukas, are you still working on this? I actually never pursued this further, but let's take another look if it's still relevant.

RE: Importing XML data from Basecamp to Redmine - Added by soporte servidores over 7 years ago

An imported style sheet has lower precedence than the importing style sheet.This element must appear as the first child node of <xsl:stylesheet> or <xsl:transform>.Suppose you have a style sheet called "cdcatalog_ex3.xsl":

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<tr>
<td><xsl:value-of select="catalog/cd/title"/></td>
<td><xsl:value-of select="catalog/cd/artist"/></td>
</tr>
</table>
</body>
</html>
</xsl:template>

</xsl:stylesheet>
soporte servidores
DON'T cry over anyone who won't cry over you

RE: Importing XML data from Basecamp to Redmine - Added by Matt Clements over 7 years ago

André Pitanga wrote:

Thanks for developing this script. My organization is ready to migrate to Redmine and the script is making that possible, because honestly I'd have no idea on how to code this : )

I'm getting caught on a mySQL error though and was hoping someone would be able to point me in the right direction. Here's what I'm getting:

[...]

This DB table has a unique index:

[...]

But I'm not sure why I'm getting the duplicate entry issue, since the project_id in question doesn't currently exist on the table!

-AP

I hit the same issue with this - going to dig deeper into this an upload a fixed script when i'm done.

However for now, I did the following:

ALTER TABLE projects_trackers
DROP KEY `projects_trackers_unique`;

Then executed the import, fixed the duplicate value in projects_trackers by removing, then ran:

ALTER TABLE projects_trackers
ADD  UNIQUE KEY `projects_trackers_unique` (`project_id`,`tracker_id`);

RE: Importing XML data from Basecamp to Redmine - Added by Mike Walsh over 7 years ago

I've been following this and was unable to execute the fix to remove the duplicate value in projects_trackers? Any thoughts? Paving Slabs Cheap

RE: Importing XML data from Basecamp to Redmine - Added by Matt Clements over 7 years ago

Mike,
Sorry i'm not sure what is happening - are you saying that the first query works but the second doesn't? Or that the first command works, but you can't delete the duplicates it creates?

Regards,
Matt

1 2 (1-25/26)