Permalink
Browse files

Add the concept of a 'tag' event to convert_logs.py

  • Loading branch information...
1 parent 9e0163d commit 85b2e2c23bc379fd0b06a2ea8674565879418f6d @rictic committed Feb 11, 2010
Showing with 21 additions and 9 deletions.
  1. +21 −9 bin/convert_logs.py
View
@@ -178,9 +178,8 @@ def create_event_xml(events, output):
(None, "author"):"author"}
for event in events:
- generator.startElement("event", event.properties())
-
- generator.endElement("event")
+ generator.startElement(event.kind, event.properties())
+ generator.endElement(event.kind)
generator.endElement('file_events')
generator.endDocument()
@@ -486,13 +485,20 @@ def run_marshal(command):
stream.close()
return results
-class Event(object):
+class AbstractEvent(object):
+ # Some version control system's logs are not in chronological order, so
+ # this compare method will return a compare of the date attributes.
+ def __cmp__(self, other):
+ return cmp(self.date, other.date)
+
+class Event(AbstractEvent):
""" Event to hold all of the separate events as we parse them from the logs. """
def __init__(self, filename, date, author):
self.filename = filename
self.date = date
self.author = author
+ self.kind = "event"
def properties(self):
"""returns a dict of properties and their names for XML serialization"""
@@ -502,11 +508,17 @@ def properties(self):
"author": self.author
}
- # Some version control system's logs are not in chronological order, so
- # this compare method will return a compare of the date attributes.
- def __cmp__(self, other):
- return cmp(self.date, other.date)
-
+class Tag(AbstractEvent):
+ def __init__(self, name, date):
+ self.name
+ self.date
+ self.kind = "tag"
+
+ def properties(self):
+ return {
+ "name": self.name,
+ "date": str(self.date)
+ }
# Main entry point.
if __name__ == "__main__":

0 comments on commit 85b2e2c

Please sign in to comment.