Skip to content

Commit

Permalink
Merge pull request #47 from blackducksoftware/OTWO-4466
Browse files Browse the repository at this point in the history
OTWO-4466 Set the branch_name as nil if empty string
  • Loading branch information
santhanakarthikeyan authored Dec 28, 2016
2 parents ec65be8 + 4474205 commit b7a1e3a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/ohloh_scm/adapters/hg_adapter.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
module OhlohScm::Adapters
class HgAdapter < AbstractAdapter
def english_name
"Mercurial"
end
end
class HgAdapter < AbstractAdapter
def english_name
"Mercurial"
end

def branch_name=(branch_name)
branch_name = nil if branch_name.to_s.empty?
super
end
end
end

require_relative 'hg/validation'
Expand Down
10 changes: 10 additions & 0 deletions test/unit/hg_commits_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ def test_commit_count
end
end

def test_commit_count_with_empty_branch
with_hg_repository('hg', '') do |hg|
assert_equal nil, hg.branch_name
assert_equal 5, hg.commit_count
assert_equal 3, hg.commit_count(:after => 'b14fa4692f949940bd1e28da6fb4617de2615484')
assert_equal 0, hg.commit_count(:after => '655f04cf6ad708ab58c7b941672dce09dd369a18')
end
end


def test_commit_tokens
with_hg_repository('hg') do |hg|
assert_equal ['01101d8ef3cea7da9ac6e9a226d645f4418f05c9',
Expand Down

0 comments on commit b7a1e3a

Please sign in to comment.