# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
--- J:\application_helper.rb
+++ J:\application_helper_new.rb
@@ -422,7 +422,12 @@
     #     #52 -> Link to issue #52
     #   Changesets:
     #     r52 -> Link to revision 52
+    #     r:project:52 -> Link to revision 52 of an other project, using project name or identifier
     #     commit:a85130f -> Link to scmid starting with a85130f
+    #     commit:project:a85130f -> Link to scmid starting with a85130f of an other project, using project name or identifier
     #   Documents:
     #     document#17 -> Link to document with id 17
     #     document:Greetings -> Link to the document with title "Greetings"
@@ -441,16 +446,26 @@
     #     export:some/file -> Force the download of the file
     #  Forum messages:
     #     message#1218 -> Link to message with id 1218
-    text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|version|commit|source|export|message)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|,|\s|<|$)}) do |m|
-      leading, esc, prefix, sep, oid = $1, $2, $3, $5 || $7, $6 || $8
+    text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|version|commit|source|export|message)?((#|r)(:[^\:]+:)?(\d+)|(:)([^\:]+:)?([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|,|\s|<|$)}) do |m|
+      leading, esc, prefix, sep, revproj, oid = $1, $2, $3, $8 || $5, $9 || $6, $10 || $7
       link = nil
       if esc.nil?
         if prefix.nil? && sep == 'r'
+          if revproj.nil?
           if project && (changeset = project.changesets.find_by_revision(oid))
             link = link_to("r#{oid}", {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => oid},
                                       :class => 'changeset',
                                       :title => truncate_single_line(changeset.comments, :length => 100))
           end
+          else
+            revproj.gsub!(/[\:"]/,'')
+            link_project = Project.find_by_name(h(revproj)) || Project.find_by_identifier(h(revproj))
+            if link_project && (changeset = link_project.changesets.find_by_revision(oid))
+              link = link_to h("#{revproj}:r#{oid}"), {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => link_project, :rev => oid},
+                :class => 'changeset',
+                :title => truncate_single_line(changeset.comments, :length => 100)
+            end            
+          end
         elsif sep == '#'
           oid = oid.to_i
           case prefix
@@ -497,11 +512,21 @@
                                               :class => 'version'
             end
           when 'commit'
+            if revproj.nil?
             if project && (changeset = project.changesets.find(:first, :conditions => ["scmid LIKE ?", "#{name}%"]))
               link = link_to h("#{name}"), {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => changeset.revision},
                                            :class => 'changeset',
                                            :title => truncate_single_line(changeset.comments, :length => 100)
             end
+            else
+              revproj.gsub!(/[\:"]/,'')
+              link_project = Project.find_by_name(h(revproj)) || Project.find_by_identifier(h(revproj))
+              if link_project && (changeset = link_project.changesets.find(:first, :conditions => ["scmid LIKE ?", "#{name}%"]))
+                link = link_to h("#{revproj}:#{name}"), {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => link_project, :rev => changeset.revision},
+                  :class => 'changeset',
+                  :title => truncate_single_line(changeset.comments, :length => 100)
+              end
+            end
           when 'source', 'export'
             if project && project.repository
               name =~ %r{^[/\\]*(.*?)(@([0-9a-f]+))?(#(L\d+))?$}
