drawcode / codeswarm

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

Problem while converting svn logs. #54

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Right now, the convert_logs.py script will be unable to process properly a 
svn log file which contains empty commits; commits without any "Changed 
Files:" line that is, such as one which changes svn attributes.

Attached's one patch I wrote that seems to be working fine to parse my svn 
repositories properly.

---
 convert_logs/convert_logs.py |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/convert_logs/convert_logs.py b/convert_logs/convert_logs.py
index 5cae2c0..84b0cba 100644
--- a/convert_logs/convert_logs.py
+++ b/convert_logs/convert_logs.py
@@ -117,17 +117,18 @@ def main():
                     date = int(time.mktime(date))*1000

                     # Skip the 'Changed paths:' line and start reading in 
the changed filenames.
-                    file_handle.readline()
-                    path = file_handle.readline()
-                    while len(path) > 1:
-                        ch_path = None
-                        if opts.svn_log:
-                            ch_path = path[5:].split(" 
(from")[0].replace("\n", "")
-                        else:
-                            # git uses quotes if filename contains 
unprintable characters
-                            ch_path = path[2:].replace("\n", 
"").replace("\"", "")
-                        event_list.append(Event(ch_path, date, author))
+                    changed = file_handle.readline()
+                    if changed.startswith("Changed paths:"):
                         path = file_handle.readline()
+                        while len(path) > 1:
+                            ch_path = None
+                            if opts.svn_log:
+                                ch_path = path[5:].split(" 
(from")[0].replace("\n", "")
+                            else:
+                                # git uses quotes if filename contains 
unprintable characters
+                                ch_path = path[2:].replace("\n", 
"").replace("\"", "")
+                            event_list.append(Event(ch_path, date, 
author))
+                            path = file_handle.readline()

                 line = file_handle.readline()
             file_handle.close()
--
1.6.1.rc2.20.gde0d

Original issue reported on code.google.com by pixel.no...@gmail.com on 16 Mar 2009 at 9:37