eternity 3.0.1 → 4.0.0

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: b0981a07c6d2750de190de34fd06fa69bc36294a
4
- data.tar.gz: 48446c1ea896d5d99089ca1b1409d883c666490d
3
+ metadata.gz: e33df6192a238b152d5a61364a026db81e0eeee5
4
+ data.tar.gz: '085e7cb59a99d46c74de967a9ba3a7426adc6c6c'
5
5
  SHA512:
6
- metadata.gz: 51c887426e9faae2f4c2dbaf51003b24f0afbe5e1e3627fd9a70348163c29484f6ab3ea5f6c0ad6bdb2845549afd6e07c92222ae3f741abd45caf83aeb081fb6
7
- data.tar.gz: 98df7c4d6301a44c4a100f1a8517a220bede1ce1af42cd3b3fb7e228266c5a65ff0736335d666711a10bdfb3643ba500ce07e5b6c78dfa719afee85c9a0f5864
6
+ metadata.gz: c7db74759d279ece10211946a72a031cc08a3f0f8d73ba94cea6829a59e9b4c19a8c2fcac334932cf640c5311495e7530725e326d94863ef3db9c86a340ea01a
7
+ data.tar.gz: 850d7b98eed7fc1073ee4373c6dbdf72428e84839359c6c4a83157183799ef25e6c6e39b30d4b56c4df7cbd7d91581e2e33d941ddc3a3cd7b5e0e2ba0b5e6cc6
@@ -92,7 +92,7 @@ module Eternity
92
92
 
93
93
  current[:branch] = branch
94
94
 
95
- Patch.diff(original_commit, current_commit).delta
95
+ Patch.diff original_commit, current_commit
96
96
  end
97
97
  end
98
98
 
@@ -128,7 +128,7 @@ module Eternity
128
128
  Eternity.logger.info(self.class) { "Pull #{name} (#{target_commit.id})" }
129
129
 
130
130
  if current_commit == target_commit || current_commit.fast_forward?(target_commit)
131
- {}
131
+ Patch.merge current_commit, target_commit
132
132
  elsif target_commit.fast_forward?(current_commit)
133
133
  checkout commit: target_commit.id
134
134
  else
@@ -213,7 +213,7 @@ module Eternity
213
213
  index: write_index(patch.delta),
214
214
  base: patch.base_commit.id
215
215
 
216
- patch.delta
216
+ patch
217
217
  end
218
218
  end
219
219
 
@@ -1,3 +1,3 @@
1
1
  module Eternity
2
- VERSION = '3.0.1'
2
+ VERSION = '4.0.0'
3
3
  end
@@ -18,9 +18,11 @@ describe Repository, 'Checkout' do
18
18
  repository.current_branch.must_equal 'master'
19
19
  repository.current_commit.must_equal commit_2
20
20
 
21
- delta = repository.checkout branch: :test_branch
22
-
23
- delta.must_equal 'countries' => {'UY' => {'action' => 'delete'}}
21
+ patch = repository.checkout branch: :test_branch
22
+
23
+ patch.current_commit.must_equal commit_2
24
+ patch.target_commit.must_equal commit_1
25
+ patch.delta.must_equal 'countries' => {'UY' => {'action' => 'delete'}}
24
26
 
25
27
  repository.current_branch.must_equal 'test_branch'
26
28
  repository.current_commit.must_equal commit_1
@@ -36,9 +38,11 @@ describe Repository, 'Checkout' do
36
38
 
37
39
  Branch[:test_branch] = commit.id
38
40
 
39
- delta = repository.checkout branch: :test_branch
40
-
41
- delta.must_equal 'countries' => {'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina'}}}
41
+ patch = repository.checkout branch: :test_branch
42
+
43
+ patch.current_commit.must_be_nil
44
+ patch.target_commit.must_equal commit
45
+ patch.delta.must_equal 'countries' => {'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina'}}}
42
46
 
43
47
  repository.current_branch.must_equal 'test_branch'
44
48
  repository.current_commit.must_equal commit
@@ -65,9 +69,11 @@ describe Repository, 'Checkout' do
65
69
  repository.current_commit.must_equal commit_2
66
70
  repository.branches.to_h.must_equal 'master' => commit_2.id
67
71
 
68
- delta = repository.checkout commit: commit_1.id
69
-
70
- delta.must_equal 'countries' => {'UY' => {'action' => 'delete'}}
72
+ patch = repository.checkout commit: commit_1.id
73
+
74
+ patch.current_commit.must_equal commit_2
75
+ patch.target_commit.must_equal commit_1
76
+ patch.delta.must_equal 'countries' => {'UY' => {'action' => 'delete'}}
71
77
 
72
78
  repository.current_branch.must_equal 'master'
73
79
  repository.current_commit.must_equal commit_1
@@ -86,9 +92,11 @@ describe Repository, 'Checkout' do
86
92
  repository[:countries].insert 'UY', name: 'Uruguay'
87
93
  commit_2 = repository.commit author: 'User', message: 'Commit 2'
88
94
 
89
- delta = repository.checkout commit: nil
90
-
91
- delta.must_equal 'countries' => {
95
+ patch = repository.checkout commit: nil
96
+
97
+ patch.current_commit.must_equal commit_2
98
+ patch.target_commit.must_be_nil
99
+ patch.delta.must_equal 'countries' => {
92
100
  'AR' => {'action' => 'delete'},
93
101
  'UY' => {'action' => 'delete'}
94
102
  }
@@ -36,7 +36,8 @@ describe 'Delta' do
36
36
 
37
37
  repo_1.push
38
38
 
39
- delta = repo_2.pull
39
+ patch = repo_2.pull
40
+ delta = patch.delta
40
41
  commit_6 = repo_2.current_commit # Merge
41
42
 
42
43
  delta.must_equal 'countries' => {
@@ -52,7 +53,8 @@ describe 'Delta' do
52
53
 
53
54
  repo_2.push
54
55
 
55
- delta = repo_1.pull
56
+ patch = repo_1.pull
57
+ delta = patch.delta
56
58
 
57
59
  repo_1.current_commit.must_equal commit_6
58
60
 
@@ -70,7 +72,8 @@ describe 'Delta' do
70
72
 
71
73
  repo_1.push
72
74
 
73
- delta = repo_2.pull
75
+ patch = repo_2.pull
76
+ delta = patch.delta
74
77
  commit_9 = repo_2.current_commit # Merge
75
78
 
76
79
  delta.must_equal 'countries' => {
@@ -89,7 +92,8 @@ describe 'Delta' do
89
92
 
90
93
  repo_2.push
91
94
 
92
- delta = repo_1.pull
95
+ patch = repo_1.pull
96
+ delta = patch.delta
93
97
 
94
98
  repo_1.current_commit.must_equal commit_10
95
99
 
@@ -102,7 +106,8 @@ describe 'Delta' do
102
106
  repo_3[:countries].insert 'UY', name: 'Uruguay'
103
107
  commit_11 = repo_3.commit author: 'User 3', message: 'Commit 11'
104
108
 
105
- delta = repo_3.checkout commit: commit_10.id
109
+ patch = repo_3.checkout commit: commit_10.id
110
+ delta = patch.delta
106
111
 
107
112
  repo_3.current_commit.must_equal commit_10
108
113
 
@@ -125,7 +130,8 @@ describe 'Delta' do
125
130
  repo_1.commit author: 'User 1', message: 'Added Argentina'
126
131
  repo_1.push
127
132
 
128
- delta = repo_2.pull
133
+ patch = repo_2.pull
134
+ delta = patch.delta
129
135
  delta.must_equal 'countries' => {
130
136
  'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina'}}
131
137
  }
@@ -137,7 +143,8 @@ describe 'Delta' do
137
143
  repo_2[:countries].insert 'BR', name: 'Brasil'
138
144
  repo_2.commit author: 'User 2', message: 'Added Brasil'
139
145
 
140
- delta = repo_2.pull
146
+ patch = repo_2.pull
147
+ delta = patch.delta
141
148
  delta.must_be_empty
142
149
 
143
150
  repo_2.current_commit.must_equal_index 'countries' => {
@@ -150,7 +157,8 @@ describe 'Delta' do
150
157
  repo_1[:countries].insert 'UY', name: 'Uruguay'
151
158
  repo_1.commit author: 'User 1', message: 'Added Uruguay'
152
159
 
153
- delta = repo_1.pull
160
+ patch = repo_1.pull
161
+ delta = patch.delta
154
162
  delta.must_equal 'countries' => {
155
163
  'BR' => {'action' => 'insert', 'data' => {'name' => 'Brasil'}}
156
164
  }
@@ -166,7 +174,8 @@ describe 'Delta' do
166
174
  repo_2[:countries].insert 'CL', name: 'Chile'
167
175
  repo_2.commit author: 'User 2', message: 'Added Chile'
168
176
 
169
- delta = repo_2.pull
177
+ patch = repo_2.pull
178
+ delta = patch.delta
170
179
  delta.must_equal 'countries' => {
171
180
  'UY' => {'action' => 'insert', 'data' => {'name' => 'Uruguay'}}
172
181
  }
@@ -183,7 +192,8 @@ describe 'Delta' do
183
192
  repo_1[:countries].update 'UY', name: 'Republica Oriental del Uruguay'
184
193
  repo_1.commit author: 'User 1', message: 'Updated Uruguay'
185
194
 
186
- delta = repo_1.pull
195
+ patch = repo_1.pull
196
+ delta = patch.delta
187
197
  delta.must_equal 'countries' => {
188
198
  'CL' => {'action' => 'insert', 'data' => {'name' => 'Chile'}}
189
199
  }
@@ -200,7 +210,8 @@ describe 'Delta' do
200
210
  repo_2[:countries].delete 'CL'
201
211
  repo_2.commit author: 'User 2', message: 'Deleted Chile'
202
212
 
203
- delta = repo_2.pull
213
+ patch = repo_2.pull
214
+ delta = patch.delta
204
215
  delta.must_equal 'countries' => {
205
216
  'UY' => {'action' => 'update', 'data' => {'name' => 'Republica Oriental del Uruguay'}}
206
217
  }
@@ -216,7 +227,8 @@ describe 'Delta' do
216
227
  repo_1[:countries].insert 'CO', name: 'Colombia'
217
228
  repo_1.commit author: 'User 1', message: 'Added Colombia'
218
229
 
219
- delta = repo_1.pull
230
+ patch = repo_1.pull
231
+ delta = patch.delta
220
232
  delta.must_equal 'countries' => {
221
233
  'CL' => {'action' => 'delete'}
222
234
  }
@@ -242,7 +254,8 @@ describe 'Delta' do
242
254
  repo_1.commit author: 'User 1', message: 'Commit 1'
243
255
  repo_1.push
244
256
 
245
- delta = repo_2.pull
257
+ patch = repo_2.pull
258
+ delta = patch.delta
246
259
  delta.must_equal 'countries' => {
247
260
  'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina'}}
248
261
  }
@@ -251,7 +264,8 @@ describe 'Delta' do
251
264
  'AR' => digest(name: 'Argentina'),
252
265
  }
253
266
 
254
- delta = repo_3.pull
267
+ patch = repo_3.pull
268
+ delta = patch.delta
255
269
  delta.must_equal 'countries' => {
256
270
  'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina'}}
257
271
  }
@@ -270,7 +284,8 @@ describe 'Delta' do
270
284
  repo_3.commit author: 'User 3', message: 'Commit 4'
271
285
  repo_3.push
272
286
 
273
- delta = repo_2.pull
287
+ patch = repo_2.pull
288
+ delta = patch.delta
274
289
  delta.must_equal 'countries' => {
275
290
  'UY' => {'action' => 'insert', 'data' => {'name' => 'Uruguay'}}
276
291
  }
@@ -282,7 +297,8 @@ describe 'Delta' do
282
297
 
283
298
  repo_2.push
284
299
 
285
- delta = repo_1.pull
300
+ patch = repo_1.pull
301
+ delta = patch.delta
286
302
  delta.must_equal 'countries' => {
287
303
  'AR' => {'action' => 'update', 'data' => {'name' => 'Argentina', 'number' => 54}},
288
304
  'UY' => {'action' => 'insert', 'data' => {'name' => 'Uruguay'}}
@@ -300,7 +316,8 @@ describe 'Delta' do
300
316
  repo_1.commit author: 'User 1', message: 'Commit 7'
301
317
  repo_1.push
302
318
 
303
- delta = repo_2.pull
319
+ patch = repo_2.pull
320
+ delta = patch.delta
304
321
  delta.must_equal 'countries' => {
305
322
  'BR' => {'action' => 'insert', 'data' => {'name' => 'Brasil'}},
306
323
  'UY' => {'action' => 'delete'}
@@ -334,7 +351,8 @@ describe 'Delta' do
334
351
  'UY' => digest(name: 'Uruguay'),
335
352
  }
336
353
 
337
- delta = repo_2.pull
354
+ patch = repo_2.pull
355
+ delta = patch.delta
338
356
  delta.must_equal 'countries' => {
339
357
  'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina'}}
340
358
  }
@@ -357,7 +375,8 @@ describe 'Delta' do
357
375
  'UY' => digest(name: 'Uruguay')
358
376
  }
359
377
 
360
- delta = repo_2.pull
378
+ patch = repo_2.pull
379
+ delta = patch.delta
361
380
  delta.must_be_empty
362
381
 
363
382
  repo_2.current_commit.must_equal_index 'countries' => {
@@ -367,7 +386,8 @@ describe 'Delta' do
367
386
 
368
387
  repo_2.push
369
388
 
370
- delta = repo_1.pull
389
+ patch = repo_1.pull
390
+ delta = patch.delta
371
391
  delta.must_equal 'countries' => {
372
392
  'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina', 'number' => 54}},
373
393
  'UY' => {'action' => 'insert', 'data' => {'name' => 'Uruguay'}},
@@ -13,10 +13,10 @@ describe Repository, 'Merge' do
13
13
  end
14
14
 
15
15
  def merge(id, repo, target_id)
16
- delta = repo.merge commit: commits[target_id].id
16
+ patch = repo.merge commit: commits[target_id].id
17
17
  commits[id] = repo.current_commit
18
- yield delta['countries'] if block_given?
19
- delta
18
+ yield patch.delta['countries'], patch.current_commit, patch.target_commit if block_given?
19
+ patch
20
20
  end
21
21
 
22
22
  def checkout(id, repo)
@@ -52,8 +52,10 @@ describe Repository, 'Merge' do
52
52
  update 'AR', name: 'Argentina'
53
53
  end
54
54
 
55
- merge 5, repo_2, 4 do |delta|
55
+ merge 5, repo_2, 4 do |delta, current_commit, target_commit|
56
56
  delta.must_be_nil
57
+ current_commit.must_equal commits[2]
58
+ target_commit.must_equal commits[4]
57
59
  end
58
60
 
59
61
  assert_index 5, 'AR' => digest(name: 'Argentina'),
@@ -119,15 +121,19 @@ describe Repository, 'Merge' do
119
121
  update 'AR', name: 'Argentina', code: 'ARG'
120
122
  end
121
123
 
122
- merge 6, repo_2, 5 do |delta|
124
+ merge 6, repo_2, 5 do |delta, current_commit, target_commit|
123
125
  delta['AR'].must_equal 'action' => 'update', 'data' => {'name' => 'Republica Argentina', 'code' => 'ARG'}
126
+ current_commit.must_equal commits[3]
127
+ target_commit.must_equal commits[5]
124
128
  end
125
129
 
126
130
  assert_index 6, 'AR' => digest(name: 'Republica Argentina', code: 'ARG'),
127
131
  'UY' => digest(name: 'Uruguay')
128
132
 
129
- merge 7, repo_1, 3 do |delta|
133
+ merge 7, repo_1, 3 do |delta, current_commit, target_commit|
130
134
  delta['AR'].must_equal 'action' => 'update', 'data' => {'name' => 'Republica Argentina', 'code' => 'ARG'}
135
+ current_commit.must_equal commits[5]
136
+ target_commit.must_equal commits[3]
131
137
  end
132
138
 
133
139
  assert_index 7, 'AR' => digest(name: 'Republica Argentina', code: 'ARG'),
@@ -166,6 +172,35 @@ describe Repository, 'Merge' do
166
172
  assert_index 6, 'AR' => digest(name: 'Argentina', code: 'ARG')
167
173
  end
168
174
 
175
+ it 'case 5' do
176
+ skip
177
+ commit 1, repo_1 do
178
+ insert 'AR', name: 'Argentina'
179
+ end
180
+
181
+ checkout 1, repo_2
182
+
183
+ commit 2, repo_2 do
184
+ insert 'UY', name: 'Uruguay'
185
+ end
186
+
187
+ commit 3, repo_1 do
188
+ update 'AR', name: 'Republica Argentina'
189
+ end
190
+
191
+ merge 4, repo_2, 3 do |delta|
192
+ delta['AR'].must_equal 'action' => 'update', 'data' => {'name' => 'Republica Argentina'}
193
+ end
194
+
195
+ commit 5, repo_1 do
196
+ update 'AR', name: 'Argentina'
197
+ end
198
+
199
+ merge 6, repo_1, 4 do |delta|
200
+ delta['AR'].must_equal 'action' => 'update', 'data' => {'name' => 'Argentina'}
201
+ end
202
+ end
203
+
169
204
  end
170
205
 
171
206
  it 'Merge deleted element in two commits' do
@@ -22,9 +22,12 @@ describe Repository, 'Pull' do
22
22
  commit = other_repository.commit author: 'User', message: 'Commit 1'
23
23
  other_repository.push
24
24
 
25
- delta = repository.pull
25
+ patch = repository.pull
26
+
27
+ patch.delta.must_equal 'countries' => {'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina'}}}
28
+ patch.current_commit.must_be_nil
29
+ patch.target_commit.must_equal commit
26
30
 
27
- delta.must_equal 'countries' => {'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina'}}}
28
31
  repository.current_commit.must_equal commit
29
32
  repository.branches[repository.current_branch].must_equal commit.id
30
33
  end
@@ -34,9 +37,12 @@ describe Repository, 'Pull' do
34
37
  commit_1 = repository.commit author: 'User', message: 'Commit 1'
35
38
  repository.push
36
39
 
37
- delta = repository.pull
40
+ patch = repository.pull
41
+
42
+ patch.delta.must_be_empty
43
+ patch.current_commit.must_equal commit_1
44
+ patch.target_commit.must_equal commit_1
38
45
 
39
- delta.must_be_empty
40
46
  repository.current_commit.must_equal commit_1
41
47
  end
42
48
 
@@ -49,9 +55,12 @@ describe Repository, 'Pull' do
49
55
  repository[:countries].insert 'UY', name: 'Uruguay'
50
56
  commit_2 = repository.commit author: 'User', message: 'Commit 2'
51
57
 
52
- delta = repository.pull
58
+ patch = repository.pull
59
+
60
+ patch.delta.must_be_empty
61
+ patch.current_commit.must_equal commit_2
62
+ patch.target_commit.must_equal commit_1
53
63
 
54
- delta.must_be_empty
55
64
  repository.current_commit.must_equal commit_2
56
65
  end
57
66
 
@@ -61,9 +70,11 @@ describe Repository, 'Pull' do
61
70
  repository.push
62
71
 
63
72
  other_repository = Repository.new :other
64
- delta = other_repository.pull
73
+ patch = other_repository.pull
65
74
 
66
- delta.must_equal 'countries' => {'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina'}}}
75
+ patch.delta.must_equal 'countries' => {'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina'}}}
76
+ patch.current_commit.must_be_nil
77
+ patch.target_commit.must_equal commit_1
67
78
 
68
79
  repository[:countries].insert 'UY', name: 'Uruguay'
69
80
  commit_2 = repository.commit author: 'User', message: 'Commit 2'
@@ -73,9 +84,11 @@ describe Repository, 'Pull' do
73
84
  other_repository.current_commit.must_equal commit_1
74
85
  other_repository.branches[other_repository.current_branch].must_equal commit_1.id
75
86
 
76
- delta = other_repository.pull
87
+ patch = other_repository.pull
77
88
 
78
- delta.must_equal 'countries' => {'UY' => {'action' => 'insert', 'data' => {'name' => 'Uruguay'}}}
89
+ patch.delta.must_equal 'countries' => {'UY' => {'action' => 'insert', 'data' => {'name' => 'Uruguay'}}}
90
+ patch.current_commit.must_equal commit_1
91
+ patch.target_commit.must_equal commit_2
79
92
 
80
93
  other_repository.wont_be :changes?
81
94
  other_repository.current_commit.must_equal commit_2
@@ -88,9 +101,11 @@ describe Repository, 'Pull' do
88
101
  repository.push
89
102
 
90
103
  other_repository = Repository.new :other
91
- delta = other_repository.pull
92
-
93
- delta.must_equal 'countries' => {'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina'}}}
104
+ patch = other_repository.pull
105
+
106
+ patch.delta.must_equal 'countries' => {'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina'}}}
107
+ patch.current_commit.must_be_nil
108
+ patch.target_commit.must_equal commit_1
94
109
 
95
110
  other_repository[:countries].insert 'UY', name: '...'
96
111
  commit_2 = other_repository.commit author: 'User', message: 'Commit 2'
@@ -103,9 +118,11 @@ describe Repository, 'Pull' do
103
118
  repository[:countries].insert 'BR', name: 'Brasil'
104
119
  commit_4 = repository.commit author: 'User', message: 'Commit 4'
105
120
 
106
- delta = repository.pull
121
+ patch = repository.pull
107
122
 
108
- delta.must_equal 'countries' => {'UY' => {'action' => 'insert', 'data' => {'name' => 'Uruguay'}}}
123
+ patch.delta.must_equal 'countries' => {'UY' => {'action' => 'insert', 'data' => {'name' => 'Uruguay'}}}
124
+ patch.current_commit.must_equal commit_4
125
+ patch.target_commit.must_equal commit_3
109
126
 
110
127
  repository.branches[repository.current_branch].must_equal repository.current_commit.id
111
128
 
@@ -128,9 +145,11 @@ describe Repository, 'Pull' do
128
145
  repository.push
129
146
 
130
147
  other_repository = Repository.new :other
131
- delta = other_repository.pull
148
+ patch = other_repository.pull
132
149
 
133
- delta.must_equal 'countries' => {'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina 1'}}}
150
+ patch.delta.must_equal 'countries' => {'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina 1'}}}
151
+ patch.current_commit.must_be_nil
152
+ patch.target_commit.must_equal commit_1
134
153
 
135
154
  other_repository[:countries].update 'AR', name: 'Argentina 2', number: 54
136
155
  commit_2 = other_repository.commit author: 'User', message: 'Commit 2'
@@ -138,9 +157,11 @@ describe Repository, 'Pull' do
138
157
 
139
158
  repository[:countries].update 'AR', name: 'Argentina 3'
140
159
  commit_3 = repository.commit author: 'User', message: 'Commit 3'
141
- delta = repository.pull
160
+ patch = repository.pull
142
161
 
143
- delta.must_equal 'countries' => {'AR' => {'action' => 'update', 'data' => {'name' => 'Argentina 3', 'number' => 54}}}
162
+ patch.delta.must_equal 'countries' => {'AR' => {'action' => 'update', 'data' => {'name' => 'Argentina 3', 'number' => 54}}}
163
+ patch.current_commit.must_equal commit_3
164
+ patch.target_commit.must_equal commit_2
144
165
 
145
166
  repository.branches[repository.current_branch].must_equal repository.current_commit.id
146
167
 
@@ -159,9 +180,11 @@ describe Repository, 'Pull' do
159
180
  repository.push
160
181
 
161
182
  other_repository = Repository.new :other
162
- delta = other_repository.pull
183
+ patch = other_repository.pull
163
184
 
164
- delta.must_equal 'countries' => {'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina'}}}
185
+ patch.delta.must_equal 'countries' => {'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina'}}}
186
+ patch.current_commit.must_be_nil
187
+ patch.target_commit.must_equal commit_1
165
188
 
166
189
  other_repository[:countries].update 'AR', name: 'Argentina', number: 54
167
190
  commit_2 = other_repository.commit author: 'User', message: 'Commit 2'
@@ -169,9 +192,11 @@ describe Repository, 'Pull' do
169
192
 
170
193
  repository[:countries].update 'AR', name: 'Argentina', code: 'ARG'
171
194
  commit_3 = repository.commit author: 'User', message: 'Commit 3'
172
- delta = repository.pull
195
+ patch = repository.pull
173
196
 
174
- delta.must_equal 'countries' => {'AR' => {'action' => 'update', 'data' => {'name' => 'Argentina', 'code' => 'ARG', 'number' => 54}}}
197
+ patch.delta.must_equal 'countries' => {'AR' => {'action' => 'update', 'data' => {'name' => 'Argentina', 'code' => 'ARG', 'number' => 54}}}
198
+ patch.current_commit.must_equal commit_3
199
+ patch.target_commit.must_equal commit_2
175
200
 
176
201
  repository.branches[repository.current_branch].must_equal repository.current_commit.id
177
202
 
@@ -190,9 +215,11 @@ describe Repository, 'Pull' do
190
215
  repository.push
191
216
 
192
217
  other_repository = Repository.new :other
193
- delta = other_repository.pull
218
+ patch = other_repository.pull
219
+ patch.current_commit.must_be_nil
220
+ patch.target_commit.must_equal commit_1
194
221
 
195
- delta.must_equal 'countries' => {'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina'}}}
222
+ patch.delta.must_equal 'countries' => {'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina'}}}
196
223
 
197
224
  other_repository[:countries].insert 'X', name: 'X1', code: 1
198
225
  commit_2 = other_repository.commit author: 'User', message: 'Commit 2'
@@ -200,9 +227,11 @@ describe Repository, 'Pull' do
200
227
 
201
228
  repository[:countries].insert 'X', name: 'X2', number: 2
202
229
  commit_3 = repository.commit author: 'User', message: 'Commit 3'
203
- delta = repository.pull
230
+ patch = repository.pull
204
231
 
205
- delta.must_equal 'countries' => {'X' => {'action' => 'update', 'data' => {'name' => 'X2', 'number' => 2, 'code' => 1}}}
232
+ patch.delta.must_equal 'countries' => {'X' => {'action' => 'update', 'data' => {'name' => 'X2', 'number' => 2, 'code' => 1}}}
233
+ patch.current_commit.must_equal commit_3
234
+ patch.target_commit.must_equal commit_2
206
235
 
207
236
  repository.branches[repository.current_branch].must_equal repository.current_commit.id
208
237
 
@@ -224,9 +253,11 @@ describe Repository, 'Pull' do
224
253
  repository.push
225
254
 
226
255
  other_repository = Repository.new :other
227
- delta = other_repository.pull
256
+ patch = other_repository.pull
228
257
 
229
- delta.must_equal 'countries' => {'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina'}}}
258
+ patch.delta.must_equal 'countries' => {'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina'}}}
259
+ patch.current_commit.must_be_nil
260
+ patch.target_commit.must_equal commit_1
230
261
 
231
262
  other_repository[:countries].delete 'AR'
232
263
  commit_2 = other_repository.commit author: 'User', message: 'Commit 2'
@@ -235,9 +266,11 @@ describe Repository, 'Pull' do
235
266
  repository[:countries].delete 'AR'
236
267
  commit_3 = repository.commit author: 'User', message: 'Commit 3'
237
268
 
238
- delta = repository.pull
269
+ patch = repository.pull
239
270
 
240
- delta.must_be_empty
271
+ patch.delta.must_be_empty
272
+ patch.current_commit.must_equal commit_3
273
+ patch.target_commit.must_equal commit_2
241
274
 
242
275
  repository.branches[repository.current_branch].must_equal repository.current_commit.id
243
276
 
@@ -256,9 +289,11 @@ describe Repository, 'Pull' do
256
289
  repository.push
257
290
 
258
291
  other_repository = Repository.new :other
259
- delta = other_repository.pull
292
+ patch = other_repository.pull
260
293
 
261
- delta.must_equal 'countries' => {'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina'}}}
294
+ patch.delta.must_equal 'countries' => {'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina'}}}
295
+ patch.current_commit.must_be_nil
296
+ patch.target_commit.must_equal commit_1
262
297
 
263
298
  other_repository[:countries].delete 'AR'
264
299
  commit_2 = other_repository.commit author: 'User', message: 'Commit 2'
@@ -267,10 +302,12 @@ describe Repository, 'Pull' do
267
302
  repository[:countries].update 'AR', name: 'Argentina', code: 'ARG'
268
303
  commit_3 = repository.commit author: 'User', message: 'Commit 3'
269
304
 
270
- delta = repository.pull
271
-
272
- delta.must_be_empty
305
+ patch = repository.pull
273
306
 
307
+ patch.delta.must_be_empty
308
+ patch.current_commit.must_equal commit_3
309
+ patch.target_commit.must_equal commit_2
310
+
274
311
  repository.branches[repository.current_branch].must_equal repository.current_commit.id
275
312
 
276
313
  repository.current_commit.tap do |commit|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eternity
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Naiman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-14 00:00:00.000000000 Z
11
+ date: 2019-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: restruct