gitlab-elasticsearch-git 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2f2e02dd07d4a8be46948d3bce7bb400fc85b01
4
- data.tar.gz: 7351959ff7c27ac48360f9bca26ab7e2727763ca
3
+ metadata.gz: 69245382e85329466c42b0f9747ac527a01e2473
4
+ data.tar.gz: fdb37b7cb8f67913253cb8d45f790974eea961cc
5
5
  SHA512:
6
- metadata.gz: 492e50d3b67c8b2a3adb03c4cd5a62ece0bda3a9d6199cef64b02e678e22414b3943f80581bb7141f002a7230db1c767c039025e61bc056f018f54a78b3027cf
7
- data.tar.gz: 17086678943cdb815521fa196cb59a1f3d0926ae40b1e209ade66d8f19b75c1ccb4f12f7638a7da5c143b34ab6bb44fb76dd5183bc33d7c7964b826c6ca809f9
6
+ metadata.gz: 86f3d459d93084c0293cebbf200484ef4d292753843a321869fd886d9748e57ce218ed9e12d42a1144e9e523244f08c6c41056176a030f8200b2c880904f451f
7
+ data.tar.gz: 8c304bef1477625c30e1d1abf95dc3c309b798ebfe6fab90ecae13029f85dfde8e5c6d75fc899be5fc09bfb676972c9af7dfd5bff9a6d1ba87cb0df0cc2b9b44
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ 1.0.1
2
+ - Yield current batch and total count when indexing
3
+
1
4
  1.0.0
2
5
  - Blobs and Commits have a parent project
3
6
 
@@ -91,8 +91,9 @@ module Elasticsearch
91
91
  from, to = parse_revs(from_rev, to_rev)
92
92
 
93
93
  diff = repository_for_indexing.diff(from, to)
94
+ deltas = diff.deltas
94
95
 
95
- diff.deltas.reverse.each_slice(BLOBS_BATCH) do |slice|
96
+ deltas.reverse.each_slice(BLOBS_BATCH) do |slice|
96
97
  bulk_operations = slice.map do |delta|
97
98
  if delta.status == :deleted
98
99
  next if delta.old_file[:mode].to_s(8) == "160000"
@@ -106,6 +107,8 @@ module Elasticsearch
106
107
  end
107
108
 
108
109
  perform_bulk bulk_operations
110
+
111
+ yield slice, deltas.length if block_given?
109
112
  end
110
113
 
111
114
  ObjectSpace.garbage_collect
@@ -205,6 +208,8 @@ module Elasticsearch
205
208
  end
206
209
 
207
210
  perform_bulk bulk_operations
211
+
212
+ yield batch, commit_oids.length if block_given?
208
213
  end
209
214
 
210
215
  ObjectSpace.garbage_collect
@@ -1,5 +1,5 @@
1
1
  module Elasticsearch
2
2
  module Git
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'
4
4
  end
5
5
  end
data/spec/main_spec.rb CHANGED
@@ -106,4 +106,31 @@ describe TestRepository do
106
106
  expect(TestRepository.__elasticsearch__.search('test').results.count).to eq(6)
107
107
  expect(repo.search('test')[:commits][:total_count]).to eq(3)
108
108
  end
109
+
110
+ it "yields current batch and total length when indexing commits" do
111
+ count = 0
112
+ total = 0
113
+
114
+ repo.index_commits do |batch, total_count|
115
+ count += batch.length
116
+ total = total_count
117
+ end
118
+
119
+ expect(count).to be > 0
120
+ expect(count).to eq(total)
121
+ end
122
+
123
+ it "yields current batch and total length when indexing blobs" do
124
+ count = 0
125
+ total = 0
126
+
127
+
128
+ repo.index_blobs do |batch, total_count|
129
+ count += batch.length
130
+ total = total_count
131
+ end
132
+
133
+ expect(count).to be > 0
134
+ expect(count).to eq(total)
135
+ end
109
136
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-elasticsearch-git
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Kumanyaev
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-09-08 00:00:00.000000000 Z
13
+ date: 2016-09-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: elasticsearch-model