private
# Finds an issue that can be referenced by the commit message
- # i.e. an issue that belong to the repository project, a subproject or a parent project
def find_referenced_issue_by_id(id)
return nil if id.blank?
issue = Issue.find_by_id(id.to_i, :include => :project)
- if issue
+ if Setting.commit_cross_project_ref?
+ # all issues can be referenced/fixed
+ elsif issue
+ # issue that belong to the repository project, a subproject or a parent project only
unless issue.project &&
(project == issue.project || project.is_ancestor_of?(issue.project) ||
project.is_descendant_of?(issue.project))
:label => false %>
<br /><em><%= l(:text_comma_separated) %></em></p>
+<p><%= setting_check_box :commit_cross_project_ref %></p>
+
<p><%= setting_check_box :commit_logtime_enabled,
:onclick =>
"if (this.checked) { Form.Element.enable('settings_commit_logtime_activity_id'); } else { Form.Element.disable('settings_commit_logtime_activity_id'); }"%></p>
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
description_date_range_interval: Изберете диапазон чрез задаване на начална и крайна дати
description_date_from: Въведете начална дата
description_date_to: Въведете крайна дата
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_item_position: "%{position}/%{count}"
label_completed_versions: Completed versions
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_item_position: "%{position} of %{count}"
label_completed_versions: Completed versions
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
setting_issue_group_assignment: Allow issue assignment to groups
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
permission_add_project: Create project
permission_add_subprojects: Create subprojects
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
setting_gantt_items_limit: Nombre maximum d'éléments affichés sur le gantt
setting_issue_group_assignment: Permettre l'assignement des demandes aux groupes
setting_default_issue_start_date_to_creation_date: Donner à la date de début d'une nouvelle demande la valeur de la date du jour
+ setting_commit_cross_project_ref: Permettre le référencement et la résolution des demandes de tous les autres projets
permission_add_project: Créer un projet
permission_add_subprojects: Créer des sous-projets
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_item_position: "%{position}/%{count}"
label_completed_versions: Completed versions
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
label_completed_versions: Completed versions
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Multiple values
+ setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
default: 0
sys_api_key:
default: ''
+commit_cross_project_ref:
+ default: 0
commit_ref_keywords:
default: 'refs,references,IssueID'
commit_fix_keywords:
assert c.issues.first.project != c.project
end
+ def test_commit_referencing_a_project_with_commit_cross_project_ref_disabled
+ r = Repository::Subversion.create!(
+ :project => Project.find(3),
+ :url => 'svn://localhost/test')
+
+ with_settings :commit_cross_project_ref => '0' do
+ c = Changeset.new(:repository => r,
+ :committed_on => Time.now,
+ :comments => 'refs #4, an issue of a different project',
+ :revision => '12345')
+ assert c.save
+ assert_equal [], c.issue_ids
+ end
+ end
+
+ def test_commit_referencing_a_project_with_commit_cross_project_ref_enabled
+ r = Repository::Subversion.create!(
+ :project => Project.find(3),
+ :url => 'svn://localhost/test')
+
+ with_settings :commit_cross_project_ref => '1' do
+ c = Changeset.new(:repository => r,
+ :committed_on => Time.now,
+ :comments => 'refs #4, an issue of a different project',
+ :revision => '12345')
+ assert c.save
+ assert_equal [4], c.issue_ids
+ end
+ end
+
def test_text_tag_revision
c = Changeset.new(:revision => '520')
assert_equal 'r520', c.text_tag