Defect #860
closedmercurial repository view
0%
Description
First push to a mercurial repository breaks redmine repository view (see error below). Following patch solves it for me:
Index: app/models/repository/mercurial.rb
===================================================================
--- app/models/repository/mercurial.rb (revision 1248)
+++ app/models/repository/mercurial.rb (working copy)@ -56,7 +56,7
@
scm_revision = scm_info.lastrev.identifier.to_i
unless changesets.find_by_revision(scm_revision)
- revisions = scm.revisions('', db_revision, nil)
+ revisions = scm.revisions('', db_revision.to_i + 1, nil)
transaction do
revisions.reverse_each do |revision|
changeset = Changeset.create(:repository => self,
ActiveRecord::StatementInvalid (MysqlError: Column 'changeset_id' cannot be null: INSERT INTO `changes` (`changeset_id`, `action`, `revision`, `branch`, `from_path`, `from_revision`, `path`) VALUES):
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:150:in `log'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:281:in `execute'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:156:in `insert_sql'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:291:in `insert_sql'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:44:in `insert_without_query_dirty'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:19:in `insert'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2272:in `create_without_callbacks'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:226:in `create_without_timestamps'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/timestamp.rb:29:in `create'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2238:in `create_or_update_without_callbacks'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:213:in `create_or_update'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1972:in `save_without_validation'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/validations.rb:934:in `save_without_transactions'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in `save'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:80:in `transaction'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:100:in `transaction'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in `save'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:120:in `rollback_active_record_state!'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in `save'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:572:in `create'
/app/models/repository/mercurial.rb:71:in `fetch_changesets'
/app/models/repository/mercurial.rb:70:in `each'
/app/models/repository/mercurial.rb:70:in `fetch_changesets'
/app/models/repository/mercurial.rb:61:in `reverse_each'
/app/models/repository/mercurial.rb:61:in `fetch_changesets'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:80:in `transaction'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:100:in `transaction'
/app/models/repository/mercurial.rb:60:in `fetch_changesets'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations/association_proxy.rb:125:in `send'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations/association_proxy.rb:125:in `method_missing'
/app/controllers/repositories_controller.rb:53:in `show'
Files
Updated by Jean-Philippe Lang over 16 years ago
- Status changed from New to Closed
- Target version set to 0.7
- Affected version (unused) set to devel
- Resolution set to Fixed
I couldn't reproduce but it should be fixed by r1255.
Updated by Jason Best over 14 years ago
I know this is an old ticket, but I was getting similar behavior running redmine 0.9.3 on windows with Mercurial. It looks like it is trying to insert duplicates. I compared it with the SVN repository model and found a discrepancy. I attached a patch that I am using on our production system.