lib/rim/upload_module_helper.rb
def upload_module_changes(parent_sha1, sha1s)
    remote_path = fetch_module
    # search for the first revision that is not 
    tmp_git_path = clone_or_fetch_repository(remote_path, module_tmp_git_path(@remote_path))
    RIM::git_session(tmp_git_path) do |dest|
      local_branch = nil
      remote_branch = nil
      infos = nil
      if @module_info.subdir
        dest_path = File.join([tmp_git_path] + @module_info.subdir.split("/"))
      else
        dest_path = tmp_git_path
      end
      RIM::git_session(@ws_root) do |src|
        infos = get_branches_and_revision_infos(src, dest, parent_sha1, sha1s)
        if infos.branches.size == 1
          remote_branch = infos.branches[0]
          if dest.has_remote_branch?(remote_branch)
            infos.rev_infos.each do |rev_info|
              local_branch = create_update_branch(dest, infos.parent_sha1, rev_info.src_sha1) if !local_branch
              copy_revision_files(
                src,
                rev_info.src_sha1,
                dest_path,
                rev_info.rim_info.ignores
              )
              commit_changes(dest, local_branch, rev_info.src_sha1, rev_info.message)
            end
          else
            raise RimException.new("The target revision '#{@module_info.target_revision}' of module #{@module_info.local_path} is not a branch. No push can be performed.")
          end
        elsif infos.branches.size > 1
          raise RimException.new("There are commits for module #{@module_info.local_path} on multiple target revisions (#{infos.branches.join(", ")}).")
        end
      end
      # Finally we're done. Push the changes
      if local_branch && dest.rev_sha1(local_branch) != infos.parent_sha1  
        push_branch = @review && @module_info.remote_branch_format && !@module_info.remote_branch_format.empty? \
            ? @module_info.remote_branch_format % remote_branch : remote_branch
        dest.execute("git push #{@remote_url} #{local_branch}:#{push_branch}")
        dest.execute("git checkout --detach #{local_branch}")
        dest.execute("git branch -D #{local_branch}")
        @logger.info("Commited changes for module #{@module_info.local_path} to remote branch #{push_branch}.")
      else
        @logger.info("No changes to module #{@module_info.local_path}.")
      end                              
    end
  end
def upload_module_changes(parent_sha1, sha1s)
    remote_path = fetch_module
    # search for the first revision that is not 
    tmp_git_path = clone_or_fetch_repository(remote_path, module_tmp_git_path(@remote_path))
    RIM::git_session(tmp_git_path) do |dest|
      local_branch = nil
      remote_branch = nil
      infos = nil
      if @module_info.subdir
        dest_path = File.join([tmp_git_path] + @module_info.subdir.split("/"))
      else
        dest_path = tmp_git_path
      end
      RIM::git_session(@ws_root) do |src|
        infos = get_branches_and_revision_infos(src, dest, parent_sha1, sha1s)
        if infos.branches.size == 1
          remote_branch = infos.branches[0]
          if dest.has_remote_branch?(remote_branch)
            infos.rev_infos.each do |rev_info|
              local_branch = create_update_branch(dest, infos.parent_sha1, rev_info.src_sha1) if !local_branch
              copy_revision_files(
                src,
                rev_info.src_sha1,
                dest_path,
                rev_info.rim_info.ignores
              )
              commit_changes(dest, local_branch, rev_info.src_sha1, rev_info.message)
            end
          else
            raise RimException.new("The target revision '#{@module_info.target_revision}' of module #{@module_info.local_path} is not a branch. No push can be performed.")
          end
        elsif infos.branches.size > 1
          raise RimException.new("There are commits for module #{@module_info.local_path} on multiple target revisions (#{infos.branches.join(", ")}).")
        end
      end
      # Finally we're done. Push the changes
      if local_branch && dest.rev_sha1(local_branch) != infos.parent_sha1  
        push_branch = @review && @module_info.remote_branch_format && !@module_info.remote_branch_format.empty? \
            ? @module_info.remote_branch_format % remote_branch : remote_branch
        dest.execute("git push #{@remote_url} #{local_branch}:#{push_branch}")
        dest.execute("git checkout --detach #{local_branch}")
        dest.execute("git branch -D #{local_branch}")
        @logger.info("Commited changes for module #{@module_info.local_path} to remote branch #{push_branch}.")
      else
        @logger.info("No changes to module #{@module_info.local_path}.")
      end                              
    end
  end
upload the content of the module