multi_git 0.0.1.beta1 → 0.0.1.rc1

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: 8a8d438d8d1f815345a1c5cc77b3ce2b7689435d
4
- data.tar.gz: 77b256666dcca0c97155d6e540104bc653a3b319
3
+ metadata.gz: 568f2ff3c702a98fe88e7f5ac6a1d80f2eae7b17
4
+ data.tar.gz: fac8b206478b5fef7c8ebd2e0872832415da0ec4
5
5
  SHA512:
6
- metadata.gz: 7c075d5f6b65bc3f9ae092b617555db1870a01dd555a5b52375641208aaf87d14ba8f3889770c042763ec2d194c3d9ad405874bd24c39d808750744032c7cffb
7
- data.tar.gz: 65134503f98f6fb7acea989182ea69fa9fde0d32c9396380f0b6b7cbb660ceddcf7fb62367ca594f7ce4450639fc4a4146b43b5efe18bcc12ff55aaa2d76bd66
6
+ metadata.gz: d0092bb34f79f968ded7539c858a72daaf309c5c772130433001d8088ab2519224e0ea72e6d606136e925bbf99770c678b33385d06fbc72ea6f541063ab57645
7
+ data.tar.gz: 4ad11a12904c0de1560345983ccac9b5fc6fecf71f63f0fc3183d501b78f02cda0e0de4568c4b8fa5a4b3278d9290204a61fbdb45e28eae828f8436bd128de6a
@@ -60,6 +60,10 @@ module MultiGit
60
60
  Utils.file_loadeable?('rugged.rb')
61
61
  end
62
62
 
63
+ check "Ruby version >= 1.9.3" do
64
+ RUBY_VERSION >= "1.9.3"
65
+ end
66
+
63
67
  def self.load!
64
68
  require 'multi_git/rugged_backend'
65
69
  end
@@ -1,6 +1,7 @@
1
1
  require 'stringio'
2
2
  require 'multi_git/object'
3
3
  require 'multi_git/builder'
4
+ require 'digest/sha1'
4
5
  module MultiGit
5
6
  module Blob
6
7
 
@@ -8,6 +9,17 @@ module MultiGit
8
9
  def type
9
10
  :blob
10
11
  end
12
+
13
+ def ==(other)
14
+ return false unless other.respond_to? :oid
15
+ return oid == other.oid
16
+ end
17
+
18
+ def inspect
19
+ ['<',self.class,' ',oid,'>'].join
20
+ end
21
+
22
+ alias to_s inspect
11
23
  end
12
24
 
13
25
  class Builder < StringIO
@@ -39,6 +51,13 @@ module MultiGit
39
51
  rewind
40
52
  return repo.write(read)
41
53
  end
54
+
55
+ def oid
56
+ dig = Digest::SHA1.new
57
+ dig << "blob #{size}\0"
58
+ dig << content
59
+ return dig.hexdigest
60
+ end
42
61
  end
43
62
 
44
63
  include Object
@@ -75,6 +75,23 @@ module MultiGit
75
75
  ]
76
76
  end
77
77
 
78
+ extend Forwardable
79
+
80
+ delegate (Tree::Builder.instance_methods - self.instance_methods) => :object
81
+
82
+ def from
83
+ defined?(@from) ? @from : @from = make_from
84
+ end
85
+
86
+ private
87
+
88
+ def make_from
89
+ if object.from.nil?
90
+ nil
91
+ else
92
+ Directory::Builder.new(parent, name, object.from)
93
+ end
94
+ end
78
95
  end
79
96
 
80
97
  include Base
@@ -26,6 +26,12 @@ module MultiGit
26
26
  include Error
27
27
  end
28
28
 
29
+ class EntryDoesNotExist < InvalidTraversal
30
+ end
31
+
32
+ class NotADirectory < InvalidTraversal
33
+ end
34
+
29
35
  class CyclicSymlink < Exception
30
36
  include Error
31
37
  end
@@ -4,9 +4,17 @@ module MultiGit
4
4
 
5
5
  class Executeable < File
6
6
 
7
- def mode
8
- Utils::MODE_EXECUTEABLE
7
+ module Base
8
+ def mode
9
+ Utils::MODE_EXECUTEABLE
10
+ end
9
11
  end
12
+
13
+ class Builder < File::Builder
14
+ include Base
15
+ end
16
+
17
+ include Base
10
18
  end
11
19
 
12
20
  end
@@ -24,12 +24,16 @@ module MultiGit
24
24
  end
25
25
  Blob::Builder.new(*args)
26
26
  end
27
+
28
+ extend Forwardable
29
+
30
+ delegate (Blob::Builder.instance_methods - self.instance_methods) => :object
27
31
  end
28
32
 
29
33
  include Base
30
34
  extend Forwardable
31
35
 
32
- delegate (Blob.instance_methods - Object.instance_methods) => :object
36
+ delegate (Blob.instance_methods - self.instance_methods) => :object
33
37
  end
34
38
 
35
39
  end
@@ -17,6 +17,8 @@ module MultiGit
17
17
 
18
18
  SYMBOLIC_REF_LINE = /\Aref: ([a-z0-9_]+(?:\/[a-z0-9_]+)*)\Z/i.freeze
19
19
  OID_REF_LINE = /\A(\h{40})\Z/i.freeze
20
+ PACKED_REFS = 'packed-refs'.freeze
21
+ PACKED_REF_LINE = /\A(\h{40}) (\S+)\Z/
20
22
 
21
23
  def read!
22
24
  begin
@@ -30,6 +32,19 @@ module MultiGit
30
32
  end
31
33
  rescue Errno::ENOENT
32
34
  # doesn't exists
35
+ # query packed refs
36
+ begin
37
+ packed = IO.read(::File.join(repository.git_dir, PACKED_REFS))
38
+ packed.each_line do |line|
39
+ if line =~ PACKED_REF_LINE
40
+ if $2 == name
41
+ @target = repository.read($1)
42
+ break
43
+ end
44
+ end
45
+ end
46
+ rescue Errno::ENOENT
47
+ end
33
48
  end
34
49
  end
35
50
  end
@@ -40,8 +40,20 @@ module MultiGit
40
40
  def fetch(*refspecs)
41
41
  rs = parse_fetch_refspec(*refspecs)
42
42
  repository.__backend__['fetch',fetch_urls.first,*rs.map(&:to_s)]
43
+ return self
43
44
  end
44
45
 
46
+ def push(*refspecs)
47
+ rs = parse_push_refspec(*refspecs)
48
+ repository.__backend__['push',*push_urls,*rs.map(&:to_s)]
49
+ return self
50
+ end
51
+
52
+ def save( name )
53
+ begin
54
+ rescue Cmd::Error::ExitCode128
55
+ end
56
+ end
45
57
  end
46
58
  end
47
59
  end
@@ -27,7 +27,7 @@ module MultiGit
27
27
  end
28
28
  end
29
29
 
30
- DEFAULT = parse("MultiGit #{MultiGit::VERSION} <#{MultiGit::VERSION}@multi.git>")
30
+ DEFAULT = parse("MultiGit <default@multi.git>")
31
31
 
32
32
  end
33
33
  end
@@ -8,8 +8,10 @@ module MultiGit
8
8
  # HACK!
9
9
  # @api private
10
10
  # @visibility private
11
- class Java::OrgEclipseJgitStorageFile::RefDirectoryUpdate
12
- public :tryLock, :unlock, :doUpdate, :doDelete
11
+ if defined? Java::OrgEclipseJgitStorageFile::RefDirectoryUpdate
12
+ class Java::OrgEclipseJgitStorageFile::RefDirectoryUpdate
13
+ public :tryLock, :unlock, :doUpdate, :doDelete
14
+ end
13
15
  end
14
16
 
15
17
  # @api developer
@@ -52,6 +52,16 @@ module MultiGit
52
52
  use_transport( FETCH ) do | transport |
53
53
  transport.fetch( transport_monitor, rs )
54
54
  end
55
+ self
56
+ end
57
+
58
+ def push( *refspecs )
59
+ rs = parse_push_refspec(*refspecs).map{|refspec| Java::OrgEclipseJgitTransport::RefSpec.new(refspec.to_s) }
60
+ use_transport( PUSH ) do | transport |
61
+ toPush = transport.findRemoteRefUpdatesFor( rs )
62
+ transport.push( transport_monitor, toPush )
63
+ end
64
+ self
55
65
  end
56
66
 
57
67
  private
data/lib/multi_git/ref.rb CHANGED
@@ -73,29 +73,82 @@ module MultiGit
73
73
  end
74
74
 
75
75
  # @api developer
76
- class FileUpdater < Updater
76
+ module Locking
77
+ def lock_file_path
78
+ ::File.join(repository.git_dir, name + '.lock')
79
+ end
77
80
 
78
- protected
81
+ def acquire_lock
82
+ f = ::File.open(lock_file_path, ::File::CREAT | ::File::RDWR | ::File::EXCL )
83
+ f.flock(::File::LOCK_EX)
84
+ return f
85
+ end
86
+
87
+ def release_lock(lock)
88
+ ::File.unlink(lock.path)
89
+ lock.flock(::File::LOCK_UN)
90
+ lock.close
91
+ end
79
92
 
80
93
  def ensure_dir!
81
- FileUtils.mkdir_p(::File.dirname(file_path))
94
+ FileUtils.mkdir_p(::File.dirname(lock_file_path))
95
+ end
96
+
97
+ def file_path
98
+ ::File.join(repository.git_dir, name)
82
99
  end
100
+ end
83
101
 
84
- def open_file(exists)
102
+ # @api developer
103
+ class FileUpdater < Updater
104
+
105
+ protected
106
+
107
+ include Locking
108
+
109
+ def open_file!
85
110
  mode = ::File::WRONLY | ::File::TRUNC
86
- if !exists
111
+ 3.times do
87
112
  begin
88
113
  return ::File.open(file_path, mode | ::File::CREAT)
89
114
  rescue Errno::EEXIST
90
- raise Error::ConcurrentRefUpdate
91
115
  end
92
- else
93
116
  begin
94
117
  return ::File.open(file_path, mode)
95
118
  rescue Errno::ENOENT
96
- raise Error::ConcurrentRefUpdate
97
119
  end
98
120
  end
121
+ raise "Unable to open ref file for update"
122
+ end
123
+
124
+ def update!( nx )
125
+ str = object_to_ref_str(nx)
126
+ begin
127
+ file = open_file!
128
+ file.puts(str)
129
+ file.flush
130
+ ensure
131
+ file.close if file
132
+ end
133
+ end
134
+
135
+ def remove!
136
+ begin
137
+ ::File.unlink(file_path)
138
+ rescue Errno::ENOENT
139
+ end
140
+ begin
141
+ inf = ::File.open(packed_ref_path, ::File::RDONLY)
142
+ outf = ::File.open(packed_ref_path, ::File::WRONLY | ::File::TRUNC)
143
+ nb = "#{name}\n"
144
+ inf.each_line do |line|
145
+ next if line.end_with?(nb)
146
+ outf.write(line)
147
+ end
148
+ inf.close
149
+ outf.close
150
+ rescue Errno::ENOENT
151
+ end
99
152
  end
100
153
 
101
154
  def object_to_ref_str(object)
@@ -106,90 +159,54 @@ module MultiGit
106
159
  end
107
160
  end
108
161
 
109
- def file_path
110
- ::File.join(repository.git_dir, name)
111
- end
112
-
113
- def lock_file_path
114
- ::File.join(repository.git_dir, name + '.lock')
115
- end
116
-
117
- def acquire_lock
118
- ::File.open(lock_file_path, ::File::CREAT | ::File::RDWR | ::File::EXCL )
119
- end
120
-
121
- def release_lock(lock)
122
- ::File.unlink(lock.path)
123
- lock.flock(::File::LOCK_UN)
162
+ def packed_ref_path
163
+ ::File.join(repository.git_dir, 'packed-refs')
124
164
  end
125
-
126
165
  end
127
166
 
128
167
  # @api developer
129
- class PessimisticFileUpdater < FileUpdater
168
+ module PessimisticUpdater
130
169
 
131
170
  def initialize(*_)
132
171
  super
133
172
  ensure_dir!
134
173
  @lock = acquire_lock
135
174
  # safe now
136
- @ref = @ref.reload
175
+ self.ref = ref.reload
137
176
  end
138
177
 
139
178
  def update(new)
140
- old = target
141
179
  nx = super
142
180
  if nx
143
- str = object_to_ref_str(nx)
144
- begin
145
- file = open_file(!old.nil?)
146
- file.puts(str)
147
- file.flush
148
- ensure
149
- file.close if file
150
- end
181
+ update!(nx)
151
182
  else
152
- ::File.unlink(file_path)
183
+ remove!
153
184
  end
154
185
  return nx
155
186
  end
156
187
 
157
188
  def destroy!
158
- release_lock(@lock)
189
+ release_lock(@lock) if @lock
159
190
  end
160
191
  end
161
192
 
162
193
  # @api developer
163
- class OptimisticFileUpdater < FileUpdater
194
+ module OptimisticUpdater
164
195
 
165
196
  def update(new)
166
197
  ensure_dir!
198
+ lock = acquire_lock
167
199
  begin
168
- lock = acquire_lock
169
- if ::File.exists?(file_path)
170
- content = ::File.read(file_path).chomp
171
- if content != object_to_ref_str(target)
172
- raise Error::ConcurrentRefUpdate
173
- end
174
- elsif !target.nil?
200
+ current = ref.reload.target
201
+ if current != target
175
202
  raise Error::ConcurrentRefUpdate
176
203
  end
177
204
  old = target
178
205
  nx = super
179
206
  if nx.nil?
180
- if !old
181
- return nx
182
- end
183
- ::File.unlink(file_path)
207
+ remove!
184
208
  else
185
- begin
186
- file = open_file( !old.nil? )
187
- str = object_to_ref_str(nx)
188
- file.puts( str )
189
- file.flush
190
- ensure
191
- file.close if file
192
- end
209
+ update!(nx)
193
210
  end
194
211
  return nx
195
212
  ensure
@@ -198,6 +215,14 @@ module MultiGit
198
215
  end
199
216
  end
200
217
 
218
+ class OptimisticFileUpdater < FileUpdater
219
+ include OptimisticUpdater
220
+ end
221
+
222
+ class PessimisticFileUpdater < FileUpdater
223
+ include PessimisticUpdater
224
+ end
225
+
201
226
  class RecklessUpdater < Updater
202
227
  def update( new )
203
228
  pu = PessimisticFileUpdater.new( ref )
@@ -49,19 +49,31 @@ module MultiGit
49
49
  @to_base = to_base
50
50
  end
51
51
 
52
- #
53
- # @param args [RefSpec, String, Hash, Range, ...]
54
- # @return [Array<RefSpec>]
52
+ # @overload [](*args)
53
+ # @param args [RefSpec, String, Hash, Range, ...]
54
+ # @return [Array<RefSpec>]
55
+ #
56
+ # @overload [](*args, options)
57
+ # @param args [RefSpec, String, Hash, Range, ...]
58
+ # @param options [Hash]
59
+ # @option options [Boolean] :forced (false)
60
+ # @return [Array<RefSpec>]
55
61
  def [](*args)
62
+ forced = false
63
+ if args.last.kind_of? Hash
64
+ options = args.pop.dup
65
+ forced = options.delete(:forced){ false }
66
+ args << options
67
+ end
56
68
  args.collect_concat do |arg|
57
69
  if arg.kind_of? RefSpec
58
70
  [arg]
59
71
  elsif arg.kind_of? String
60
- [parse_string(arg)]
72
+ [parse_string(arg, forced)]
61
73
  elsif arg.kind_of? Hash
62
- arg.map{|k,v| parse_pair(k,v) }
74
+ arg.map{|k,v| parse_pair(k,v, forced) }
63
75
  elsif arg.kind_of? Range
64
- [parse_pair(arg.begin, arg.end)]
76
+ [parse_pair(arg.begin, arg.end, forced)]
65
77
  else
66
78
  raise ArgumentError, "Expected a String, Hash or Range. Got #{arg.inspect}"
67
79
  end
@@ -69,7 +81,7 @@ module MultiGit
69
81
  end
70
82
 
71
83
  private
72
- def parse_string(string)
84
+ def parse_string(string, forced)
73
85
  if ma = REF.match(string)
74
86
  if ma[2]
75
87
  from = normalize(from_base, ma[2])
@@ -79,12 +91,12 @@ module MultiGit
79
91
  else
80
92
  to = normalize(to_base, ma[2])
81
93
  end
82
- RefSpec.new( from, to, ma[1] == '+' )
94
+ RefSpec.new( from, to, forced || (ma[1] == '+') )
83
95
  end
84
96
  end
85
97
 
86
- def parse_pair(a,b)
87
- RefSpec.new( normalize(from_base,a.to_s), normalize(to_base,b.to_s) )
98
+ def parse_pair(a,b, forced)
99
+ RefSpec.new( normalize(from_base,a.to_s), normalize(to_base,b.to_s), forced )
88
100
  end
89
101
 
90
102
  def normalize(base, name)
@@ -19,10 +19,12 @@ module MultiGit
19
19
 
20
20
  # @!method fetch( *refspecs )
21
21
  # @param refspecs [RefSpec, String, Range, Hash, ...]
22
+ # @return self
22
23
  abstract :fetch
23
24
 
24
25
  # @!method push( *refspecs )
25
26
  # @param refspecs [RefSpec, String, Range, Hash, ...]
27
+ # @return self
26
28
  abstract :push
27
29
 
28
30
  # @!method save( name )
@@ -45,7 +47,7 @@ module MultiGit
45
47
 
46
48
  protected
47
49
 
48
- def refspec_parser
50
+ def fetch_refspec_parser
49
51
  RefSpec::Parser.new("refs/remotes/#{name}/")
50
52
  end
51
53
 
@@ -54,13 +56,22 @@ module MultiGit
54
56
  protected
55
57
 
56
58
  def parse_fetch_refspec(*refspecs)
57
- refspec_parser[*refspecs]
59
+ fetch_refspec_parser[*refspecs]
58
60
  end
59
61
 
60
- def refspec_parser
62
+ def parse_push_refspec(*refspecs)
63
+ push_refspec_parser[*refspecs]
64
+ end
65
+
66
+ def fetch_refspec_parser
61
67
  RefSpec::Parser.new("refs/remotes//")
62
68
  end
63
69
 
70
+ def push_refspec_parser
71
+ RefSpec::Parser.new('refs/heads/')
72
+ end
73
+
74
+
64
75
  end
65
76
 
66
77
  end
@@ -30,10 +30,49 @@ module MultiGit
30
30
  end
31
31
  end
32
32
 
33
- private
33
+ # @api private
34
+ # @visibility private
34
35
  attr :rugged_ref
36
+
37
+ private
38
+ class Updater < MultiGit::Ref::Updater
39
+ include MultiGit::Ref::Locking
40
+ protected
41
+ def update!(nx)
42
+ Rugged::Reference.create(repository.__backend__, name, object_to_ref_str(nx), true)
43
+ end
44
+ def remove!
45
+ ref.rugged_ref.delete!
46
+ end
47
+ def object_to_ref_str(nx)
48
+ case( nx )
49
+ when MultiGit::Object then nx.oid
50
+ when Ref then nx.name
51
+ end
52
+ end
53
+
54
+ # nerf release_lock, rugged does that for us
55
+ def release_lock(_)
56
+ end
57
+ end
58
+
59
+ class OptimisticUpdater < Updater
60
+ include MultiGit::Ref::OptimisticUpdater
61
+ end
62
+
63
+ class PessimisticUpdater < Updater
64
+ include MultiGit::Ref::PessimisticUpdater
65
+ end
66
+
67
+ def pessimistic_updater
68
+ PessimisticUpdater
69
+ end
70
+
71
+ def optimistic_updater
72
+ OptimisticUpdater
73
+ end
74
+
35
75
  end
36
76
 
37
77
  end
38
-
39
78
  end
@@ -42,6 +42,10 @@ module MultiGit
42
42
 
43
43
  end
44
44
 
45
+ def save( name )
46
+ rugged_remote.rename!( name )
47
+ end
48
+
45
49
  if Rugged::Remote.instance_methods.include? :clear_refspecs
46
50
  def fetch(*refspecs)
47
51
  rs = parse_fetch_refspec(*refspecs)
@@ -61,6 +65,16 @@ module MultiGit
61
65
  end
62
66
  end
63
67
 
68
+ def push(*refspecs)
69
+ rs = parse_push_refspec(*refspecs).map(&:to_s)
70
+ # rugged cannot push to multiple locations currently
71
+ push_urls.each do | pu |
72
+ cl = Rugged::Remote.new(repository.__backend__, pu)
73
+ cl.clear_refspecs
74
+ cl.push(rs)
75
+ end
76
+ end
77
+
64
78
  end
65
79
  end
66
80
  end
@@ -11,6 +11,7 @@ module MultiGit
11
11
  include Tree::Base
12
12
 
13
13
  attr :entries
14
+ attr :from
14
15
 
15
16
  def initialize(from = nil, &block)
16
17
  @entries = {}
@@ -163,6 +164,12 @@ module MultiGit
163
164
  }
164
165
  end
165
166
 
167
+ def executeable(name, content = nil, &block)
168
+ set(name){|parent, name|
169
+ Executeable::Builder.new(parent, name, content, &block)
170
+ }
171
+ end
172
+
166
173
  def directory(name, &block)
167
174
  set(name){|parent, name|
168
175
  Directory::Builder.new(parent, name, &block)
@@ -183,6 +190,36 @@ module MultiGit
183
190
  self
184
191
  end
185
192
 
193
+ # Checks if the file at the given path was changed.
194
+ #
195
+ # @param [String] path
196
+ #
197
+ # @example from scratch
198
+ # builder = MultiGit::Tree::Builder.new
199
+ # builder.file('a_file','some content')
200
+ # builder.changed? 'a_file' #=> eq true
201
+ # builder.changed? 'another_file' #=> eq false
202
+ def changed?( path )
203
+ begin
204
+ new = traverse(path)
205
+ rescue Error::EntryDoesNotExist
206
+ return false unless from
207
+ begin
208
+ old = from.traverse(path)
209
+ rescue Error::EntryDoesNotExist
210
+ return false
211
+ end
212
+ return true
213
+ end
214
+ return true unless from
215
+ begin
216
+ old = from.traverse(path)
217
+ rescue Error::EntryDoesNotExist
218
+ return true
219
+ end
220
+ return new != old
221
+ end
222
+
186
223
  end
187
224
 
188
225
  include DSL
@@ -60,10 +60,10 @@ module MultiGit
60
60
  # do nothing
61
61
  else
62
62
  if !current.respond_to? :entry
63
- raise MultiGit::Error::InvalidTraversal, "Can't traverse to #{path} from #{self.inspect}: #{current.inspect} doesn't contain an entry named #{part.inspect}"
63
+ raise MultiGit::Error::NotADirectory, "Can't traverse to #{path} from #{self.inspect}: #{current.inspect} doesn't contain an entry named #{part.inspect}"
64
64
  end
65
65
  entry = current.entry(part)
66
- raise MultiGit::Error::InvalidTraversal, "Can't traverse to #{path} from #{self.inspect}: #{current.inspect} doesn't contain an entry named #{part.inspect}" unless entry
66
+ raise MultiGit::Error::EntryDoesNotExist, "Can't traverse to #{path} from #{self.inspect}: #{current.inspect} doesn't contain an entry named #{part.inspect}" unless entry
67
67
  # may be a symlink
68
68
  if entry.respond_to? :target
69
69
  # this is a symlink
@@ -170,6 +170,11 @@ module MultiGit
170
170
  entries.keys
171
171
  end
172
172
 
173
+ def ==( other )
174
+ return false unless other.respond_to? :entries
175
+ entries == other.entries
176
+ end
177
+
173
178
  end
174
179
 
175
180
  include Base
@@ -3,21 +3,11 @@ require 'multi_git/object'
3
3
  require 'multi_git/builder'
4
4
  require 'multi_git/walkable'
5
5
  module MultiGit
6
-
7
- base = Class.new
8
-
9
- # @!parse
10
- # class TreeEntry < TreeEntry::Base
11
- # end
12
- TreeEntry = Class.new(base)
13
-
14
6
  # A tree entry is like a {MultiGit::Object} or a {MultiGit::Builder} but it
15
7
  # also has knows it's parent tree.
16
8
  class TreeEntry
17
9
 
18
- Base = superclass
19
-
20
- class Base
10
+ module Base
21
11
 
22
12
  include Walkable
23
13
 
@@ -56,11 +46,20 @@ module MultiGit
56
46
  end
57
47
  end
58
48
 
59
- end
49
+ def ==(other)
50
+ return false unless other.respond_to?(:path) && other.respond_to?(:object) && other.respond_to?(:mode)
51
+ return (path == other.path) && (object == other.object) && (mode == other.mode)
52
+ end
60
53
 
61
- class Builder < Base
54
+ def inspect
55
+ ['#<', self.class.name,'@',path,' ', object.inspect, '>'].join
56
+ end
57
+ end
58
+
59
+ class Builder# < Base
62
60
 
63
61
  include MultiGit::Builder
62
+ include Base
64
63
 
65
64
  # @return [MultiGit::Builder]
66
65
  attr :object
@@ -78,26 +77,22 @@ module MultiGit
78
77
  super( parent, name , make_inner(*args) )
79
78
  instance_eval(&block) if block
80
79
  end
81
-
82
80
  end
83
81
 
84
82
  # @return [MultiGit::Object]
85
83
  attr :object
86
84
 
87
85
  include MultiGit::Object
86
+ include Base
88
87
 
89
88
  extend Forwardable
90
89
 
91
- delegate (MultiGit::Object.instance_methods - ::Object.instance_methods) => :object
90
+ delegate [:oid, :content, :to_io, :bytesize] => :object
92
91
 
93
92
  def to_builder
94
93
  self.class::Builder.new(parent, name, object)
95
94
  end
96
95
 
97
- def inspect
98
- ['#<', self.class.name,' ',path,' ', oid, '>'].join
99
- end
100
-
101
96
 
102
97
  end
103
98
 
@@ -1,3 +1,3 @@
1
1
  module MultiGit
2
- VERSION = '0.0.1.beta1'
2
+ VERSION = '0.0.1.rc1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multi_git
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.beta1
4
+ version: 0.0.1.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hannes Georg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-23 00:00:00.000000000 Z
11
+ date: 2013-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -38,6 +38,48 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: coveralls
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: yard
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: kramdown
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
41
83
  - !ruby/object:Gem::Dependency
42
84
  name: simplecov
43
85
  requirement: !ruby/object:Gem::Requirement
@@ -58,64 +100,65 @@ executables: []
58
100
  extensions: []
59
101
  extra_rdoc_files: []
60
102
  files:
61
- - lib/multi_git/refspec.rb
62
- - lib/multi_git/tree.rb
63
- - lib/multi_git/git_backend.rb
64
- - lib/multi_git/config/schema.rb
65
- - lib/multi_git/config/default_schema.rb
66
- - lib/multi_git/utils.rb
67
- - lib/multi_git/backend.rb
68
- - lib/multi_git/symlink.rb
103
+ - lib/multi_git/handle.rb
104
+ - lib/multi_git/commit.rb
105
+ - lib/multi_git/walkable.rb
69
106
  - lib/multi_git/executeable.rb
70
- - lib/multi_git/repository.rb
107
+ - lib/multi_git/tree/builder.rb
108
+ - lib/multi_git/submodule.rb
109
+ - lib/multi_git/blob.rb
71
110
  - lib/multi_git/object.rb
72
- - lib/multi_git/git_backend/tree.rb
73
- - lib/multi_git/git_backend/repository.rb
74
- - lib/multi_git/git_backend/object.rb
75
- - lib/multi_git/git_backend/remote.rb
76
- - lib/multi_git/git_backend/blob.rb
77
- - lib/multi_git/git_backend/ref.rb
78
- - lib/multi_git/git_backend/cmd.rb
79
- - lib/multi_git/git_backend/config.rb
80
- - lib/multi_git/git_backend/commit.rb
81
- - lib/multi_git/remote.rb
111
+ - lib/multi_git/directory.rb
82
112
  - lib/multi_git/jgit_backend.rb
83
- - lib/multi_git/blob.rb
84
- - lib/multi_git/ref.rb
85
- - lib/multi_git/error.rb
86
- - lib/multi_git/jgit_backend/tree.rb
87
- - lib/multi_git/jgit_backend/rewindeable_io.rb
88
- - lib/multi_git/jgit_backend/repository.rb
89
- - lib/multi_git/jgit_backend/object.rb
90
- - lib/multi_git/jgit_backend/remote.rb
91
- - lib/multi_git/jgit_backend/blob.rb
92
- - lib/multi_git/jgit_backend/ref.rb
93
- - lib/multi_git/jgit_backend/config.rb
94
- - lib/multi_git/jgit_backend/commit.rb
95
- - lib/multi_git/submodule.rb
113
+ - lib/multi_git/version.rb
96
114
  - lib/multi_git/file.rb
97
- - lib/multi_git/rugged_backend/tree.rb
98
- - lib/multi_git/rugged_backend/repository.rb
99
- - lib/multi_git/rugged_backend/object.rb
100
- - lib/multi_git/rugged_backend/remote.rb
101
- - lib/multi_git/rugged_backend/blob.rb
102
- - lib/multi_git/rugged_backend/ref.rb
103
- - lib/multi_git/rugged_backend/config.rb
104
- - lib/multi_git/rugged_backend/commit.rb
115
+ - lib/multi_git/error.rb
116
+ - lib/multi_git/refspec.rb
117
+ - lib/multi_git/backend.rb
118
+ - lib/multi_git/tree.rb
105
119
  - lib/multi_git/config.rb
106
- - lib/multi_git/handle.rb
107
- - lib/multi_git/backend_set.rb
108
- - lib/multi_git/version.rb
120
+ - lib/multi_git/ref.rb
121
+ - lib/multi_git/builder.rb
122
+ - lib/multi_git/remote.rb
123
+ - lib/multi_git/git_backend/commit.rb
124
+ - lib/multi_git/git_backend/blob.rb
125
+ - lib/multi_git/git_backend/object.rb
126
+ - lib/multi_git/git_backend/cmd.rb
127
+ - lib/multi_git/git_backend/tree.rb
128
+ - lib/multi_git/git_backend/config.rb
129
+ - lib/multi_git/git_backend/ref.rb
130
+ - lib/multi_git/git_backend/remote.rb
131
+ - lib/multi_git/git_backend/repository.rb
132
+ - lib/multi_git/symlink.rb
133
+ - lib/multi_git/repository.rb
134
+ - lib/multi_git/git_backend.rb
135
+ - lib/multi_git/config/default_schema.rb
136
+ - lib/multi_git/config/schema.rb
109
137
  - lib/multi_git/rugged_backend.rb
110
- - lib/multi_git/commit.rb
138
+ - lib/multi_git/utils.rb
111
139
  - lib/multi_git/tree_entry.rb
112
- - lib/multi_git/builder.rb
113
- - lib/multi_git/directory.rb
114
- - lib/multi_git/walkable.rb
115
- - lib/multi_git/tree/builder.rb
140
+ - lib/multi_git/backend_set.rb
141
+ - lib/multi_git/rugged_backend/commit.rb
142
+ - lib/multi_git/rugged_backend/blob.rb
143
+ - lib/multi_git/rugged_backend/object.rb
144
+ - lib/multi_git/rugged_backend/tree.rb
145
+ - lib/multi_git/rugged_backend/config.rb
146
+ - lib/multi_git/rugged_backend/ref.rb
147
+ - lib/multi_git/rugged_backend/remote.rb
148
+ - lib/multi_git/rugged_backend/repository.rb
149
+ - lib/multi_git/jgit_backend/commit.rb
150
+ - lib/multi_git/jgit_backend/blob.rb
151
+ - lib/multi_git/jgit_backend/object.rb
152
+ - lib/multi_git/jgit_backend/tree.rb
153
+ - lib/multi_git/jgit_backend/config.rb
154
+ - lib/multi_git/jgit_backend/ref.rb
155
+ - lib/multi_git/jgit_backend/remote.rb
156
+ - lib/multi_git/jgit_backend/repository.rb
157
+ - lib/multi_git/jgit_backend/rewindeable_io.rb
116
158
  - lib/multi_git.rb
117
159
  homepage: https://github.com/hannesg/multi_git
118
- licenses: []
160
+ licenses:
161
+ - GPL-3
119
162
  metadata: {}
120
163
  post_install_message:
121
164
  rdoc_options: []
@@ -134,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
177
  requirements:
135
178
  - jar 'org.eclipse.jgit:org.eclipse.jgit'
136
179
  rubyforge_project:
137
- rubygems_version: 2.0.3
180
+ rubygems_version: 2.1.4
138
181
  signing_key:
139
182
  specification_version: 4
140
183
  summary: Use all the git