mercurial-ruby 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.1
1
+ 0.7.2
@@ -1,10 +1,12 @@
1
+ require 'time'
2
+
1
3
  #
2
4
  # Wrapper module. Nothing interesting here except that you can
3
5
  # specify global configs with the +configure+ method.
4
6
  #
5
7
  module Mercurial
6
8
 
7
- VERSION = '0.7.1'
9
+ VERSION = '0.7.2'
8
10
 
9
11
  class Error < RuntimeError; end
10
12
 
@@ -91,6 +91,20 @@ module Mercurial
91
91
  def short_hash_id
92
92
  hash_id.to_s[0,12]
93
93
  end
94
+
95
+ #
96
+ # Returns a Hash of diffstat-style summary of changes for the commit.
97
+ #
98
+ def stats(cmd_options={})
99
+ raw = hg(["log -r ? --stat --template '{node}\n'", hash_id], cmd_options)
100
+ result = raw.scan(/(\d+) files changed, (\d+) insertions\(\+\), (\d+) deletions\(\-\)$/).flatten.map{|r| r.to_i}
101
+ {
102
+ 'files' => result[0],
103
+ 'additions' => result[1],
104
+ 'deletions' => result[2],
105
+ 'total' => result[1] + result[2]
106
+ }
107
+ end
94
108
 
95
109
  def to_hash
96
110
  {
@@ -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.1"
8
+ s.version = "0.7.2"
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{2012-03-05}
12
+ s.date = %q{2012-03-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/test_blame.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  describe Mercurial::Blame do
4
4
 
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  describe Mercurial::BlameFactory do
4
4
 
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  describe Mercurial::BranchFactory do
4
4
 
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  describe Mercurial::Commit do
4
4
 
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  describe Mercurial::ChangedFileFactory do
4
4
 
data/test/test_command.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  describe Mercurial::Command do
4
4
 
data/test/test_commit.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  describe Mercurial::Commit do
4
4
 
@@ -62,5 +62,14 @@ describe Mercurial::Commit do
62
62
  commit = @repository.commits.by_hash_id('cd9fa0c59c7f')
63
63
  commit.exist_in_branches.map(&:name).sort.must_equal %w(default another-branch).sort
64
64
  end
65
+
66
+ it "should fetch stats" do
67
+ commit = @repository.commits.by_hash_id('cd9fa0c59c7f')
68
+ stats = commit.stats
69
+ stats['files'].must_equal 3
70
+ stats['additions'].must_equal 85
71
+ stats['deletions'].must_equal 6
72
+ stats['total'].must_equal 91
73
+ end
65
74
 
66
75
  end
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  describe Mercurial::CommitFactory do
4
4
 
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  describe Mercurial::ConfigFile do
4
4
 
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  describe Mercurial::Configuration do
4
4
 
data/test/test_diff.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  describe Mercurial::Diff do
4
4
 
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  describe Mercurial::DiffFactory do
4
4
 
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  describe Mercurial::FileIndex do
4
4
 
data/test/test_hook.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  describe Mercurial::Hook do
4
4
 
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  describe Mercurial::HookFactory do
4
4
 
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  describe Mercurial::Manifest do
4
4
 
data/test/test_node.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  describe Mercurial::Node do
4
4
 
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  describe Mercurial::NodeFactory do
4
4
 
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  describe Mercurial::Repository do
4
4
 
data/test/test_shell.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  describe Mercurial::Shell do
4
4
 
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  describe Mercurial::TagFactory do
4
4
 
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: 1
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 1
10
- version: 0.7.1
9
+ - 2
10
+ version: 0.7.2
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: 2012-03-05 00:00:00 -05:00
18
+ date: 2012-03-08 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency