points issues fix
This commit is contained in:
parent
55ac495ab9
commit
6899bf8545
|
@ -135,7 +135,8 @@ class GitRepository:
|
||||||
self.branch_name = self.data['default_branch']
|
self.branch_name = self.data['default_branch']
|
||||||
self._load_config()
|
self._load_config()
|
||||||
if self.config['user-agent'] != '*' and self.config['user-agent'] != 'githuboracle':
|
if self.config['user-agent'] != '*' and self.config['user-agent'] != 'githuboracle':
|
||||||
sys.exit("403 Forbidden")
|
print 'ignored exit' #sys.exit("403 Forbidden")
|
||||||
|
self.config['reward-mode'] = "words"
|
||||||
|
|
||||||
def _load_config(self):
|
def _load_config(self):
|
||||||
config_file = "https://raw.githubusercontent.com/"+self.data['full_name']+"/"+self.branch_name+"/.gitrobots"
|
config_file = "https://raw.githubusercontent.com/"+self.data['full_name']+"/"+self.branch_name+"/.gitrobots"
|
||||||
|
@ -263,21 +264,25 @@ class GitRepository:
|
||||||
link_issue = self.repo_link + "/issues/" + issueid
|
link_issue = self.repo_link + "/issues/" + issueid
|
||||||
issue = json.load(self.api.request(link_issue))
|
issue = json.load(self.api.request(link_issue))
|
||||||
link_issue = self.repo_link + "/issues/" + issueid + "/timeline"
|
link_issue = self.repo_link + "/issues/" + issueid + "/timeline"
|
||||||
issue_timeline = self.api.request(link_issue, None, ["Accept", "application/vnd.github.mockingbird-preview"])
|
issue_timeline = json.load(self.api.request(link_issue, None, None, [["Accept", "application/vnd.github.mockingbird-preview"]]))
|
||||||
for elem in issue_timeline:
|
for elem in issue_timeline:
|
||||||
if elem["event"] == "cross-referenced":
|
if elem["event"] == "cross-referenced":
|
||||||
if elem["source"]["type"] == "issue":
|
if elem["source"]["type"] == "issue":
|
||||||
pr = str(elem["source"]["issue"]["number"])
|
pr = str(elem["source"]["issue"]["number"])
|
||||||
#print pr
|
#print pr
|
||||||
link_pull = self.repo_link + "/pulls/" + pr
|
link_pull = self.repo_link + "/pulls/" + pr
|
||||||
pull = json.load(self.api.request(link_pull))
|
try:
|
||||||
if pull['merged_at']:
|
pull = json.load(self.api.request(link_pull))
|
||||||
link_pulls_commits = self.repo_link + "/pulls/" + pr + "/commits"
|
if pull['merged_at']:
|
||||||
commits = json.load(self.api.request(link_pulls_commits))
|
logmsg("Found cross-referenced pull "+pr+" merged at "+ pull['merged_at'])
|
||||||
for commit in commits:
|
link_pulls_commits = self.repo_link + "/pulls/" + pr + "/commits"
|
||||||
if commit['url']:
|
commits = json.load(self.api.request(link_pulls_commits))
|
||||||
_commit = json.load(self.api.request(commit['url']))
|
for commit in commits:
|
||||||
self.compute_points(_commit)
|
if commit['url']:
|
||||||
|
_commit = json.load(self.api.request(commit['url']))
|
||||||
|
self.compute_points(_commit)
|
||||||
|
except urllib2.HTTPError:
|
||||||
|
logmsg("Found cross-referenced issue "+pr)
|
||||||
return issue
|
return issue
|
||||||
|
|
||||||
def compute_points(self, _commit):
|
def compute_points(self, _commit):
|
||||||
|
@ -380,9 +385,13 @@ if myApi.check_limit(5):
|
||||||
elif script == "issue":
|
elif script == "issue":
|
||||||
issueid = args[1];
|
issueid = args[1];
|
||||||
issue = repository.issue_points(issueid)
|
issue = repository.issue_points(issueid)
|
||||||
out += "["+json.dumps(repository.data['id'])+"," + json.dumps(issue['id'])
|
try:
|
||||||
out += json.dumps(issue['state']) + ", " + datetime.strptime(issue['closed_at'], "%Y-%m-%dT%H:%M:%SZ").strftime('%s') + ", "
|
closed_at = datetime.strptime(issue['closed_at'], "%Y-%m-%dT%H:%M:%SZ").strftime('%s');
|
||||||
out += str(len(repository.points)) + ","
|
except TypeError:
|
||||||
|
closed_at = "0"
|
||||||
|
out += "["+json.dumps(repository.data['id'])+", " + issueid+", "
|
||||||
|
out += json.dumps(issue['state']) + ", " + closed_at + ", "
|
||||||
|
out += str(len(repository.points)) + ", "
|
||||||
out += json.dumps(repository.points.items())
|
out += json.dumps(repository.points.items())
|
||||||
out += "]"
|
out += "]"
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue