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 123982

Summary: Annotate fails when revision numbers differ in digit length
Product: versioncontrol Reporter: Jesse Glick <jglick>
Component: MercurialAssignee: issues@versioncontrol <issues>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Proposed patch
Patch to correct Pattern
Patch to work around Pattern issue with content colons

Description Jesse Glick 2007-12-13 21:44:59 UTC
From the command line, I run annotate on a file and get results like:

 7154: <?xml version="1.0" encoding="UTF-8"?>
 7154: <!--
10972: DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 7154: 
10972: Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
 7154: 
10972: 
[....]

From NB, using the latest Hg NBM, the 10972 lines are correctly annotated, but the 7154 lines are marked just "jlahoda"
(the author) and are missing a log message.

The reason is clear from looking at AnnotateAction.toAnnotateLines, which falsely assumes that there is only one space
between the author and the revision number, thus misparsing the whole line.

Anyway it would be simpler and clearer to use a regular expression in this case: extract the necessary info using
Matcher.group(int), and log a warning in case the regexp fails to match.
Comment 1 Jesse Glick 2007-12-18 20:12:46 UTC
BTW I just tried running annotate from the IDE (using today's version of the NBM) on

main/ant.freeform/src/org/netbeans/modules/ant/freeform/Actions.java

(from hg.netbeans.org) and it does not work at all. Shows annotations on only a handful of lines; some with version
number, some without. In this case all the version numbers are 5 digits, I think.
Comment 2 John Rice 2007-12-20 15:45:50 UTC
Created attachment 54417 [details]
Proposed patch
Comment 3 John Rice 2007-12-20 15:59:10 UTC
Committed to Head:

IDE:-------------------------------------------------
IDE: [20/12/07 15:58] Committing "AnnotateAction.java" started
Checking in AnnotateAction.java;
/shared/data/ccvs/repository/versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/annotate/AnnotateAction.java,v
 <--  AnnotateAction.java
new revision: 1.8; previous revision: 1.7
done
IDE: [20/12/07 15:58] Committing "AnnotateAction.java" finished
IDE: [20/12/07 15:58] Diffing finished
IDE: [20/12/07 15:58] Diffing finished
Comment 4 John Rice 2007-12-20 17:48:49 UTC
Note: command used to fetch test data:

$ hg clone https://<netbeans user id>:hguser@hg.netbeans.org/main main
Comment 5 John Rice 2007-12-21 10:22:04 UTC
Created attachment 54443 [details]
Patch to correct Pattern
Comment 6 John Rice 2007-12-21 10:59:11 UTC
Created attachment 54444 [details]
Patch to work around Pattern issue with content colons
Comment 7 John Rice 2007-12-21 11:00:50 UTC
Seems to be a Pattern bug where (\\b.*): is not matching filename and first colon, but matches colon in content. Changed
to use (\\b\\S*): for any non-White space char match and all lines are correctly annotated now.

IDE:-------------------------------------------------
IDE: [21/12/07 10:57] Committing started
Checking in ui/annotate/AnnotateAction.java;
/shared/data/ccvs/repository/versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/annotate/AnnotateAction.java,v
 <--  AnnotateAction.java
new revision: 1.10; previous revision: 1.9
done
Checking in FileInformation.java;
/shared/data/ccvs/repository/versioncontrol/mercurial/src/org/netbeans/modules/mercurial/FileInformation.java,v  <-- 
FileInformation.java
new revision: 1.6; previous revision: 1.5
done
IDE: [21/12/07 10:57] Committing finished
IDE: [21/12/07 10:57] Diffing finished