mercurial-ruby 0.7.8 → 0.7.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,13 +7,15 @@ GEM
7
7
  git (>= 1.2.5)
8
8
  rake
9
9
  rdoc
10
+ json (1.7.7)
10
11
  metaclass (0.0.1)
11
12
  minitest (4.7.0)
12
13
  mocha (0.13.3)
13
14
  metaclass (~> 0.0.1)
14
15
  open4 (1.3.0)
15
16
  rake (10.0.4)
16
- rdoc (4.0.0)
17
+ rdoc (4.0.1)
18
+ json (~> 1.4)
17
19
 
18
20
  PLATFORMS
19
21
  ruby
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.8
1
+ 0.7.9
@@ -6,7 +6,7 @@ require 'time'
6
6
  #
7
7
  module Mercurial
8
8
 
9
- VERSION = '0.7.8'
9
+ VERSION = '0.7.9'
10
10
 
11
11
  class Error < RuntimeError; end
12
12
 
@@ -31,6 +31,11 @@ module Mercurial
31
31
  @file_b = opts[:file_b]
32
32
  @body = opts[:body]
33
33
  @binary = opts[:binary]
34
+
35
+ if RUBY_VERSION >= '1.9.1'
36
+ @file_a.force_encoding('utf-8') if @file_a
37
+ @file_b.force_encoding('utf-8') if @file_b
38
+ end
34
39
  end
35
40
 
36
41
  def file_name
@@ -43,4 +48,4 @@ module Mercurial
43
48
 
44
49
  end
45
50
 
46
- end
51
+ end
@@ -26,7 +26,11 @@ module Mercurial
26
26
  #
27
27
  def contents(revision=nil, cmd_options={})
28
28
  revision ||= 'tip'
29
- hg(manifest_cmd(revision), cmd_options)
29
+ hg(manifest_cmd(revision), cmd_options).tap do |res|
30
+ if RUBY_VERSION >= '1.9.1'
31
+ res.force_encoding('utf-8')
32
+ end
33
+ end
30
34
  end
31
35
 
32
36
  # Returns an array of file paths from manifest that start with the specified +path+ at a specified +revision+.
@@ -55,4 +59,4 @@ module Mercurial
55
59
  end
56
60
  end
57
61
 
58
- end
62
+ end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mercurial-ruby}
8
- s.version = "0.7.8"
8
+ s.version = "0.7.9"
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{2013-03-26}
12
+ s.date = %q{2013-04-14}
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 = [
@@ -57,6 +57,7 @@ Gem::Specification.new do |s|
57
57
  "lib/styles/file_index.style",
58
58
  "mercurial-ruby.gemspec",
59
59
  "test/fixtures.rb",
60
+ "test/fixtures/diff_sample3.diff",
60
61
  "test/fixtures/test-repo.zip",
61
62
  "test/helper.rb",
62
63
  "test/test_blame.rb",
@@ -0,0 +1,12 @@
1
+ --- a/кодировки/виндоуз-cp1251-lf Sun Apr 14 15:10:42 2013 -0400
2
+ +++ b/кодировки/виндоуз-cp1251-lf Sun Apr 14 15:32:30 2013 -0400
3
+ @@ -1,6 +1,6 @@
4
+ -����� ��� 10 ������ �������� �� ���� �������� ���������� ��� �����������
5
+ +����� ��� 11 ������ �������� �� ���� �������� ���������� ��� �����������
6
+ ����� ������, ���������� � ������������ ���������� REI, ������� ����������
7
+ �������� ���������� �������. �� ����� �������� ���������� ��� ����� ������
8
+ -������� ���� ��������, ������� ���������� ������������ � 2009 ����.
9
+ +������� ����� ��������, ������� ���������� ������������ � 2009 ����.
10
+
11
+ Windows CP1251 LF
12
+
Binary file
@@ -9,8 +9,8 @@ rescue Bundler::BundlerError => e
9
9
  exit e.status_code
10
10
  end
11
11
 
12
- require "mocha"
13
12
  require "minitest/autorun"
13
+ require "mocha/api"
14
14
 
15
15
  $LOAD_PATH.unshift(File.dirname(__FILE__))
16
16
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
@@ -49,4 +49,4 @@ end
49
49
 
50
50
  MiniTest::Unit.after_tests { erase_fixture_repository }
51
51
 
52
- MiniTest::Unit.autorun
52
+ MiniTest::Unit.autorun
@@ -52,7 +52,7 @@ describe Mercurial::BranchFactory do
52
52
 
53
53
  it "should find branch's full hash_id" do
54
54
  branch = @repository.branches.all.first
55
- branch.hash_id.must_equal 'e47455b9a2383085b400d649af4360b943c6d3cf'
55
+ branch.hash_id.must_equal '2b03a87dbf4cb1a95b2417d8e2eac801c450b624'
56
56
  end
57
57
 
58
- end
58
+ end
@@ -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 6
12
- commits.map(&:hash_id).must_equal %w(88b5cc7860153671b0d3aa3c16d01ecad987490e 57a6efe309bfa6c8054084de8c26490fca8a6104 f67625ea8586cd5c4d43c883a273db3ef7f38716 9f76ea916c5100bf61f533c33a6aa9f22532d526 b6f6f764b939fc4be234574010247d40c683c322 e47455b9a2383085b400d649af4360b943c6d3cf)
11
+ commits.size.must_equal 8
12
+ commits.map(&:hash_id).must_equal %w(88b5cc7860153671b0d3aa3c16d01ecad987490e 57a6efe309bfa6c8054084de8c26490fca8a6104 f67625ea8586cd5c4d43c883a273db3ef7f38716 9f76ea916c5100bf61f533c33a6aa9f22532d526 b6f6f764b939fc4be234574010247d40c683c322 e47455b9a2383085b400d649af4360b943c6d3cf fe021a290ba17217a083a8059db9a4f3568ee619 2b03a87dbf4cb1a95b2417d8e2eac801c450b624)
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 42
85
+ count.must_equal 44
86
86
  end
87
87
 
88
88
  it "should count range of commits" do
@@ -21,6 +21,14 @@ describe Mercurial::Diff do
21
21
  it "should have body" do
22
22
  @diff.body.strip.must_equal expected_diff.strip
23
23
  end
24
+
25
+ if RUBY_VERSION >= '1.9.1'
26
+ it "should return file names in UTF-8 encoding in Ruby 1.9.1 and higher" do
27
+ diff = @repository.diffs.for_path('кодировки/виндоуз-cp1251-lf', 'fe021a290ba1', '2b03a87dbf4c')
28
+ diff.file_a.encoding.to_s.downcase.must_equal 'utf-8'
29
+ diff.file_b.encoding.to_s.downcase.must_equal 'utf-8'
30
+ end
31
+ end
24
32
 
25
33
  private
26
34
 
@@ -36,4 +44,4 @@ private
36
44
  require 'bundler']
37
45
  end
38
46
 
39
- end
47
+ end
@@ -49,6 +49,11 @@ describe Mercurial::DiffFactory do
49
49
  diff = @repository.diffs.for_path('superman.txt', 'b6f6f764b939', 'e47455b9a238', :ignore_whitespace => true)
50
50
  diff.body.must_equal diff_sample_2
51
51
  end
52
+
53
+ it "should handle files with unicode names" do
54
+ diff = @repository.diffs.for_path('кодировки/виндоуз-cp1251-lf', 'fe021a290ba1', '2b03a87dbf4c')
55
+ diff.body.must_equal diff_sample3
56
+ end
52
57
 
53
58
  private
54
59
 
@@ -90,5 +95,9 @@ private
90
95
  This is a superman file.
91
96
  ]
92
97
  end
98
+
99
+ def diff_sample3
100
+ File.open(File.join(File.dirname(__FILE__), '', 'fixtures', 'diff_sample3.diff'), 'rb'){|f| f.read}
101
+ end
93
102
 
94
103
  end
@@ -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 42
27
+ @file_index.count_all.must_equal 44
28
28
  end
29
29
 
30
30
  it "should count commits reachable by specific hash id" do
@@ -35,5 +35,17 @@ describe Mercurial::Manifest do
35
35
  paths = @manifest.scan_for_path('check \ this \ out " now', '2d32410d9629')
36
36
  paths.size.must_equal 1
37
37
  end
38
+
39
+ it "should find unicode paths" do
40
+ paths = @manifest.scan_for_path('кодировки/виндоуз-cp1251-lf', 'fe021a290ba1')
41
+ paths.size.must_equal 1
42
+ paths[0].last.must_equal 'кодировки/виндоуз-cp1251-lf'
43
+ end
44
+
45
+ if RUBY_VERSION >= '1.9.1'
46
+ it "should return contents in UTF-8 encoding on Ruby 1.9.1 and higher" do
47
+ @manifest.contents.encoding.to_s.downcase.must_equal('utf-8')
48
+ end
49
+ end
38
50
 
39
51
  end
@@ -30,5 +30,12 @@ describe Mercurial::Node do
30
30
  node = @repository.nodes.find('File With Whitespace.pdf', '8ddac5f6380e')
31
31
  node.contents.must_equal ''
32
32
  end
33
+
34
+ if RUBY_VERSION >= '1.9.1'
35
+ it "should return name in UTF-8 encoding on Ruby 1.9.1 and higher" do
36
+ node = @repository.nodes.find('кодировки/виндоуз-cp1251-lf', 'fe021a290ba1')
37
+ node.name.encoding.to_s.downcase.must_equal 'utf-8'
38
+ end
39
+ end
33
40
 
34
- end
41
+ end
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: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 8
10
- version: 0.7.8
9
+ - 9
10
+ version: 0.7.9
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: 2013-03-26 00:00:00 -04:00
18
+ date: 2013-04-14 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -140,6 +140,7 @@ files:
140
140
  - lib/styles/file_index.style
141
141
  - mercurial-ruby.gemspec
142
142
  - test/fixtures.rb
143
+ - test/fixtures/diff_sample3.diff
143
144
  - test/fixtures/test-repo.zip
144
145
  - test/helper.rb
145
146
  - test/test_blame.rb