lib/rim/sync_module_helper.rb
def export_module(message)
      changes = false
      RIM::git_session(@dest_root) do |d|
        start_sha1 = d.rev_sha1("HEAD")
        git_path = module_git_path(@remote_path)
        RIM::git_session(git_path) do |s|
          if !s.rev_sha1(@module_info.target_revision)
            raise RimException.new("Unknown target revision '#{@module_info.target_revision}' for module '#{@module_info.local_path}'.")
          end
          local_path = File.join(@dest_root, @module_info.local_path)
          prepare_empty_folder(local_path, @module_info.ignores)
          temp_commit(d, "clear directory") if d.uncommited_changes?
          strip = ""
          if @module_info.subdir
              depth = Pathname(@module_info.subdir).each_filename.count()
              strip = "--strip-components=#{depth}"
          end
          s.execute("git archive --format tar #{@module_info.target_revision} #{@module_info.subdir} | tar #{strip} -C #{local_path} -xf -")
          sha1 = s.execute("git rev-parse #{@module_info.target_revision}").strip
          @rim_info = RimInfo.new
          @rim_info.remote_url = @module_info.remote_url
          @rim_info.target_revision = @module_info.target_revision
          @rim_info.revision_sha1 = sha1
          @rim_info.ignores = @module_info.ignores.join(",")
          @rim_info.subdir = @module_info.subdir
          @rim_info.infos = s.rev_infos(@module_info.target_revision, RimInfo.git_infos)
          @rim_info.to_dir(local_path)
          DirtyCheck.mark_clean(local_path)
        end
        temp_commit(d, "commit changes") if needs_commit?(d)
        d.execute("git reset --soft #{start_sha1}")
        changes = d.uncommited_changes?
        commit(d, message || "rim sync: module #{@module_info.local_path}") if changes
      end
      changes
    end
def export_module(message)
      changes = false
      RIM::git_session(@dest_root) do |d|
        start_sha1 = d.rev_sha1("HEAD")
        git_path = module_git_path(@remote_path)
        RIM::git_session(git_path) do |s|
          if !s.rev_sha1(@module_info.target_revision)
            raise RimException.new("Unknown target revision '#{@module_info.target_revision}' for module '#{@module_info.local_path}'.")
          end
          local_path = File.join(@dest_root, @module_info.local_path)
          prepare_empty_folder(local_path, @module_info.ignores)
          temp_commit(d, "clear directory") if d.uncommited_changes?
          strip = ""
          if @module_info.subdir
              depth = Pathname(@module_info.subdir).each_filename.count()
              strip = "--strip-components=#{depth}"
          end
          s.execute("git archive --format tar #{@module_info.target_revision} #{@module_info.subdir} | tar #{strip} -C #{local_path} -xf -")
          sha1 = s.execute("git rev-parse #{@module_info.target_revision}").strip
          @rim_info = RimInfo.new
          @rim_info.remote_url = @module_info.remote_url
          @rim_info.target_revision = @module_info.target_revision
          @rim_info.revision_sha1 = sha1
          @rim_info.ignores = @module_info.ignores.join(",")
          @rim_info.subdir = @module_info.subdir
          @rim_info.infos = s.rev_infos(@module_info.target_revision, RimInfo.git_infos)
          @rim_info.to_dir(local_path)
          DirtyCheck.mark_clean(local_path)
        end
        temp_commit(d, "commit changes") if needs_commit?(d)
        d.execute("git reset --soft #{start_sha1}")
        changes = d.uncommited_changes?
        commit(d, message || "rim sync: module #{@module_info.local_path}") if changes
      end
      changes
    end
export +revision+ of +mod+ into working copy
 BEWARE: any changes to the working copy target dir will be lost!