zz-export-pull-requests 0.3.5 → 0.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/epr +27 -8
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6508eec69dd50e84840ef599ef8cef449bbb6c5ab1aaa4f4ee030ab48ba23926
|
4
|
+
data.tar.gz: cfe15da1345df4cfcdd61c06777e59b7a466efa9349a4a552a498a390382ca98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d46731761ebd3959d17e29b9c95888aef6c83bb44d84088ae4e6e537a55c0978c65ef838e8e0c7ae1c64c501c203263fce1fe09e305b6a482ebe165628753a4
|
7
|
+
data.tar.gz: c2c2f579f861d52b1e9b453ccad9e27c59e7f4c71dcf1ed291cb17d0001c68bae3881c8436198c74a104b3468d807d2959451d9cde7eaa500afaceb3ed99f6d1
|
data/bin/epr
CHANGED
@@ -9,7 +9,7 @@ require "github_api"
|
|
9
9
|
require "gitlab"
|
10
10
|
require "bitbucket_rest_api"
|
11
11
|
|
12
|
-
VERSION = "0.3.
|
12
|
+
VERSION = "0.3.10"
|
13
13
|
SERVICES = %w[github gitlab bitbucket]
|
14
14
|
GIT_CONFIGS = %w[epr.token github.oauth-token]
|
15
15
|
|
@@ -55,6 +55,21 @@ def lookup_token
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
+
# extract "a3351540a2da" from
|
59
|
+
# given "https://api.bitbucket.org/2.0/repositories/hellogold/walletfactory/diff/hellogold/walletfactory:a3351540a2da..05675a5ae8ed?path=go%2Fwalletfactory%2F.gitignore"
|
60
|
+
def extract_hash_from_diff(user, repo, diff_link)
|
61
|
+
str1 = diff_link.split("..")
|
62
|
+
str2 = str1[0].split(":")
|
63
|
+
short_hash = str2[2]
|
64
|
+
long_hash = get_full_hash(user, repo, short_hash)
|
65
|
+
return long_hash
|
66
|
+
end
|
67
|
+
|
68
|
+
def get_full_hash(user, repo, short_hash)
|
69
|
+
result = $bitbucket.repos.commit.get_one(user, repo, short_hash)
|
70
|
+
return result["hash"]
|
71
|
+
end
|
72
|
+
|
58
73
|
def bitbucket(user, repo)
|
59
74
|
# TODO: make sure no need to translate any states
|
60
75
|
# https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/pullrequests
|
@@ -90,12 +105,13 @@ def bitbucket(user, repo)
|
|
90
105
|
pr["links"].html.href,
|
91
106
|
pr.summary.raw,
|
92
107
|
pr.summary.html,
|
93
|
-
!pr.source.commit.nil? ? pr.source.commit["hash"] : "",
|
94
|
-
!pr.destination.commit.nil? ? pr.destination.commit["hash"] : "",
|
108
|
+
!pr.source.commit.nil? ? get_full_hash(user, repo, pr.source.commit["hash"]) : "",
|
109
|
+
!pr.destination.commit.nil? ? get_full_hash(user, repo, pr.destination.commit["hash"]) : "",
|
95
110
|
!pr.source.branch.nil? ? pr.source.branch.name : "",
|
96
111
|
!pr.destination.branch.nil? ? pr.destination.branch.name : "",
|
97
112
|
!pr.reason.nil? ? pr.reason : "",
|
98
|
-
!pr.merge_commit.nil? ? pr.merge_commit["hash"] : ""
|
113
|
+
!pr.merge_commit.nil? ? pr.merge_commit["hash"] : "",
|
114
|
+
!pr.closed_by.nil? ? pr.closed_by.display_name : ""
|
99
115
|
]
|
100
116
|
end
|
101
117
|
|
@@ -120,8 +136,9 @@ def bitbucket(user, repo)
|
|
120
136
|
repo_name,
|
121
137
|
TYPE_PR_COMMENT,
|
122
138
|
comment.pullrequest.id,
|
123
|
-
comment.user.display_name,
|
139
|
+
comment.user? ? comment.user.display_name : no_user,
|
124
140
|
comment.inline? ? "inline" : "normal",
|
141
|
+
comment.id,
|
125
142
|
comment.content.raw,
|
126
143
|
comment.content.html,
|
127
144
|
localtime(comment.updated_on),
|
@@ -129,7 +146,9 @@ def bitbucket(user, repo)
|
|
129
146
|
comment.inline? ? comment.inline.to : "",
|
130
147
|
comment.inline? ? comment.inline.from : "",
|
131
148
|
comment.inline? ? comment.inline.path : "",
|
132
|
-
comment["links"].code? ? comment["links"].code.href : ""
|
149
|
+
comment["links"].code? ? comment["links"].code.href : "",
|
150
|
+
comment.parent? ? comment.parent.id : "",
|
151
|
+
comment["links"].code? ? extract_hash_from_diff(user, repo, comment["links"].code.href) : ""
|
133
152
|
]
|
134
153
|
end
|
135
154
|
break unless comments["next"]
|
@@ -281,9 +300,9 @@ def export_repos(argv)
|
|
281
300
|
rows = []
|
282
301
|
|
283
302
|
if $export == EXPORT_PR_COMMENTS
|
284
|
-
rows << %w[Repository Type PRNumber User CommentType BodyRaw BodyHTML CreatedAt IsDeleted ToLine FromLine FilePath Diff]
|
303
|
+
rows << %w[Repository Type PRNumber User CommentType CommentID BodyRaw BodyHTML CreatedAt IsDeleted ToLine FromLine FilePath Diff ParentID CommitHash]
|
285
304
|
else
|
286
|
-
rows << %w[Repository Type # User Title State CreatedAt UpdatedAt URL BodyRaw BodyHTML SourceCommit DestinationCommit SourceBranch DestinationBranch DeclineReason MergeCommit]
|
305
|
+
rows << %w[Repository Type # User Title State CreatedAt UpdatedAt URL BodyRaw BodyHTML SourceCommit DestinationCommit SourceBranch DestinationBranch DeclineReason MergeCommit ClosedBy]
|
287
306
|
end
|
288
307
|
|
289
308
|
rows[-1].insert(4, "Body") if $body
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zz-export-pull-requests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zulhilmi Zainudin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: github_api
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.1.
|
47
|
+
version: 0.1.11
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.1.
|
54
|
+
version: 0.1.11
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
|
-
rubygems_version: 3.0.
|
102
|
+
rubygems_version: 3.0.1
|
103
103
|
signing_key:
|
104
104
|
specification_version: 4
|
105
105
|
summary: Export pull requests and issues to a CSV file.
|