zz-export-pull-requests 0.3.8 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/epr +12 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec95365b456ed1a2890c05f0a2bc1c8acdc99023dffecbb8f7a6f38aa04ba97f
4
- data.tar.gz: 19c8284d9077ffd15db69b909bce6e8d441696623f3c5c532679f20ffdf6ddc7
3
+ metadata.gz: beed724fb1aff96563cc82b34e991f10060e6ea7fe9c0387297e73b2c28bc762
4
+ data.tar.gz: 67c5554c4ccd7fb44d3357fee122a2afe11c527a7f6638a7bf19d7fcd730db0e
5
5
  SHA512:
6
- metadata.gz: c02307e47e9787d5e41e2b1be655d274857f6a2ae6f72d101f4cce05239ce9a0af7c6479addf2ad649ad868cb2bf50d63bf36cd13cf644f93793ff7d49a008de
7
- data.tar.gz: ab46b97ff17d863128a1321d029077ffb3d4b45178f71fc99cc17c9d14016be0ec06e97cdb7f3258c2ed93c51c066c2210c8f74ff0cc4d874c25df8825d40ecd
6
+ metadata.gz: f268c94678fd04cf6c1ea572eff9a892afda085c847d83251e4349c6712a478ee65eeea3e414f508d9deb56dbe04794c0c666c357061c166ab173747792615cc
7
+ data.tar.gz: afaa31d97c97e9719c1692e7a14f495da21ad83e163d23c59c91e69ab4d3e972e73d7da7ea1070542062e7f689abb52a831f9baf9661da7d3828bb01e011efb3
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.8"
12
+ VERSION = "0.3.9"
13
13
  SERVICES = %w[github gitlab bitbucket]
14
14
  GIT_CONFIGS = %w[epr.token github.oauth-token]
15
15
 
@@ -55,6 +55,14 @@ def lookup_token
55
55
  end
56
56
  end
57
57
 
58
+ def extract_hash_from_diff(user, repo, diff_link)
59
+ str1 = diff_link.split("..")
60
+ str2 = str1[1].split("?")
61
+ short_hash = str2[0]
62
+ long_hash = get_full_hash(user, repo, short_hash)
63
+ return long_hash
64
+ end
65
+
58
66
  def get_full_hash(user, repo, short_hash)
59
67
  result = $bitbucket.repos.commit.get_one(user, repo, short_hash)
60
68
  return result["hash"]
@@ -137,7 +145,8 @@ def bitbucket(user, repo)
137
145
  comment.inline? ? comment.inline.from : "",
138
146
  comment.inline? ? comment.inline.path : "",
139
147
  comment["links"].code? ? comment["links"].code.href : "",
140
- comment.parent? ? comment.parent.id : ""
148
+ comment.parent? ? comment.parent.id : "",
149
+ comment["links"].code? ? extract_hash_from_diff(user, repo, comment["links"].code.href) : ""
141
150
  ]
142
151
  end
143
152
  break unless comments["next"]
@@ -289,7 +298,7 @@ def export_repos(argv)
289
298
  rows = []
290
299
 
291
300
  if $export == EXPORT_PR_COMMENTS
292
- rows << %w[Repository Type PRNumber User CommentType CommentID BodyRaw BodyHTML CreatedAt IsDeleted ToLine FromLine FilePath Diff ParentID]
301
+ rows << %w[Repository Type PRNumber User CommentType CommentID BodyRaw BodyHTML CreatedAt IsDeleted ToLine FromLine FilePath Diff ParentID CommitHash]
293
302
  else
294
303
  rows << %w[Repository Type # User Title State CreatedAt UpdatedAt URL BodyRaw BodyHTML SourceCommit DestinationCommit SourceBranch DestinationBranch DeclineReason MergeCommit ClosedBy]
295
304
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zz-export-pull-requests
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zulhilmi Zainudin