Sha256: 841f294b07a300a97bb29016347dc1977141f621d4596fa2331d6114a818be70

Contents?: true

Size: 1.87 KB

Versions: 15

Compression:

Stored size: 1.87 KB

Contents

require_relative '../test_helper'

module OhlohScm::Adapters
  class GitSvnPullTest < OhlohScm::Test
    def test_svn_conversion_on_pull
      with_svn_repository('svn', 'trunk') do |src|
        OhlohScm::ScratchDir.new do |dest_dir|
          dest = GitSvnAdapter.new(:url => dest_dir).normalize

          dest.pull(src)

          dest_commits = dest.commits
          assert_equal dest_commits.map(&:diffs).flatten.map(&:path),
            ["helloworld.c", "makefile", "README", "helloworld.c", "COPYING"]
          assert_equal dest_commits.map(&:committer_date).map(&:to_s),
            ['2006-06-11 18:28:00 UTC', '2006-06-11 18:32:13 UTC', '2006-06-11 18:34:17 UTC', '2006-07-14 23:07:15 UTC']

          src.commits.each_with_index do |c, i|
            assert_equal c.committer_name, dest_commits[i].committer_name
            assert_equal c.message.strip, dest_commits[i].message.strip
          end
        end
      end
    end

    def test_updated_branch_on_fetch
      branch_name = 'trunk'

      with_svn_repository('svn', branch_name) do |source_scm|
        OhlohScm::ScratchDir.new do |dest_dir|
          OhlohScm::ScratchDir.new do |svn_working_folder|
            git_svn = GitSvnAdapter.new(:url => dest_dir).normalize
            git_svn.pull(source_scm)
            assert_equal 4, git_svn.commit_count

            message = 'new commit'
            source_scm_db_path = source_scm.path.sub('trunk', 'db')
            system "cd #{ svn_working_folder } && svn co #{ source_scm.url } && cd #{ branch_name } &&
                    mkdir -p #{ source_scm_db_path }/transactions &&
                    touch one && svn add one && svn commit -m '#{ message }' && svn update"

            git_svn.pull(source_scm)

            assert_equal 5, git_svn.commit_count
            assert_equal message, git_svn.commits.last.message.chomp
          end
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ohloh_scm-2.5.1 test/unit/git_svn_pull_test.rb
ohloh_scm-2.4.14 test/unit/git_svn_pull_test.rb
ohloh_scm-2.4.13 test/unit/git_svn_pull_test.rb
ohloh_scm-2.4.12 test/unit/git_svn_pull_test.rb
ohloh_scm-2.4.11 test/unit/git_svn_pull_test.rb
ohloh_scm-2.4.10 test/unit/git_svn_pull_test.rb
ohloh_scm-2.4.9 test/unit/git_svn_pull_test.rb
ohloh_scm-2.4.8 test/unit/git_svn_pull_test.rb
ohloh_scm-2.4.7 test/unit/git_svn_pull_test.rb
ohloh_scm-2.4.6 test/unit/git_svn_pull_test.rb
ohloh_scm-2.4.5 test/unit/git_svn_pull_test.rb
ohloh_scm-2.4.4 test/unit/git_svn_pull_test.rb
ohloh_scm-2.4.3 test/unit/git_svn_pull_test.rb
ohloh_scm-2.4.1 test/unit/git_svn_pull_test.rb
ohloh_scm-2.4.0 test/unit/git_svn_pull_test.rb