gitrb 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/gitrb.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'gitrb'
3
- s.version = '0.1.6'
3
+ s.version = '0.1.7'
4
4
  s.summary = 'Pure ruby git implementation'
5
5
  s.author = 'Daniel Mendler'
6
6
  s.email = 'mail@daniel-mendler.de'
@@ -18,7 +18,6 @@ gitrb.gemspec
18
18
  lib/gitrb.rb
19
19
  lib/gitrb/blob.rb
20
20
  lib/gitrb/commit.rb
21
- lib/gitrb/diff.rb
22
21
  lib/gitrb/gitobject.rb
23
22
  lib/gitrb/pack.rb
24
23
  lib/gitrb/reference.rb
data/lib/gitrb/blob.rb CHANGED
@@ -16,10 +16,6 @@ module Gitrb
16
16
  :blob
17
17
  end
18
18
 
19
- def ==(other)
20
- Blob === other && id == other.id
21
- end
22
-
23
19
  def dump
24
20
  @data
25
21
  end
data/lib/gitrb/commit.rb CHANGED
@@ -21,10 +21,6 @@ module Gitrb
21
21
  (committer && committer.date) || (author && author.date)
22
22
  end
23
23
 
24
- def ==(other)
25
- Commit === other && id == other.id
26
- end
27
-
28
24
  def save
29
25
  repository.put(self)
30
26
  id
@@ -11,6 +11,10 @@ module Gitrb
11
11
  self
12
12
  end
13
13
 
14
+ def ==(other)
15
+ self.class === other && id == other.id
16
+ end
17
+
14
18
  @types = {}
15
19
 
16
20
  def self.inherited(subclass)
@@ -12,6 +12,8 @@ module Gitrb
12
12
  end
13
13
  end
14
14
 
15
+ Diff = Struct.new(:from, :to, :patch)
16
+
15
17
  class Repository
16
18
  attr_reader :path, :root, :branch, :head, :encoding
17
19
 
@@ -82,7 +84,7 @@ module Gitrb
82
84
  !!@lock[Thread.current.object_id]
83
85
  end
84
86
 
85
- # Diff
87
+ # Difference between versions
86
88
  # Options:
87
89
  # :to - Required target commit
88
90
  # :from - Optional source commit (otherwise comparision with empty tree)
@@ -152,14 +154,15 @@ module Gitrb
152
154
  end
153
155
 
154
156
  # Returns a list of commits starting from head commit.
155
- def log(limit = 10, start = nil, path = nil)
156
- limit = limit.to_s
157
- start = start.to_s
158
- path = path.to_s
159
- raise ArgumentError, "Invalid limit: #{limit}" if limit !~ /^\d+$/
160
- raise ArgumentError, "Invalid commit: #{start}" if start =~ /^\-/
157
+ def log(opts = {})
158
+ max_count = opts[:max_count]
159
+ skip = opts[:skip]
160
+ start = opts[:start]
161
+ path = opts[:path]
162
+ raise ArgumentError, "Invalid commit: #{start}" if start.to_s =~ /^\-/
161
163
  log = git_log('--pretty=tformat:%H%n%P%n%T%n%an%n%ae%n%at%n%cn%n%ce%n%ct%n%x00%s%n%b%x00',
162
- "-#{limit}", start.empty? ? nil : start, '--', path.empty? ? nil : path).split(/\n*\x00\n*/)
164
+ skip ? "--skip=#{skip.to_i}" : nil,
165
+ max_count ? "--max-count=#{max_count.to_i}" : nil, start, '--', path).split(/\n*\x00\n*/)
163
166
  commits = []
164
167
  log.each_slice(2) do |data, message|
165
168
  data = data.split("\n")
data/lib/gitrb/tag.rb CHANGED
@@ -8,10 +8,6 @@ module Gitrb
8
8
  parse(options[:data]) if options[:data]
9
9
  end
10
10
 
11
- def ==(other)
12
- Tag === other && id == other.id
13
- end
14
-
15
11
  def parse(data)
16
12
  headers, @message = data.split("\n\n", 2)
17
13
  repository.set_encoding(@message)
data/lib/gitrb/tree.rb CHANGED
@@ -18,10 +18,6 @@ module Gitrb
18
18
  :tree
19
19
  end
20
20
 
21
- def ==(other)
22
- Tree === other && id == other.id
23
- end
24
-
25
21
  # Set new repository (modified flag is reset)
26
22
  def id=(id)
27
23
  @modified = false
data/lib/gitrb/user.rb CHANGED
@@ -1,8 +1,11 @@
1
1
  module Gitrb
2
+ class User
3
+ attr_reader :name, :email, :date
2
4
 
3
- class User < Struct.new(:name, :email, :date)
4
5
  def initialize(name, email, date = Time.now)
5
- super
6
+ @name = name
7
+ @email = email
8
+ @date = date
6
9
  end
7
10
 
8
11
  def dump
@@ -17,5 +20,4 @@ module Gitrb
17
20
  end
18
21
 
19
22
  end
20
-
21
23
  end
data/lib/gitrb.rb CHANGED
@@ -10,7 +10,6 @@ require 'gitrb/util'
10
10
  require 'gitrb/gitobject'
11
11
  require 'gitrb/reference'
12
12
  require 'gitrb/blob'
13
- require 'gitrb/diff'
14
13
  require 'gitrb/tree'
15
14
  require 'gitrb/tag'
16
15
  require 'gitrb/user'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 6
9
- version: 0.1.6
8
+ - 7
9
+ version: 0.1.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Mendler
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-08-13 00:00:00 +02:00
17
+ date: 2010-08-21 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -45,7 +45,6 @@ files:
45
45
  - lib/gitrb.rb
46
46
  - lib/gitrb/blob.rb
47
47
  - lib/gitrb/commit.rb
48
- - lib/gitrb/diff.rb
49
48
  - lib/gitrb/gitobject.rb
50
49
  - lib/gitrb/pack.rb
51
50
  - lib/gitrb/reference.rb
data/lib/gitrb/diff.rb DELETED
@@ -1,3 +0,0 @@
1
- module Gitrb
2
- Diff = Struct.new(:from, :to, :patch)
3
- end