eternity 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/lib/eternity.rb +0 -1
- data/lib/eternity/patch.rb +2 -4
- data/lib/eternity/repository.rb +13 -4
- data/lib/eternity/version.rb +1 -1
- metadata +3 -4
- data/lib/eternity/log.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3c5b9f3dd98ebf47e906a3ea8a97213bbbe22e3
|
4
|
+
data.tar.gz: 3b22572ec87e97029cb40cac6d7fed5cd284b584
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e95c9952cf6ee5b3915a31dfc84cb470a5631a8250474a68db32ead4bfd0e3aaff4a79abc03503400317d3e6dab0955325d70ae1a5c784f9035ecb2857cc79d
|
7
|
+
data.tar.gz: 8a54e838947cb958fedbd20be7fcc1e4ca162b6098a3636963093f0f1eada3c43fa5dbc788be9e6211080ae99235fa497932ae1bf4a544e066ec19396f61283e
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby 2.1
|
1
|
+
ruby 2.1.0
|
data/lib/eternity.rb
CHANGED
data/lib/eternity/patch.rb
CHANGED
@@ -74,7 +74,7 @@ module Eternity
|
|
74
74
|
|
75
75
|
|
76
76
|
class Merge
|
77
|
-
|
77
|
+
|
78
78
|
include Common
|
79
79
|
|
80
80
|
def merged?
|
@@ -95,12 +95,11 @@ module Eternity
|
|
95
95
|
Delta.merge [revert_delta, target_delta, remaining_delta], base_index
|
96
96
|
end
|
97
97
|
|
98
|
-
log :calculate_delta
|
99
98
|
end
|
100
99
|
|
101
100
|
|
102
101
|
class Diff
|
103
|
-
|
102
|
+
|
104
103
|
include Common
|
105
104
|
|
106
105
|
private
|
@@ -109,7 +108,6 @@ module Eternity
|
|
109
108
|
Delta.merge [revert_delta, target_delta], base_index
|
110
109
|
end
|
111
110
|
|
112
|
-
log :calculate_delta
|
113
111
|
end
|
114
112
|
|
115
113
|
end
|
data/lib/eternity/repository.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
module Eternity
|
2
2
|
class Repository
|
3
3
|
|
4
|
-
extend Log
|
5
|
-
|
6
4
|
attr_reader :name, :id, :branches
|
7
5
|
|
8
6
|
def initialize(name, options={})
|
@@ -77,6 +75,8 @@ module Eternity
|
|
77
75
|
raise "Can't checkout with uncommitted changes" if changes?
|
78
76
|
|
79
77
|
locker.lock! :checkout do
|
78
|
+
Eternity.logger.info(self.class) { "Checkout #{name} (#{options.map { |k,v| "#{k}: #{v}" }.join(', ')})" }
|
79
|
+
|
80
80
|
original_commit = current_commit
|
81
81
|
|
82
82
|
commit_id, branch = extract_commit_and_branch options
|
@@ -113,6 +113,9 @@ module Eternity
|
|
113
113
|
|
114
114
|
def push!
|
115
115
|
raise "Can't push without commit" unless current_commit?
|
116
|
+
|
117
|
+
Eternity.logger.info(self.class) { "Push #{name} (#{current_commit.id})" }
|
118
|
+
|
116
119
|
Branch[current_branch] = current_commit.id
|
117
120
|
end
|
118
121
|
|
@@ -122,6 +125,8 @@ module Eternity
|
|
122
125
|
|
123
126
|
target_commit = Branch[current_branch]
|
124
127
|
|
128
|
+
Eternity.logger.info(self.class) { "Pull #{name} (#{target_commit.id})" }
|
129
|
+
|
125
130
|
if current_commit == target_commit || current_commit.fast_forward?(target_commit)
|
126
131
|
{}
|
127
132
|
elsif target_commit.fast_forward?(current_commit)
|
@@ -133,6 +138,8 @@ module Eternity
|
|
133
138
|
|
134
139
|
def revert
|
135
140
|
locker.lock! :revert do
|
141
|
+
Eternity.logger.info(self.class) { "Revert #{name}" }
|
142
|
+
|
136
143
|
current_commit.with_index do |index|
|
137
144
|
Delta.revert(delta, index).tap { tracker.revert }
|
138
145
|
end
|
@@ -164,13 +171,13 @@ module Eternity
|
|
164
171
|
self.delta = dump['delta']
|
165
172
|
end
|
166
173
|
|
167
|
-
[:delta, :delta=, :commit, :pull, :push, :checkout, :merge, :revert, :destroy, :dump].each { |m| log m }
|
168
|
-
|
169
174
|
private
|
170
175
|
|
171
176
|
attr_reader :tracker, :current, :locker
|
172
177
|
|
173
178
|
def commit!(options)
|
179
|
+
Eternity.logger.info(self.class) { "Commit #{name} (author: #{options[:author]}, message: #{options[:message]})" }
|
180
|
+
|
174
181
|
changes = delta
|
175
182
|
options[:parents] ||= [current_commit.id]
|
176
183
|
options[:delta] ||= write_delta changes
|
@@ -186,6 +193,8 @@ module Eternity
|
|
186
193
|
|
187
194
|
def merge!(target_commit)
|
188
195
|
locker.lock! :merge do
|
196
|
+
Eternity.logger.info(self.class) { "Merge #{name} (#{target_commit.short_id} into #{current_commit.short_id})" }
|
197
|
+
|
189
198
|
patch = Patch.merge current_commit, target_commit
|
190
199
|
|
191
200
|
raise 'Already merged' if patch.merged?
|
data/lib/eternity/version.rb
CHANGED
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: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Naiman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redic
|
@@ -204,7 +204,6 @@ files:
|
|
204
204
|
- lib/eternity/conflict_resolver.rb
|
205
205
|
- lib/eternity/delta.rb
|
206
206
|
- lib/eternity/index.rb
|
207
|
-
- lib/eternity/log.rb
|
208
207
|
- lib/eternity/object_tracker.rb
|
209
208
|
- lib/eternity/patch.rb
|
210
209
|
- lib/eternity/repository.rb
|
@@ -249,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
249
248
|
version: '0'
|
250
249
|
requirements: []
|
251
250
|
rubyforge_project:
|
252
|
-
rubygems_version: 2.
|
251
|
+
rubygems_version: 2.2.2
|
253
252
|
signing_key:
|
254
253
|
specification_version: 4
|
255
254
|
summary: Distributed database version control system
|
data/lib/eternity/log.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
module Eternity
|
2
|
-
module Log
|
3
|
-
|
4
|
-
private
|
5
|
-
|
6
|
-
def log(method)
|
7
|
-
original_method = "__#{method}_without_log__"
|
8
|
-
|
9
|
-
alias_method original_method, method
|
10
|
-
|
11
|
-
define_method method do |*args, &block|
|
12
|
-
Eternity.logger.info(self.class.name) { "#{method} (Start)" }
|
13
|
-
result = send original_method, *args, &block
|
14
|
-
Eternity.logger.info(self.class.name) { "#{method} (End)" }
|
15
|
-
result
|
16
|
-
end
|
17
|
-
|
18
|
-
private original_method
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|