Skip to content

Commit

Permalink
comment-only code to read git log output into db
Browse files Browse the repository at this point in the history
  • Loading branch information
cotto committed Aug 24, 2010
1 parent 9f8e0a7 commit 7f35256
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions github/github.py
Expand Up @@ -31,6 +31,7 @@ class GithubPlugin(Component):
SCHEMA = Table('svn_revmap', key = ('svn_rev', 'git_hash'))[
Column('svn_rev'),
Column('git_hash'),
Column('commit_msg'),
Index(['svn_rev', 'git_hash']),]


Expand Down Expand Up @@ -88,11 +89,16 @@ def _upgrade_db(self, db):

insert_count = 0
for line in revmap_fd:
[svn_rev, git_hash] = line.split()
insert_query = "INSERT INTO svn_revmap (svn_rev, git_hash) VALUES (%s, '%s')" % (svn_rev, git_hash)
#slurp the '===' line
#next line is the hash
#slurp lines into the commit messsages until there's a blank line, a line starting with git-svn-id or an ===
#if there's a git-svn-id,
#extract the svn revision number
#perform any necessary escaping on the commit messages
insert_query = "INSERT INTO svn_revmap (svn_rev, git_hash, commit_msg) VALUES (%s, '%s', '%s')" % (svn_rev, git_hash, commit_msg)
self.env.log.debug(insert_query)
cursor.execute(insert_query)
++insert_count
insert_count += 1

self.env.log.debug("inserted %d mappings into svn_revmap" % insert_count)

Expand Down

0 comments on commit 7f35256

Please sign in to comment.