Diff Email Plugin: Repository.diff("", previous.revision, revision) crashes

Added by GJ Roelofs about 10 years ago

I am trying to get the Diff Email Plugin working again on latest trunk.

At the moment it crashes on the spot when trying to access: repository.diff("", previous.revision, revision) in Changeset, and works if I remove this from the plugin.
(Crash comes when it accesses the code in the repository.diff, and crashes on the first method there.
NoMethodError to_i for SubversionAdapter, or NoMethodError gsub for AbstractAdapter with GIT )

I am a somewhat experienced programmer, but have no experience in Ruby (as of yet), and this error is kind of confusing to me as the plugin itself does not override the repository diff method, and on runtime seems to find the right method for different kinds of repos but suggests that there should be something wrong in the implementation itself?
(Which there isn't as redmine uses diff fine.)

Any help would be much appreciated!

Replies (3)

RE: Diff Email Plugin: Repository.diff("", previous.revision, revision) crashes - Added by GJ Roelofs about 10 years ago

Ok, so after learning some Ruby, and adding the following to diffmailer.rb:

helper: application
helper: repositories

// (Or doing it right and adding: helper: diffmailer to diffmailer.rb, and require_dependency's / include in diffmailer_helper.rb)

I can now successfully use textilizable to display the comments.
However, when I call render_changeset_changes through <% render_changeset_changes %>, I get empty output.

As my Ruby-fu is rather weak, I can only suspect that render_changeset_changes uses a global variable @changeset, which is not set in ActionMailer.
Now, if I then make a new method in diff_mailer.rb (or diffmailer_helper.rb), which copies render_changeset_changes, but adds a variable and names it render_changeset_change(changeset),
I get an error if I make the call.

Can anyone experienced in this give me a hand in the matter?

Thanks in advance

RE: Diff Email Plugin: Repository.diff("", previous.revision, revision) crashes - Added by GJ Roelofs about 10 years ago

Well, the call seems to forward to the new method now, but I still get zero output when calling either render_changeset_changes (as seen in repositories_helper.rb && revision.rhtml).

RE: Diff Email Plugin: Repository.diff("", previous.revision, revision) crashes - Added by GJ Roelofs about 10 years ago

GJB R wrote:

Well, the call seems to forward to the new method now, but I still get zero output when calling either render_changeset_changes (as seen in repositories_helper.rb && revision.rhtml) or the added method with the local variable.

(1-3/3)