dcorking / codeswarm

Automatically exported from code.google.com/p/codeswarm
GNU General Public License v3.0
2 stars 1 forks source link

CVS logs are not converted properly #49

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. First I got CVS activity.log by passing:
cvs log > activity.log
2. Then, I tryed to convert it into XML that code_swarm needed by passing: 
./convert_logs.py -c /var/www/wkpl/activity.log -o test.xml

What is the expected output? 
I expected to get XML document that is well formed for code_swarm :)

What do you see instead?
I got an error msg:
ValueError: time data did not match format:  data=2009-01-09 10:01:37 +0400
 fmt=%Y/%m/%d %H:%M:%S

What version of the product are you using? On what operating system?
CVS-client version is 1.12.13
Ubuntu 8.04
Code_swarm from your SVN (hope there is a latest version there)

Please provide any additional information below.
So, to fix this issue I tryed to change puthon scipt. Here is the svn diff
output:
dekoo@denis-laptop:/opt/codeswarm/convert_logs$ svn diff
Index: convert_logs.py
===================================================================
--- convert_logs.py (revision 255)
+++ convert_logs.py (working copy)
@@ -155,8 +155,9 @@
                     if(rev_line.lower().find("date:") == 0):
                         rev_parts = rev_line.split(';  ')
                         date_parts = rev_parts[0].split(": ")
-                        date = time.strptime(date_parts[1], '%Y/%m/%d
%H:%M:%S')
-                        date = int(time.mktime(date))*1000
+                        date_without_plus = date_parts[1].split("+");
+                        date = time.strptime(date_without_plus[0].strip(),
'%Y-%m-%d %H:%M:%S')
+            date = int(time.mktime(date))*1000
                         author = rev_parts[1].split(": ")[1]
                         event_list.append(Event(filename, date, author))

Now all work great for me.
Anyway thanks for this application, it rocks.

PS: Sorry for my bad english...

Original issue reported on code.google.com by code.ninjia@gmail.com on 1 Feb 2009 at 7:41

GoogleCodeExporter commented 9 years ago
Patch has been applied. Please verify.

Original comment by michael....@gmail.com on 20 Feb 2009 at 2:24

GoogleCodeExporter commented 9 years ago
python convert_logs.py -c cvslog.log -o cvslog.xml
Traceback (most recent call last):
  File "convert_logs.py", line 408, in <module>
    main()
  File "convert_logs.py", line 162, in main
    date = time.strptime(date_without_plus[0].strip(), '%Y-%m-%d %H:%M:%S')
  File "/usr/lib/python2.6/_strptime.py", line 454, in _strptime_time
    return _strptime(data_string, format)[0]
  File "/usr/lib/python2.6/_strptime.py", line 325, in _strptime
    (data_string, format))
ValueError: time data '2005/10/25 12:46:44' does not match format '%Y-%m-%d 
%H:%M:%S'

Looks like the problem still exists. The Download says May 2009 so I'm assuming 
it has the applied patch

Original comment by Slick...@gmail.com on 9 Jun 2010 at 4:14

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Replace lines 161 - 162

date_without_plus = date_parts[1].split("+");
date = time.strptime(date_without_plus[0].strip(), '%Y-%m-%d %H:%M:%S')

with

ymddate = date_parts[1].split(" ")
date = time.strptime(ymddate[0] + " " + ymddate[1], '%Y-%m-%d %H:%M:%S')

The split on + doesn't seem to work. (Escape it?)

Original comment by geopsyc...@gmail.com on 10 Oct 2010 at 9:03

GoogleCodeExporter commented 9 years ago
Follow up to previous comment. This problem looks like an issue of what your 
time difference is with GMT. In my case, the variable date_parts[1] contains

2005-04-06 22:14:36 -0500

Splitting on a + leaves the -0500 which causes time.strptime to choke. 
Splitting on a - is not good as the date has -'s. 

While the change I made is messy, it works.

Original comment by geopsyc...@gmail.com on 10 Oct 2010 at 10:58