gitlab-elasticsearch-git 1.0.0 → 1.0.1
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/CHANGELOG +3 -0
- data/lib/elasticsearch/git/repository.rb +6 -1
- data/lib/elasticsearch/git/version.rb +1 -1
- data/spec/main_spec.rb +27 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69245382e85329466c42b0f9747ac527a01e2473
|
4
|
+
data.tar.gz: fdb37b7cb8f67913253cb8d45f790974eea961cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86f3d459d93084c0293cebbf200484ef4d292753843a321869fd886d9748e57ce218ed9e12d42a1144e9e523244f08c6c41056176a030f8200b2c880904f451f
|
7
|
+
data.tar.gz: 8c304bef1477625c30e1d1abf95dc3c309b798ebfe6fab90ecae13029f85dfde8e5c6d75fc899be5fc09bfb676972c9af7dfd5bff9a6d1ba87cb0df0cc2b9b44
|
data/CHANGELOG
CHANGED
@@ -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
|
-
|
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
|
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.
|
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-
|
13
|
+
date: 2016-09-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: elasticsearch-model
|