https://defect.opensolaris.org/bz/show_bug.cgi?id=16764

           Summary: Perforce source annotation - the date is one month
                    ahead, time information is not available
    Classification: Development
           Product: opengrok
           Version: unspecified
          Platform: ANY/Generic
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P3
         Component: scm
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


--- Comment #0 from Yuriy Vasylchenko <[email protected]> 2010-08-09 23:40:33 
UTC ---
In Perforce date format, the month value is "1"-, not "0"-based.
Time information will be available if "-t" flag was specified for p4 commands
(some of them :)
UDiff of the fixed source based on version 0.9:



--- src.ori/org/opensolaris/opengrok/history/PerforceHistoryParser.java
2010-05-11 02:12:43.000000000 -0700
+++ src/org/opensolaris/opengrok/history/PerforceHistoryParser.java    
2010-08-09 16:00:29.900603765 -0700
@@ -70,6 +70,7 @@
         ArrayList<String> cmd = new ArrayList<String>();
         cmd.add("p4");
         cmd.add("changes");
+        cmd.add("-t");
         cmd.add("...");

         Executor executor = new Executor(cmd, file.getCanonicalFile());
@@ -81,7 +82,7 @@
         ArrayList<String> cmd = new ArrayList<String>();
         cmd.add("p4");
         cmd.add("filelog");
-        cmd.add("-l");
+        cmd.add("-lt");
         cmd.add(file.getName() + ((rev == null) ? "" : "#"+rev));
         Executor executor = new Executor(cmd,
file.getCanonicalFile().getParentFile());
         executor.exec();
@@ -89,8 +90,8 @@
         return parseFileLog(executor.getOutputReader());
     }

-    private final static Pattern REVISION_PATTERN = Pattern.compile("#(\\d+)
change \\d+ \\S+ on (\\d{4})/(\\d{2})/(\\d{2}) by ([...@]+)");
-    private final static Pattern CHANGE_PATTERN = Pattern.compile("Change
(\\d+) on (\\d{4})/(\\d{2})/(\\d{2}) by ([...@]+)@\\S* '([^']*)'");
+    private final static Pattern REVISION_PATTERN = Pattern.compile("#(\\d+)
change \\d+ \\S+ on (\\d{4})/(\\d{2})/(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2}) by
([...@]+)");
+    private final static Pattern CHANGE_PATTERN = Pattern.compile("Change
(\\d+) on (\\d{4})/(\\d{2})/(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2}) by 
([...@]+)@\\S*
'([^']*)'");

     /**
      * Parses the history in the given string. The given reader will be
closed.
@@ -114,12 +115,16 @@
                 HistoryEntry entry = new HistoryEntry();
                 entry.setRevision(matcher.group(1));
                 int year = Integer.parseInt(matcher.group(2));
-                int month = Integer.parseInt(matcher.group(3));
+                int month = Integer.parseInt(matcher.group(3))-1;
                 int day = Integer.parseInt(matcher.group(4));
-                Calendar calendar = new GregorianCalendar(year, month, day);
+                int hour = Integer.parseInt(matcher.group(5));
+                int minute = Integer.parseInt(matcher.group(6));
+                int second = Integer.parseInt(matcher.group(7));
+                Calendar calendar = new GregorianCalendar(year, month, day,
+                                                          hour, minute,
second);
                 entry.setDate(calendar.getTime());
-                entry.setAuthor(matcher.group(5));
-                entry.setMessage(matcher.group(6).trim());
+                entry.setAuthor(matcher.group(8));
+                entry.setMessage(matcher.group(9).trim());
                 entry.setActive(true);
                 entries.add(entry);
             }
@@ -153,11 +158,15 @@
                 entry = new HistoryEntry();
                 entry.setRevision(matcher.group(1));
                 int year = Integer.parseInt(matcher.group(2));
-                int month = Integer.parseInt(matcher.group(3));
+                int month = Integer.parseInt(matcher.group(3))-1;
                 int day = Integer.parseInt(matcher.group(4));
-                Calendar calendar = new GregorianCalendar(year, month, day);
+                int hour = Integer.parseInt(matcher.group(5));
+                int minute = Integer.parseInt(matcher.group(6));
+                int second = Integer.parseInt(matcher.group(7));
+                Calendar calendar = new GregorianCalendar(year, month, day,
+                                                          hour, minute,
second);
                 entry.setDate(calendar.getTime());
-                entry.setAuthor(matcher.group(5));
+                entry.setAuthor(matcher.group(8));
                 entry.setActive(true);
             } else {
                 if (entry != null) {

-- 
Configure bugmail: https://defect.opensolaris.org/bz/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
opengrok-dev mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opengrok-dev

Reply via email to