Alien-SVN

 view release on metacpan or  search on metacpan

src/subversion/subversion/bindings/swig/ruby/test/test_repos.rb  view on Meta::CPAN

    assert_transaction do |type, repos, args, callback|
      case type
      when :commit
        props = {
          Svn::Core::PROP_REVISION_AUTHOR => args[:author],
          Svn::Core::PROP_REVISION_LOG => args[:log],
        }
        repos.transaction_for_commit(props,
                                     args[:revision],
                                     &callback)
      when :update
        repos.transaction_for_update(args[:author],
                                     args[:revision],
                                     &callback)
      end
    end
  end

  def test_trace_node_locations
    file1 = "file1"
    file2 = "file2"
    file3 = "file3"
    path1 = File.join(@wc_path, file1)
    path2 = File.join(@wc_path, file2)
    path3 = File.join(@wc_path, file3)
    log = "sample log"
    make_context(log) do |ctx|

      FileUtils.touch(path1)
      ctx.add(path1)
      rev1 = ctx.ci(@wc_path).revision

      ctx.mv(path1, path2)
      rev2 = ctx.ci(@wc_path).revision

      ctx.cp(path2, path3)
      rev3 = ctx.ci(@wc_path).revision

      assert_equal({
                     rev1 => "/#{file1}",
                     rev2 => "/#{file2}",
                     rev3 => "/#{file2}",
                   },
                   @repos.fs.trace_node_locations("/#{file2}",
                                                  [rev1, rev2, rev3]))
    end
  end

  def assert_report
    file = "file"
    fs_base = "/"
    path = File.join(@wc_path, file)
    source = "sample source"
    log = "sample log"
    make_context(log) do |ctx|

      File.open(path, "w") {|f| f.print(source)}
      ctx.add(path)
      rev = ctx.ci(@wc_path).revision

      assert_equal(Svn::Core::NODE_FILE, @repos.fs.root.stat(file).kind)

      editor = TestEditor.new
      args = {
        :revision => rev,
        :user_name => @author,
        :fs_base => fs_base,
        :target => "",
        :target_path => nil,
        :editor => editor,
        :text_deltas => true,
        :recurse => true,
        :ignore_ancestry => false,
      }
      callback = Proc.new do |baton|
      end
      yield(@repos, args, callback)
      editor_seq = editor.sequence.collect{|meth, *args| meth}

      # Delete change_file_prop() and change_dir_prop() calls from the
      # actual editor sequence, as they can vary in ways not easily
      # determined by a black-box test author.
      editor_seq.delete(:change_file_prop)
      editor_seq.delete(:change_dir_prop)

      assert_equal([
                     :set_target_revision,
                     :open_root,
                     :close_directory,
                     :close_edit,
                   ],
                   editor_seq)
    end
  end

  def test_report
    assert_report do |repos, args, callback|
      @repos.report(args[:revision], args[:user_name], args[:fs_base],
                    args[:target], args[:target_path], args[:editor],
                    args[:text_deltas], args[:recurse], args[:ignore_ancestry],
                    &callback)
    end
  end

  def test_report2
    assert_report do |repos, args, callback|
      if args[:recurse]
        depth = Svn::Core::DEPTH_INFINITY
      else
        depth = Svn::Core::DEPTH_FILES
      end
      @repos.report2(args[:revision], args[:fs_base], args[:target],
                     args[:target_path], args[:editor], args[:text_deltas],
                     args[:ignore_ancestry], depth, &callback)
    end
  end

  def assert_commit_editor
    trunk = "trunk"
    tags = "tags"
    tags_sub = "sub"



( run in 1.376 second using v1.01-cache-2.11-cpan-39bf76dae61 )