mercurial-ruby 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/mercurial-ruby/commit.rb +2 -2
- data/lib/mercurial-ruby/factories/diff_factory.rb +7 -5
- data/lib/mercurial-ruby/node.rb +3 -3
- data/lib/mercurial-ruby/shell.rb +5 -0
- data/lib/mercurial-ruby.rb +1 -1
- data/mercurial-ruby.gemspec +2 -2
- data/test/fixtures/test-repo.zip +0 -0
- data/test/test_commit_factory.rb +3 -3
- data/test/test_diff_factory.rb +18 -2
- data/test/test_file_index.rb +2 -2
- data/test/test_shell.rb +4 -0
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.1
|
@@ -33,8 +33,10 @@ module Mercurial
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
def for_path(path, revision_a, revision_b, cmd_options={})
|
37
|
-
|
36
|
+
def for_path(path, revision_a, revision_b, options={}, cmd_options={})
|
37
|
+
cmd = "diff ? -r ? -r ?"
|
38
|
+
cmd << ' -w' if options[:ignore_whitespace]
|
39
|
+
build(hg([cmd, path, revision_a, revision_b], cmd_options))
|
38
40
|
end
|
39
41
|
|
40
42
|
private
|
@@ -47,8 +49,8 @@ module Mercurial
|
|
47
49
|
file_a = binary_file
|
48
50
|
body = 'Binary files differ'
|
49
51
|
else
|
50
|
-
file_a = data.scan(
|
51
|
-
file_b = data.scan(
|
52
|
+
file_a = data.scan(/^\[?--- (?:a\/([^\+]+)|\/dev\/null)-?\]?\t/).flatten.first
|
53
|
+
file_b = data.scan(/^\{?\+\+\+ (?:b\/([^\+]+)|\/dev\/null)\+?\}?\t/).flatten.first
|
52
54
|
body = data[data.index("\n")+1..-1]
|
53
55
|
end
|
54
56
|
|
@@ -64,4 +66,4 @@ module Mercurial
|
|
64
66
|
|
65
67
|
end
|
66
68
|
|
67
|
-
end
|
69
|
+
end
|
data/lib/mercurial-ruby/node.rb
CHANGED
@@ -65,8 +65,8 @@ module Mercurial
|
|
65
65
|
@_entries ||= repository.nodes.entries_for(path, revision, self)
|
66
66
|
end
|
67
67
|
|
68
|
-
def diff_to(revision_b)
|
69
|
-
repository.diffs.for_path(path, revision, revision_b)
|
68
|
+
def diff_to(revision_b, options={})
|
69
|
+
repository.diffs.for_path(path, revision, revision_b, options)
|
70
70
|
end
|
71
71
|
|
72
72
|
def blame
|
@@ -105,4 +105,4 @@ module Mercurial
|
|
105
105
|
|
106
106
|
end
|
107
107
|
|
108
|
-
end
|
108
|
+
end
|
data/lib/mercurial-ruby/shell.rb
CHANGED
data/lib/mercurial-ruby.rb
CHANGED
data/mercurial-ruby.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{mercurial-ruby}
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ilya Sabanin"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-12-08}
|
13
13
|
s.description = %q{Ruby API for Mercurial DVCS.}
|
14
14
|
s.email = %q{ilya.sabanin@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/test/fixtures/test-repo.zip
CHANGED
Binary file
|
data/test/test_commit_factory.rb
CHANGED
@@ -8,8 +8,8 @@ describe Mercurial::CommitFactory do
|
|
8
8
|
|
9
9
|
it "should find commits after specific revision" do
|
10
10
|
commits = @repository.commits.after('2d32410d9629')
|
11
|
-
commits.size.must_equal
|
12
|
-
commits.map(&:hash_id).must_equal %w(88b5cc7860153671b0d3aa3c16d01ecad987490e 57a6efe309bfa6c8054084de8c26490fca8a6104 f67625ea8586cd5c4d43c883a273db3ef7f38716 9f76ea916c5100bf61f533c33a6aa9f22532d526)
|
11
|
+
commits.size.must_equal 6
|
12
|
+
commits.map(&:hash_id).must_equal %w(88b5cc7860153671b0d3aa3c16d01ecad987490e 57a6efe309bfa6c8054084de8c26490fca8a6104 f67625ea8586cd5c4d43c883a273db3ef7f38716 9f76ea916c5100bf61f533c33a6aa9f22532d526 b6f6f764b939fc4be234574010247d40c683c322 e47455b9a2383085b400d649af4360b943c6d3cf)
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should find commits before specific revision" do
|
@@ -82,7 +82,7 @@ describe Mercurial::CommitFactory do
|
|
82
82
|
|
83
83
|
it "should count commits" do
|
84
84
|
count = @repository.commits.count
|
85
|
-
count.must_equal
|
85
|
+
count.must_equal 42
|
86
86
|
end
|
87
87
|
|
88
88
|
it "should count range of commits" do
|
data/test/test_diff_factory.rb
CHANGED
@@ -5,7 +5,7 @@ describe Mercurial::DiffFactory do
|
|
5
5
|
before do
|
6
6
|
@repository = Mercurial::Repository.open(Fixtures.test_repo)
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
it "should find diffs for commit" do
|
10
10
|
commit = @repository.commits.by_hash_id('54d96f4b1a26')
|
11
11
|
diffs = @repository.diffs.for_commit(commit)
|
@@ -44,6 +44,11 @@ describe Mercurial::DiffFactory do
|
|
44
44
|
diff.file_b.must_equal 'diff-test.rb'
|
45
45
|
diff.body.must_equal diff_sample
|
46
46
|
end
|
47
|
+
|
48
|
+
it "should ignore whitespace" do
|
49
|
+
diff = @repository.diffs.for_path('superman.txt', 'b6f6f764b939', 'e47455b9a238', :ignore_whitespace => true)
|
50
|
+
diff.body.must_equal diff_sample_2
|
51
|
+
end
|
47
52
|
|
48
53
|
private
|
49
54
|
|
@@ -74,5 +79,16 @@ private
|
|
74
79
|
@changesets = find_changesets_for_current_scope
|
75
80
|
]
|
76
81
|
end
|
82
|
+
|
83
|
+
def diff_sample_2
|
84
|
+
%Q[--- a/superman.txt Thu Dec 01 15:52:30 2011 -0500
|
85
|
+
+++ b/superman.txt Thu Dec 01 15:57:43 2011 -0500
|
86
|
+
@@ -1,3 +1,3 @@
|
87
|
+
|
88
|
+
-^ whitespace change above
|
89
|
+
+^ whitespace change above and below
|
90
|
+
This is a superman file.
|
91
|
+
]
|
92
|
+
end
|
77
93
|
|
78
|
-
end
|
94
|
+
end
|
data/test/test_file_index.rb
CHANGED
@@ -24,7 +24,7 @@ describe Mercurial::FileIndex do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should count all commits" do
|
27
|
-
@file_index.count_all.must_equal
|
27
|
+
@file_index.count_all.must_equal 42
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should count commits reachable by specific hash id" do
|
@@ -120,4 +120,4 @@ directory_1/specification.rb
|
|
120
120
|
directory_1/tasks.rb]
|
121
121
|
end
|
122
122
|
|
123
|
-
end
|
123
|
+
end
|
data/test/test_shell.rb
CHANGED
@@ -6,6 +6,10 @@ describe Mercurial::Shell do
|
|
6
6
|
@repository = Mercurial::Repository.open(Fixtures.test_repo)
|
7
7
|
@shell = @repository.shell
|
8
8
|
end
|
9
|
+
|
10
|
+
it "should accept piping" do
|
11
|
+
assert_equal '1', @shell.hg('log', :pipe => "grep '9:0f41dd2ec166' -wc").strip
|
12
|
+
end
|
9
13
|
|
10
14
|
it "should compile commands" do
|
11
15
|
command_mock = mock('command', :execute => true)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mercurial-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 1
|
10
|
+
version: 0.6.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ilya Sabanin
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-12-08 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|