Skip to content

Commit

Permalink
fix db queries to work as trac expects, not just as sqlite happens to…
Browse files Browse the repository at this point in the history
… accept
  • Loading branch information
cotto committed Sep 3, 2010
1 parent 846c629 commit 25c3650
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions github/github.py
Expand Up @@ -207,18 +207,17 @@ def post_process_request(self, req, template, data, content_type):
def _get_commit_data(self, commit_id):
if int(self.enable_revmap) == 0:
return False
self.env.log.debug("looking up revision: %s" % commit_id)
self.env.log.debug("looking up commit: %s" % commit_id)
cursor = self.env.get_db_cnx().cursor()
try:
if commit_id.startswith('r'):
commit_id = commit_id[1:]
row = cursor.execute("SELECT git_hash, commit_msg FROM svn_revmap WHERE svn_rev = %s;" % commit_id).fetchone()
self.env.log.debug("running query: SELECT git_hash, commit_msg FROM svn_revmap WHERE svn_rev = %s;" % commit_id)
else:
row = cursor.execute("SELECT git_hash, commit_msg FROM svn_revmap WHERE git_hash LIKE '%s%%';" % commit_id).fetchone()
self.env.log.debug("running query: SELECT git_hash, commit_msg FROM svn_revmap WHERE git_hash LIKE '%s%%';" % commit_id)
except AttributeError:
return False
if commit_id.startswith('r'):
commit_id = commit_id[1:]
self.env.log.debug("running query: SELECT git_hash, commit_msg FROM svn_revmap WHERE svn_rev = %s" % commit_id)
cursor.execute("SELECT git_hash, commit_msg FROM svn_revmap WHERE svn_rev = %s", (commit_id,))
row = cursor.fetchone();
else:
self.env.log.debug("running query: SELECT git_hash, commit_msg FROM svn_revmap WHERE git_hash LIKE '%s%%'" % commit_id)
cursor.execute("SELECT git_hash, commit_msg FROM svn_revmap WHERE git_hash LIKE '%s%%'" % (commit_id,))
row = cursor.fetchone()
if row:
return {
'hash': row[0],
Expand Down

0 comments on commit 25c3650

Please sign in to comment.