def within_exported_rev(rev, paths=[])
    Dir.mktmpdir("rim") do |d|
      d = Dir.glob(d)[0]
      c = File.join(d, "content")
      FileUtils.mkdir(c)
      export_rev(rev, c, paths)
      # return contents of yielded block
      # mktmpdir returns value return by our block
      yield c
      FileUtils.rm_rf(c)
      # retry to delete if it hasn't been deleted yet
      # this could be due to Windows keeping the files locked for some time
      # this is especially a problem if the machine is at its limits
      retries = 600
      while File.exist?(c) && retries > 0
        sleep(0.1)
        FileUtils.rm_rf(c)
        retries -= 1
      end
      if File.exist?(c)
        @logger.warn "could not delete temp dir: #{c}"
      end
    end
  end
def within_exported_rev(rev, paths=[])
    Dir.mktmpdir("rim") do |d|
      d = Dir.glob(d)[0]
      c = File.join(d, "content")
      FileUtils.mkdir(c)
      export_rev(rev, c, paths)
      # return contents of yielded block
      # mktmpdir returns value return by our block
      yield c
      FileUtils.rm_rf(c)
      # retry to delete if it hasn't been deleted yet
      # this could be due to Windows keeping the files locked for some time
      # this is especially a problem if the machine is at its limits
      retries = 600
      while File.exist?(c) && retries > 0
        sleep(0.1)
        FileUtils.rm_rf(c)
        retries -= 1
      end
      if File.exist?(c)
        @logger.warn "could not delete temp dir: #{c}"
      end
    end
  end
checks out rev to a temporary directory and yields this directory to the given block
 if +paths+ is given and non-empty, checks out only those parts of the filesystem tree
 returns the value returned by the block