Patch #9359

invert project <-> repository relationship

Added by Jens Krämer over 1 year ago. Updated 3 months ago.

Status:NewStart date:2011-09-30
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:SCM
Target version:-

Description

This patch changes the relationship between repositories and projects, so that a single repository can be shared among multiple projects.

While you can already use the same physical repository with multiple projects without this patch, doing so leads to duplication of change records in the database as well as multiple identical changeset references on issues, because each changeset is imported n times, where n is the number of projects referencing the repository.

The patch changes Redmine's behavior to re-use an already existing repository record if possible, when the scm properties of a project are configured. A migration converting existing installations that use one ore more repositories in multiple projects to the new setup is included.

invert_project_repository_relationship.diff Magnifier - the patch against current HEAD (8.04 KB) Jens Krämer, 2011-09-30 16:06

invert_project_repository_relationship_2.diff Magnifier - updated patch, all tests passing (14.4 KB) Jens Krämer, 2011-09-30 18:27

invert_project_repository_relationship_2-1.3-stable-9308.patch Magnifier (14.3 KB) Robert Rath, 2012-04-03 17:15


Related issues

Related to Feature #3169: Multiple repositories for projects Closed 2009-04-14
Related to Defect #6857: git references leaking from subproject to project New 2010-11-09
Related to Feature #9703: Define repositories independently from projects New

History

#2 Updated by Jens Krämer over 1 year ago

relates to issue #6857

#4 Updated by Colin Mollenhour over 1 year ago

Also related to #9703.

#5 Updated by Robert Rath about 1 year ago

Thank you Jens,

I have found this patch invaluable and have updated the patch against redmine-1.3-stable r9308 for convenience.

...Robert

#6 Updated by 勇刚 罗 about 1 year ago

关联到 Feature #779: Multiple SCM per project

#7 Updated by Jens Krämer about 1 year ago

I don't understand your comment ;-)

however this patch is not about multiple SCM per project but about multiple projects per SCM - so you can reference the same repository in multiple projects, i.e. one for development and one for exception tracking via the hoptoad_notifier-plugin.

#8 Updated by Jens Krämer about 1 year ago

@robert - very appreciated - think I'll need to upgrade that Redmine setup to 1.3 or even 1.4 soon...

#9 Updated by Roman Lukmanov 4 months ago

Hi!

I've applied this patch (invert_project_repository_relationship_2-1.3-stable-9308.patch) and get the 500 error.
In log:

[redmine log]# tail -15 production.log
  EnabledModule Load (0.1ms)   SELECT name FROM `enabled_modules` WHERE (`enabled_modules`.project_id = 76)
  Project Load (0.0ms)   Mysql::Error: Unknown column 'projects.repository_id' in 'where clause': SELECT `projects`.id FROM `projects` WHERE (`projects`.`id` = 76) AND (`projects`.repository_id = NULL) LIMIT 1

ActiveRecord::StatementInvalid (Mysql::Error: Unknown column 'projects.repository_id' in 'where clause': SELECT `projects`.id FROM `projects` WHERE (`projects`.`id` = 76) AND (`projects`.repository_id = NULL)  LIMIT 1):
  app/controllers/repositories_controller.rb:41:in `edit'
  /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
  /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
  /usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
  /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start'
  /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
  /usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'
  /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each'
  /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'
  /usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'
  /usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'

Redmine version is 1.3.2

#10 Updated by Charles Sporkman 3 months ago

Anyone taken a stab at getting this working under 2.2.x yet?

Also available in: Atom PDF