Created
August 8, 2018 12:37
-
-
Save dokeeffe/26421cb8ca9a00df4170f0c433ab28a5 to your computer and use it in GitHub Desktop.
Count all PRs merged between 2 dates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import warnings\n", | |
"import datetime\n", | |
"import stashy\n", | |
"warnings.filterwarnings('ignore')\n", | |
"stash = stashy.connect(\"https://STASHURLHERE\", \"USERNAMEHERE\", \"MYPASSWORDHERE\", verify=False)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"## figure out the unix timestamps to use from to\n", | |
"# datetime.datetime.fromtimestamp(1532422800)\n", | |
"# datetime.datetime.fromtimestamp(1533027600)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"atlas MERGED 2018-07-25 09:31:25\n", | |
"bcsd MERGED 2018-07-25 06:25:54\n", | |
"workflow-manager MERGED 2018-07-30 16:37:31\n", | |
"workflow-manager MERGED 2018-07-27 17:23:33\n", | |
"workflow-manager MERGED 2018-07-27 15:29:57\n", | |
"workflow-manager MERGED 2018-07-26 16:46:28\n", | |
"workflow-manager MERGED 2018-07-26 11:01:07\n", | |
"workflow-manager MERGED 2018-07-25 09:58:04\n", | |
"workflow-manager MERGED 2018-07-25 08:56:38\n", | |
"workflow-manager MERGED 2018-07-24 14:56:20\n", | |
"workflow-manager-ui MERGED 2018-07-30 16:34:30\n", | |
"workflow-manager-ui MERGED 2018-07-26 17:42:44\n", | |
"workflow-manager-ui MERGED 2018-07-25 10:42:16\n", | |
"workflow-manager-ui MERGED 2018-07-24 11:55:25\n", | |
"cfg-remediation MERGED 2018-07-26 20:16:16\n", | |
"eln-import MERGED 2018-07-26 20:15:58\n", | |
"eln-import MERGED 2018-07-25 14:47:47\n", | |
"host-assets MERGED 2018-07-30 14:23:08\n", | |
"host-assets MERGED 2018-07-30 12:57:38\n", | |
"host-assets MERGED 2018-07-30 10:36:04\n", | |
"host-assets MERGED 2018-07-30 08:41:02\n", | |
"host-assets MERGED 2018-07-26 13:19:28\n", | |
"host-assets MERGED 2018-07-25 16:13:57\n", | |
"host-assets MERGED 2018-07-24 20:32:33\n", | |
"host-assets MERGED 2018-07-24 17:00:54\n", | |
"host-assets MERGED 2018-07-24 16:18:33\n", | |
"host-assets MERGED 2018-07-24 15:46:11\n", | |
"host-assets MERGED 2018-07-24 11:40:51\n", | |
"host-reporting MERGED 2018-07-30 15:01:06\n", | |
"host-reporting MERGED 2018-07-24 11:05:54\n", | |
"uranium MERGED 2018-07-31 09:03:51\n", | |
"cost-center-management MERGED 2018-07-27 14:17:16\n", | |
"cost-center-management MERGED 2018-07-27 08:49:11\n", | |
"cost-center-management-ui MERGED 2018-07-30 15:53:37\n", | |
"cost-center-management-ui MERGED 2018-07-27 10:12:00\n", | |
"cost-center-management-ui MERGED 2018-07-27 08:30:43\n", | |
"cost-center-management-ui MERGED 2018-07-26 09:44:13\n", | |
"elabadvisor MERGED 2018-07-25 14:01:43\n", | |
"ecs-nvt MERGED 2018-07-26 13:55:30\n", | |
"central-ui MERGED 2018-07-30 15:33:58\n", | |
"central-ui MERGED 2018-07-30 15:13:13\n", | |
"central-ui MERGED 2018-07-30 14:59:30\n", | |
"central-ui MERGED 2018-07-30 13:53:41\n", | |
"central-ui MERGED 2018-07-30 10:44:19\n", | |
"central-ui MERGED 2018-07-30 09:45:42\n", | |
"central-ui MERGED 2018-07-30 09:02:19\n", | |
"central-ui MERGED 2018-07-30 08:49:44\n", | |
"central-ui MERGED 2018-07-30 07:27:39\n", | |
"central-ui MERGED 2018-07-27 15:43:44\n", | |
"central-ui MERGED 2018-07-27 15:10:39\n", | |
"central-ui MERGED 2018-07-27 14:29:53\n", | |
"central-ui MERGED 2018-07-27 14:19:06\n", | |
"central-ui MERGED 2018-07-27 14:06:15\n", | |
"central-ui MERGED 2018-07-27 13:37:04\n", | |
"central-ui MERGED 2018-07-27 11:46:28\n", | |
"central-ui MERGED 2018-07-27 11:13:09\n", | |
"central-ui MERGED 2018-07-27 10:52:28\n", | |
"central-ui MERGED 2018-07-27 09:22:21\n", | |
"central-ui MERGED 2018-07-26 14:51:51\n", | |
"central-ui MERGED 2018-07-25 16:17:03\n", | |
"central-ui MERGED 2018-07-25 09:51:34\n", | |
"central-ui MERGED 2018-07-25 09:38:38\n", | |
"central-ui MERGED 2018-07-24 16:03:55\n", | |
"central-ui MERGED 2018-07-24 15:25:29\n", | |
"central-ui MERGED 2018-07-24 14:19:50\n", | |
"central-ui MERGED 2018-07-24 11:53:32\n", | |
"central-ui MERGED 2018-07-24 11:12:40\n", | |
"gstc-usage-reporting-ui MERGED 2018-07-25 10:20:57\n", | |
"titan-file-manager MERGED 2018-07-29 08:51:48\n", | |
"titan-file-manager MERGED 2018-07-27 12:36:32\n", | |
"titan-file-manager MERGED 2018-07-27 11:36:06\n", | |
"titan-file-manager MERGED 2018-07-24 16:29:16\n", | |
"titan-file-manager MERGED 2018-07-24 12:34:25\n", | |
"titan-import-monitor MERGED 2018-07-29 10:20:00\n", | |
"titan-import-monitor MERGED 2018-07-27 10:29:03\n", | |
"titan-import-monitor MERGED 2018-07-26 14:56:35\n", | |
"titan-import-monitor MERGED 2018-07-26 13:42:45\n", | |
"titan-import-monitor MERGED 2018-07-26 10:04:31\n", | |
"titan-solutions MERGED 2018-07-30 14:36:52\n", | |
"titan-solutions MERGED 2018-07-30 13:47:06\n", | |
"titan-solutions MERGED 2018-07-30 08:27:32\n", | |
"titan-solutions MERGED 2018-07-27 10:29:45\n", | |
"titan-solutions MERGED 2018-07-27 08:19:54\n", | |
"titan-solutions MERGED 2018-07-26 10:14:07\n", | |
"titan-solutions MERGED 2018-07-26 08:13:02\n", | |
"titan-solutions MERGED 2018-07-25 08:55:52\n", | |
"titan-solutions MERGED 2018-07-25 08:28:32\n", | |
"titan-solutions MERGED 2018-07-24 14:21:44\n", | |
"titan-solutions MERGED 2018-07-24 13:07:39\n", | |
"golden-path MERGED 2018-07-24 11:02:54\n", | |
"workflow-libs3 MERGED 2018-07-31 09:03:34\n", | |
"cf-services-platform MERGED 2018-07-24 10:34:27\n", | |
"titan-usage-tracking MERGED 2018-07-27 17:11:05\n", | |
"titan-usage-tracking MERGED 2018-07-27 12:31:19\n", | |
"idpa-nvt MERGED 2018-07-31 09:48:26\n", | |
"idpa-nvt MERGED 2018-07-26 11:44:06\n", | |
"idpa-nvt MERGED 2018-07-26 10:06:19\n", | |
"nvt-switch-validation MERGED 2018-07-31 06:36:13\n", | |
"nvt-switch-validation MERGED 2018-07-30 11:01:17\n", | |
"nvt-switch-validation MERGED 2018-07-27 07:44:37\n", | |
"nvt-ui-common MERGED 2018-07-30 12:21:13\n", | |
"networker-ui MERGED 2018-07-30 07:10:22\n", | |
"isilon-nvt MERGED 2018-07-31 07:29:05\n", | |
"isilon-nvt MERGED 2018-07-31 06:14:15\n", | |
"isilon-nvt MERGED 2018-07-30 07:29:59\n", | |
"isilon-nvt MERGED 2018-07-30 07:14:26\n", | |
"isilon-nvt MERGED 2018-07-27 10:58:32\n", | |
"isilon-nvt MERGED 2018-07-27 03:30:13\n", | |
"isilon-nvt MERGED 2018-07-24 17:28:16\n", | |
"prom-data-management MERGED 2018-07-24 10:32:02\n", | |
"prom-entity MERGED 2018-07-27 14:08:59\n", | |
"prom-entity MERGED 2018-07-27 12:53:59\n", | |
"prom-entity MERGED 2018-07-24 15:25:38\n", | |
"prom-ingestion MERGED 2018-07-25 11:40:27\n", | |
"prom-reports MERGED 2018-07-25 16:17:56\n", | |
"prom-scenario MERGED 2018-07-25 20:45:53\n", | |
"prom-scenario MERGED 2018-07-24 10:39:06\n", | |
"prom-scenario-management MERGED 2018-07-31 07:37:38\n", | |
"prom-scenario-management MERGED 2018-07-24 10:38:50\n", | |
"prom-ui MERGED 2018-07-25 19:37:50\n", | |
"basic-recoverpoint-sizer-gateway MERGED 2018-07-27 08:07:45\n", | |
"basic-recoverpoint-sizer-ui MERGED 2018-07-24 12:23:44\n", | |
"basic-unity-replication-sizer-ui MERGED 2018-07-24 10:35:34\n", | |
"recoverpoint-replication-sizing MERGED 2018-07-27 07:41:47\n", | |
"titan-graph MERGED 2018-07-27 08:30:32\n", | |
"titan-ui2-components MERGED 2018-07-25 16:59:44\n", | |
"titan-ui2-navbar MERGED 2018-07-27 15:07:13\n", | |
"titan-ui2-navbar MERGED 2018-07-27 14:42:41\n", | |
"transf-audit MERGED 2018-07-25 12:36:47\n", | |
"transf-on-prem MERGED 2018-07-30 11:17:55\n", | |
"transf-onprem-kaa-tests-build-template MERGED 2018-07-24 15:10:59\n", | |
"transf-packaging MERGED 2018-07-26 14:19:21\n", | |
"transf-readiness MERGED 2018-07-27 14:49:18\n", | |
"transf-ui MERGED 2018-07-26 09:06:44\n", | |
"transf-ui MERGED 2018-07-25 12:48:34\n", | |
"transf-ui MERGED 2018-07-24 13:28:28\n" | |
] | |
} | |
], | |
"source": [ | |
"counter = 0\n", | |
"for proj in stash.projects.list():\n", | |
" for repo in stash.projects[proj['key']].repos.list():\n", | |
" for pr in stash.projects[proj['key']].repos[repo['slug']].pull_requests.all(state='MERGED'):\n", | |
" if pr['updatedDate'] >= 1532422800000 and pr['updatedDate'] <= 1533027600000:\n", | |
" time = datetime.datetime.fromtimestamp(int(pr['updatedDate']/1000))\n", | |
" print('{} {} {}'.format(repo['slug'], pr['state'], time))\n", | |
" counter+=1\n", | |
" " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"136\n" | |
] | |
} | |
], | |
"source": [ | |
"print(counter)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.6.5" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment