cornercorner
FeaturesPluginsDocs & SupportCommunityPartners

Bug 123982 - Annotate fails when revision numbers differ in digit length
: Annotate fails when revision numbers differ in digit length
Status: RESOLVED FIXED
: versioncontrol
Mercurial
: 6.1
: All All
: P3 (vote)
: 6.1
Assigned To:
:
:
:
:
:
:
  Show dependency treegraph
 
Reported: 2007-12-13 21:44 by
Modified: 2008-01-03 09:40 (History)
Issue Type: DEFECT
:


Attachments
Proposed patch (3.50 KB, text/plain)
2007-12-20 15:45, John Rice
Details
Patch to correct Pattern (1014 bytes, text/plain)
2007-12-21 10:22, John Rice
Details
Patch to work around Pattern issue with content colons (1.62 KB, text/plain)
2007-12-21 10:59, John Rice
Details


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2007-12-13 21:44:59
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 From 2007-12-18 20:12:46 -------
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 From 2007-12-20 15:45:50 -------
Created an attachment (id=54417) [details]
Proposed patch
------- Comment #3 From 2007-12-20 15:59:10 -------
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 From 2007-12-20 17:48:49 -------
Note: command used to fetch test data:

$ hg clone https://<netbeans user id>:hguser@hg.netbeans.org/main main
------- Comment #5 From 2007-12-21 10:22:04 -------
Created an attachment (id=54443) [details]
Patch to correct Pattern
------- Comment #6 From 2007-12-21 10:59:11 -------
Created an attachment (id=54444) [details]
Patch to work around Pattern issue with content colons
------- Comment #7 From 2007-12-21 11:00:50 -------
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