8000 Fix wrong PR URL in logs and log closed PR labels by yajo · Pull Request #33 · acsone/git-aggregator · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix wrong PR URL in logs and log closed PR labels #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ To work around API limitation, you must first generate a
Changes
=======

1.7.0 (August 14, 2019)
-----------------------

* Fix a bug in ``--show-all-prs``, which was printing a wrong PR URL.
* Display PR labels too in ``--show-all-prs``.

1.6.0 (March 04, 2019)
----------------------

Expand Down Expand Up @@ -276,7 +282,7 @@ Contributors
* Cristian Moncho
* Simone Orsi (camptocamp_)
* Artem Kostyuk

.. _ACSONE: https://www.acsone.eu
.. _Tecnativa: https://www.tecnativa.com
.. _camptocamp: https://www.camptocamp.com
Expand Down
13 changes: 9 additions & 4 deletions git_aggregator/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,6 @@ def collect_prs_info(self):
'pr': pull_mo.group('pr'),
}
pr_info['path'] = '{owner}/{repo}/pulls/{pr}'.format(**pr_info)
pr_info['url'] = 'https://github.com/{path}'.format(**pr_info)
pr_info['shortcut'] = '{owner}/{repo}#{pr}'.format(**pr_info)
r = self._github_api_get('/repos/{path}'.format(**pr_info))
if r.status_code != 200:
Expand All @@ -349,9 +348,14 @@ def collect_prs_info(self):
'Reason: {r.status_code} {r.reason}'.format(r=r, **pr_info)
)
continue
pr_info['state'] = r.json().get('state')
rj = r.json()
pr_info['state'] = rj.get('state')
pr_info['url'] = rj.get('html_url')
pr_info['labels'] = ", ".join(
label['name'] for label in rj.get('labels')
)
pr_info['merged'] = (
not r.json().get('merged') and 'not ' or ''
not rj.get('merged') and 'not ' or ''
) + 'merged'
all_prs.setdefault(pr_info['state'], []).append(pr_info)
return all_prs
Expand All @@ -361,7 +365,8 @@ def show_closed_prs(self):
all_prs = self.collect_prs_info()
for pr_info in all_prs.get('closed', []):
logger.info(
'{url} in state {state} ({merged})'.format(**pr_info)
'{url} in state {state} ({merged}; labels: {labels})'
.format(**pr_info)
)

def show_all_prs(self):
Expand Down
0