Example #1
0
 def p_file_term(p):
     '''file_term : OP_FILE string'''
     if p[2].startswith('^'):
         p[0] = and_(or_(func.matches(p[2], gertty.db.file_table.c.path),
                         func.matches(p[2], gertty.db.file_table.c.old_path)),
                     gertty.db.file_table.c.status is not None)
     else:
         p[0] = and_(or_(gertty.db.file_table.c.path == p[2],
                         gertty.db.file_table.c.old_path == p[2]),
                     gertty.db.file_table.c.status is not None)
Example #2
0
 def p_path_term(p):
     '''path_term : OP_PATH string'''
     if p[2].startswith('^'):
         p[0] = and_(
             or_(func.matches(p[2], hubtty.db.file_table.c.path),
                 func.matches(p[2], hubtty.db.file_table.c.old_path)),
             hubtty.db.file_table.c.status is not None)
     else:
         p[0] = and_(
             or_(hubtty.db.file_table.c.path == p[2],
                 hubtty.db.file_table.c.old_path == p[2]),
             hubtty.db.file_table.c.status is not None)
Example #3
0
 def p_file_term(p):
     '''file_term : OP_FILE string'''
     if p[2].startswith('^'):
         p[0] = and_(
             or_(func.matches(p[2], gertty.db.file_table.c.path),
                 func.matches(p[2], gertty.db.file_table.c.old_path)),
             gertty.db.file_table.c.status is not None)
     else:
         p[0] = and_(
             or_(gertty.db.file_table.c.path == p[2],
                 gertty.db.file_table.c.old_path == p[2]),
             gertty.db.file_table.c.status is not None)
Example #4
0
 def p_file_term(p):
     '''file_term : OP_FILE string'''
     if p[2].startswith('^'):
         p[0] = and_(
             or_(func.matches(p[2], hubtty.db.file_table.c.path),
                 func.matches(p[2], hubtty.db.file_table.c.old_path)),
             hubtty.db.file_table.c.status is not None)
     else:
         file_re = '(^|.*/)%s(/.*|$)' % re.escape(p[2])
         p[0] = and_(
             or_(func.matches(file_re, hubtty.db.file_table.c.path),
                 func.matches(file_re, hubtty.db.file_table.c.old_path)),
             hubtty.db.file_table.c.status is not None)
Example #5
0
 def p_branch_term(p):
     '''branch_term : OP_BRANCH string
                    | OP_BASE string'''
     if p[2].startswith('^'):
         p[0] = func.matches(p[2], hubtty.db.pull_request_table.c.branch)
     else:
         p[0] = hubtty.db.pull_request_table.c.branch == p[2]
Example #6
0
 def p_topic_term(p):
     '''topic_term : OP_TOPIC string'''
     if p[2].startswith('^'):
         p[0] = func.matches(p[2], gertty.db.change_table.c.topic)
     else:
         p[0] = and_(gertty.db.change_table.c.topic.isnot(None),
                     gertty.db.change_table.c.topic == p[2])
Example #7
0
 def p_ref_term(p):
     '''ref_term : OP_REF string'''
     if p[2].startswith('^'):
         p[0] = func.matches(
             p[2], 'refs/heads/' + gertty.db.change_table.c.branch)
     else:
         p[0] = gertty.db.change_table.c.branch == p[2][len('refs/heads/'):]
Example #8
0
 def p_topic_term(p):
     '''topic_term : OP_TOPIC string'''
     if p[2].startswith('^'):
         p[0] = func.matches(p[2], gertty.db.change_table.c.topic)
     else:
         p[0] = and_(gertty.db.change_table.c.topic.isnot(None),
                     gertty.db.change_table.c.topic == p[2])
Example #9
0
 def p_commit_term(p):
     '''commit_term : OP_COMMIT string'''
     filters = []
     filters.append(hubtty.db.commit_table.c.pr_key ==
                    hubtty.db.pull_request_table.c.key)
     filters.append(func.matches(p[2], hubtty.db.commit_table.c.sha))
     s = select([hubtty.db.pull_request_table.c.key],
                correlate=False).where(and_(*filters))
     p[0] = hubtty.db.pull_request_table.c.key.in_(s)
Example #10
0
 def p_user_term(p):
     '''user_term : OP_USER string
                  | OP_ORG string
                  | OP_REPO string'''
     p[0] = func.matches(p[2] + '/', hubtty.db.pull_request_table.c.pr_id)
Example #11
0
 def p_ref_term(p):
     '''ref_term : OP_REF string'''
     if p[2].startswith('^'):
         p[0] = func.matches(p[2], 'refs/heads/'+gertty.db.change_table.c.branch)
     else:
         p[0] = gertty.db.change_table.c.branch == p[2][len('refs/heads/'):]
Example #12
0
 def p_branch_term(p):
     '''branch_term : OP_BRANCH string'''
     if p[2].startswith('^'):
         p[0] = func.matches(p[2], gertty.db.change_table.c.branch)
     else:
         p[0] = gertty.db.change_table.c.branch == p[2]
Example #13
0
 def p_project_term(p):
     '''project_term : OP_PROJECT string'''
     if p[2].startswith('^'):
         p[0] = func.matches(p[2], gertty.db.project_table.c.name)
     else:
         p[0] = gertty.db.project_table.c.name == p[2]
Example #14
0
 def p_branch_term(p):
     '''branch_term : OP_BRANCH string'''
     if p[2].startswith('^'):
         p[0] = func.matches(p[2], gertty.db.change_table.c.branch)
     else:
         p[0] = gertty.db.change_table.c.branch == p[2]
Example #15
0
 def p_project_term(p):
     '''project_term : OP_PROJECT string'''
     if p[2].startswith('^'):
         p[0] = func.matches(p[2], gertty.db.project_table.c.name)
     else:
         p[0] = gertty.db.project_table.c.name == p[2]