capillary 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capillary (0.1.2)
4
+ capillary (0.1.3)
5
5
  json (~> 1.5.1)
6
6
 
7
7
  GEM
@@ -25,15 +25,19 @@ module Capillary
25
25
  def initialize
26
26
  @commit_count = 0
27
27
  @branches = []
28
+ @seq_ids = {}
28
29
  end
29
30
 
30
31
  def <<(commit)
31
32
  commit = Capillary::Commit.parse(commit) if String === commit
33
+ seq_id = @commit_count
34
+ @commit_count += 1
32
35
 
33
36
  commit.parent_ids.each do |parent_id|
34
- place_commit(CommitNode.new(@commit_count, commit, parent_id))
35
- @commit_count += 1
37
+ place_commit(CommitNode.new(seq_id, commit, parent_id))
36
38
  end
39
+
40
+ place_commit(CommitNode.new(seq_id, commit, nil)) if commit.parent_ids.empty?
37
41
  end
38
42
 
39
43
  def to_json
@@ -17,5 +17,5 @@
17
17
  #++
18
18
 
19
19
  module Capillary
20
- VERSION = "0.1.2"
20
+ VERSION = "0.1.3"
21
21
  end
@@ -104,6 +104,30 @@ class LogParserTest < MiniTest::Spec
104
104
  end
105
105
  end
106
106
 
107
+ #
108
+ # 0
109
+ # |\
110
+ # | 0
111
+ # |/
112
+ # 0
113
+ context "sequence ids" do
114
+ should "use same sequence id for merge commit in all affected branches" do
115
+ fixtures = fixture("simple_graph_no_ff.txt").split("\n")
116
+ log = Capillary::LogParser.new
117
+ fixtures.reject { |f| f.strip == "" }.each { |f| log << f }
118
+ master, refactor = log.branches
119
+
120
+ assert_equal 2, log.branches.length
121
+ assert_equal 2, master.length
122
+ assert_equal 3, refactor.length
123
+ assert_equal 0, master[0].seq_id
124
+ assert_equal 2, master[1].seq_id
125
+ assert_equal 0, refactor[0].seq_id
126
+ assert_equal 1, refactor[1].seq_id
127
+ assert_equal 2, refactor[2].seq_id
128
+ end
129
+ end
130
+
107
131
  #
108
132
  # 0
109
133
  # |\
@@ -0,0 +1,3 @@
1
+ ca21fc1c48ad049d6900fce0e827bd827bd06331§04b91a0e021a4d9ac0658112d068262719d805e3 b950dbb37df3013bb8547f2b88071a0f872639e5§Fri Jul 15 10:19:40 2011 +0200§christian@gitorious.org§ (HEAD, master)§Merge branch 'branch2'§
2
+ b950dbb37df3013bb8547f2b88071a0f872639e5§04b91a0e021a4d9ac0658112d068262719d805e3§Fri Jul 15 10:19:34 2011 +0200§christian@gitorious.org§ (branch2)§Commit #2§
3
+ 04b91a0e021a4d9ac0658112d068262719d805e3§§Fri Jul 15 10:19:22 2011 +0200§christian@gitorious.org§§Initial commit§
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capillary
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marius Mathiesen
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-07-14 00:00:00 +02:00
19
+ date: 2011-07-15 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -92,6 +92,7 @@ files:
92
92
  - test/fixtures/complex_graph_no_ff.txt
93
93
  - test/fixtures/first_commit.txt
94
94
  - test/fixtures/parent_commit.txt
95
+ - test/fixtures/simple_graph_no_ff.txt
95
96
  - test/fixtures/third_commit.txt
96
97
  - test/fixtures/two_merged_branches.txt
97
98
  - test/test_helper.rb