This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 220923 - Patch for: Blame tooltip of GIT/Mercurial/Subversion does not show commit message when team server plugin is enabled
Summary: Patch for: Blame tooltip of GIT/Mercurial/Subversion does not show commit mes...
Status: RESOLVED FIXED
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Ondrej Vrabec
URL:
Keywords: NETFIX
Depends on:
Blocks:
 
Reported: 2012-10-26 13:45 UTC by markiewb
Modified: 2012-10-30 11:13 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Showing the error and the patch in action (52.11 KB, image/png)
2012-10-26 13:46 UTC, markiewb
Details
Patch for git (2.58 KB, patch)
2012-10-26 13:52 UTC, markiewb
Details | Diff
Patch for hg (2.62 KB, patch)
2012-10-26 13:53 UTC, markiewb
Details | Diff
Patch for svn (2.63 KB, patch)
2012-10-26 13:53 UTC, markiewb
Details | Diff
Patch - resetting l to null (git-hg-subversion) (2.08 KB, patch)
2012-10-26 16:58 UTC, markiewb
Details | Diff
Patch - no reuse of local variable - use braces (git-hg-subversion) (12.60 KB, patch)
2012-10-26 16:59 UTC, markiewb
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description markiewb 2012-10-26 13:45:35 UTC
[ BUILD # : 20121010 ]
[ JDK VERSION : 1.6.37 ]

Reproduction:
* enable/install the team server plugin
* show annotations for a (team server)-supported module (f.e. NetBeans 
sources - module "projectui") 
* click on a revision in the annotation bar -> a colored tooltip window opens

ACTUAL: Instead of commit message the user is shown the second time
EXPECTED: commit message is shown

See screenshot.
Comment 1 markiewb 2012-10-26 13:46:19 UTC
Created attachment 126622 [details]
Showing the error and the patch in action
Comment 2 markiewb 2012-10-26 13:52:37 UTC
Created attachment 126623 [details]
Patch for git
Comment 3 markiewb 2012-10-26 13:53:02 UTC
Created attachment 126624 [details]
Patch for hg
Comment 4 markiewb 2012-10-26 13:53:28 UTC
Created attachment 126625 [details]
Patch for svn
Comment 5 markiewb 2012-10-26 13:58:11 UTC
I like to contribute patches to solve this issue. The modules git/mercurial/subversion are affected. (there had to be 3 patches because of the open task http://netbeans.org/bugzilla/show_bug.cgi?id=213679)

Cause of error: 2 links (author/issue linker) were added with the same id and the variable of author was reused. 

@NetBeans-Dev: Please review, discuss with me and commit!
Comment 6 Ondrej Vrabec 2012-10-26 14:38:17 UTC
Hi, thanks for noticing this, the evaluation and the patches, they were helpful. However the problem is slightly somewhere else. It seems you do not have bugtracking.bridge module installed (or enabled). Without this module (where we implement the abstract class VCSHyperlinkProvider) the following block of code will be skipped:
> for (VCSHyperlinkProvider hp : providers) {
>     l = IssueLinker.create(hp, hyperlinkStyle, master.getRepositoryRoot(), doc, commitMessage);
>     if (l != null) {
>         linkerSupport.add(l, 0);
>         break;
>     }
> }
and "l" will be still set to an instance of AuthorLinker.class as you correctly realized.

> Cause of error: 2 links (author/issue linker) were added with the same id and
> the variable of author was reused.
It's no problem in this case. As far as the instances are of different classes it won't matter, take a look into VCSHyperlinkSupport.add - there's a list of linker instances that we associate with a specific ID. In case of these tooltips the ID can be still the same. In fact it should be the same IMHO. You see, the different ids make sense e.g. in case of a search history view, where you have a list of revisions, each revision/row has a specific id and we associate a set of linker instances (one author, one messaage etc.) with each revision=ID.
And if you take the tooltip window you actually have just one revision - so the id should be the same. I know this pseudo API is difficult to comprehend, it is sometimes difficult even for the authors.

The correct fix here is trivial, simply add "l = null;" before the above mentioned code and it will work (i hope). Please make this modification, try and test it and attach the patches again. This time please merge the three modifications into one single file, i will commit and push your changes as one commit anyway.
Comment 7 markiewb 2012-10-26 16:58:11 UTC
Created attachment 126638 [details]
Patch - resetting l to null (git-hg-subversion)

(In reply to comment #6)
> The correct fix here is trivial, simply add "l = null;" before the above
> mentioned code and it will work (i hope). Please make this modification, try
> and test it and attach the patches again. This time please merge the three
> modifications into one single file, i will commit and push your changes as one
> commit anyway.

Here the updated trivial patch. It works for me, tested with hg.

IMHO reusing a local variable is ugly. So i will provide another patch which does not reuse the local variable. You may decide which one you want to commit.
Comment 8 markiewb 2012-10-26 16:59:20 UTC
Created attachment 126639 [details]
Patch - no reuse of local variable - use braces (git-hg-subversion)

Patch which uses braces instead of reusing a local variable
Comment 9 Ondrej Vrabec 2012-10-29 10:47:30 UTC
thanks for the patch, i just pushed it into the repository: http://hg.netbeans.org/core-main/rev/1735ebb8228f
Comment 10 Quality Engineering 2012-10-30 02:34:04 UTC
Integrated into 'main-golden', will be available in build *201210300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/1735ebb8228f
User: markiewb@netbeans.org
Log: Issue #220923 - Blame tooltip of GIT/Mercurial/Subversion does not show commit message when team server plugin is enabled
stop reusing the author linker if no bugtracking system is activated