def get_methods(self, dev_hash, project_id=None, start_date=None, end_date=None): """Returns all methods updated by a developer. Optionally it also filters by project_id :params dev_hash: developer unique identifier :params project_id: optional; if present the query returns the files from a specific project :param start_date: optional timestamp; filter files beginning with this date :param end_date: optional timestamp; filter files untill this date :returns: list of methods """ com_filter, where = fcid(project_id, start_date, end_date) query = """ MATCH (d:Developer {{hash: "{0}"}}) -[r:Author]-> (c:Commit {1}) -[um: UpdateMethod]-> (m: Method) {2} RETURN distinct m; """.format(dev_hash, com_filter, where) dt_ = self.graph.run(query) return [dict(x['m']) for x in dt_.data()]
def get_files_updates(self, dev_hash, project_id=None, start_date=None, end_date=None): """Returns all file update information (e.g. file complexity), for all files edited by a developer. Optionally it also filters by project_id :params dev_hash: developer unique identifier :params project_id: optional; if present the query returns the files from a specific project :param start_date: optional timestamp; filter files beginning with this date :param end_date: optional timestamp; filter files untill this date :returns: list of file updates """ com_filter, where = fcid(project_id, start_date, end_date) query = """ MATCH (d:Developer {{hash: "{0}"}}) -[r:Author]-> (c:Commit {1}) -[fu: UpdateFile]-> (f: File) {2} RETURN distinct fu; """.format(dev_hash, com_filter, where) dt_ = self.graph.run(query) return [dict(x['fu']) for x in dt_.data()]
def get_commits(self, dev_hash, project_id=None, start_date=None, end_date=None): """Returns all commits authored by a developer. Optionally, it also filters by project id :param dev_hash: developer unique identifier :param project_id: optional; if present the query returns the commits from a project :param start_date: optional timestamp; filter commits beginning with this date :param end_date: optional timestamp; filter commits untill this date :returns: list of commits """ com_filter, where = fcid(project_id, start_date, end_date) cquery = """ MATCH (d:Developer {{hash: "{0}"}}) -[r:Author]-> (c:Commit {1}) {2} RETURN distinct c; """.format(dev_hash, com_filter, where) dt_ = self.graph.run(cquery) return [dict(x['c']) for x in dt_.data()]