背景:

1.最近使用执行svn diff的时候发现有些文本文件无法显示:

2.浏览器会通过判断获取文件的 MIME 类型, 调用不同的客户端程序或使用不同的方式来执行。如果文件的 MIME 缺失或者有误, 那浏览器会按默认方式处理。为了 SVN 服务器上的文件也被正确执行, 需要修改 svn:mime-type。


命令行:

#显示文件的mime-type属性,如果文件mime-type属性为空则不显示
svn propget svn:mime-type path/file
#设置文件的mime-type属性
    #文本文件 text/plain  
    svn propset svn:mime-type text/plain path/file
    #二进制(Binary)文件 application/octet-stream
    svn propset svn:mime-type application/octet-stream path/file
#删除文件的mime-type属性
svn propdel svn:mime-type path/file

自动匹配:
Ps:只对add或者import文件时起作用,如果本来就存在服务器中的文件没效果。
#修改subversion的配置文件:
linux—  ~/.subversion/config
windows7— C:\Users\${user}\AppData\Roaming\Subversion\config
#设置enable-auto-props
enable-auto-props = yes
#在[auto-props]模块增加
*.js = svn:mime-type=text/javascript
*.css = svn:mime-type=text/css
*.html = svn:mime-type=text/heml
*.txt = svn:mime-type=text/plain
*.png = svn:mime-type=image/png
*.jpg = svn:mime-type=image/jpeg

TortoiseSVN客户端:
  1. 右击展开文件菜单, 选择 TortoiseSVN >Show Propertise.
  2. 添加或者修改 Mime-Type.
  3. 保存并提交 SVN.


附录:
每个MIME类型由两部分组成,前面是数据的大类别,例如声音audio、图象image等,后面定义具体的种类。
常见的MIME类型(通用型):
超文本标记语言文本 .html text/html
xml文档 .xml text/xml
XHTML文档 .xhtml application/xhtml+xml
普通文本 .txt text/plain
RTF文本 .rtf application/rtf
PDF文档 .pdf application/pdf
Microsoft Word文件 .word application/msword
PNG图像 .png image/png
GIF图形 .gif image/gif
JPEG图形 .jpeg,.jpg image/jpeg
au声音文件 .au audio/basic
MIDI音乐文件 mid,.midi audio/midi,audio/x-midi
RealAudio音乐文件 .ra, .ram audio/x-pn-realaudio
MPEG文件 .mpg,.mpeg video/mpeg
AVI文件 .avi video/x-msvideo
GZIP文件 .gz application/x-gzip
TAR文件 .tar application/x-tar
任意的二进制数据 application/octet-stream

SVN mime-type 笔记的更多相关文章

  1. [笔记] C# 如何获取文件的 MIME Type

    MIME Type 为何物: MIME 参考手册 svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types 常规方式 对于有文件后 ...

  2. MIME Type

    一.首先,我们要了解浏览器是如何处理内容的.在浏览器中显示的内容有 HTML.有 XML.有 GIF.还有 Flash --那么,浏览器是如何区分它们,决定什么内容用什么形式来显示呢?答案是 MIME ...

  3. Chrome: Resource interpreted as Font but transferred with MIME type font/x-woff

    最近,项目中加入了Bootstrap进行界面优化,但是,项目加载运行之后,控制台总是提示以下错误信息: GET http://localhost:8080/.../fonts/fontawesome- ...

  4. Resource interpreted as Script but transferred with MIME type text/plain:

    我用script做ajax跨域,请求返回的是个文本字符串,chrome提示:Resource interpreted as Script but transferred with MIME type ...

  5. solrj6.2异常--Expected mime type application/octet-stream but got text/html.

    org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://19 ...

  6. odoo 错误 Resource interpreted as Stylesheet but transferred with MIME type application/x-css:

    odoo8   页面内容显示一半,  web 控制台显示错误  Resource interpreted as Stylesheet but transferred with MIME type ap ...

  7. solr异常--Expected mime type application/octet-stream but got text/html.

    Exception in thread "main" org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrExce ...

  8. Chrome 报 Resource interpreted as Script but transferred with MIME type text/plain 警告的解决办法

    http://www.2cto.com/os/201312/262437.html 安装了VS2012之后,chrome在加载页面的时候会报 Resource interpreted as Scrip ...

  9. 控制台出现“The script has an unsupported MIME type ('text/html')”报错

    有时候开发React或者Vue项目时,本地运行访问时,会莫名出现报错如下: The script has an unsupported MIME type ('text/html') 这是由于无意中开 ...

  10. Nginx failing to load CSS and JS files (MIME type error)

    Nginx failing to load CSS and JS files (MIME type error) Nginx加载静态文件失败的解决方法(MIME type错误) 上线新的页面,需要在n ...

随机推荐

  1. 回顾下$.ajax()方法参数

    1.url: 要求为String类型的参数,(默认为当前页地址)发送请求的地址. 2.type: 要求为String类型的参数,请求方式(post或get)默认为get.注意其他http请求方法,例如 ...

  2. 通过Roslyn构建自己的C#脚本(更新版)

    之前写过文章介绍过如何通过Roslyn构建自己的C#脚本,但那篇文章是参考自Roslyn CTP版的,记得本来想等到Roslyn正式版出来重新更新一下文档的,不过记得后来Roslyn是跳票了的,Scr ...

  3. 深入浅出-网络七层模型&&网络数据包

    网络基本概念 OSI模型 OSI 模型(Open System Interconnection model)是一个由国际标准化组织

  4. MVC中使用CKEditor01-基础

    本篇体验在MVC中使用CKEditor,仅仅算思路.基础,暂没有把验证等与CKEditor结合在一起考虑. □ 1 使用NUGET引入CKEditorPM> Install-Package CK ...

  5. UML九种图 之 用例图和类图

    前言     近期写UML文档,看视频的时候感觉掌握的还能够,当真正写文档的时候才发现不是一件easy的事.写文档自己又翻开自己的笔记看了一遍又一遍. 以下就给大家介绍一下我画的几张图: 用例图   ...

  6. Spring-3.2.5 + Quartz-2.2.1 集群实例(Tomcat+Memcached+Quartz集群session共享)

    本例中我启动了两个Tomcat作效果测试,先看效果图: 现在我们关闭一个Tomcat 注意红线的位置和设置的参数有关 #org.quartz.jobStore.clusterCheckinInterv ...

  7. javax.imageio.IIOException: Can't create output stream! (生成验证码Servlet)

    在  web.xml里面加入 下面的代码: <servlet>         <servlet-name>validatecode</servlet-name> ...

  8. spring开发文档收集

    http://docs.spring.io/spring/docs/4.2.1.BUILD-SNAPSHOT/spring-framework-reference/htmlsingle/#aop-at ...

  9. 仿LOL项目开发第七天

    仿LOL项目开发第七天 by 草帽 不知不觉已经写到了第七篇这种类型的博客,但是回过头看看之前写的,发现都只能我自己能看懂. 我相信在看的童鞋云里雾里的,因为我基本上没怎么详细讲一个脚本怎么用?但是你 ...

  10. Xcode界面切换动画效果

    CATransition *animation = [CATransition animation]; [animation setDuration:0.2f]; [animation setTimi ...