代码之家  ›  专栏  ›  技术社区  ›  Bryce

持续重写svn的mime到二进制映射?

  •  7
  • Bryce  · 技术社区  · 14 年前

    $ svn diff data/assets/site/ir_gallery/images.kml
    Index: data/assets/site/ir_gallery/images.kml
    ===================================================================
    Cannot display: file marked as a binary type.
    svn:mime-type = application/vnd.google-earth.kml+xml
    

    最近的堆栈溢出答案( svn diff: file marked as binary type )显示了您可以强制mime类型:

    $ svn propset svn:mime-type 'text/plain' data/assets/site/ir_gallery/images.kml
    property 'svn:mime-type' set on 'data/assets/site/ir_gallery/images.kml'
    

    请注意,先前的答案是不完整的。。。你还必须:

    $ svn commit
    

    新的 问题是:我能设置一个默认值吗,所以所有的未来谷歌公司-地球.kml+“xml”文件被svn视为文本?红皮书似乎对此主题保持沉默: http://svnbook.red-bean.com/en/1.2/svn.advanced.props.html

    ...if a file's svn:mime-type property is set to a non-text MIME type
    (generally, something that doesn't begin with text/, though there are
    exceptions) then...
    

    什么例外?这些异常是烘焙到svn代码中的,还是可以访问的?

    1 回复  |  直到 7 年前
        1
  •  6
  •   Tel Janin    13 年前

    答案取决于您使用的svn客户端。在官方的svn客户端中,您要寻找的选项是 Automatic Property Setting . 太长了,读不下去了,你需要更新你的版本。 user or system config ,设置 enable-auto-props 设置为 yes miscellany auto-props

    对于kml文件的示例:

    ### Section for configuring miscelleneous Subversion options.
    [miscellany]
    enable-auto-props = yes
    
    [auto-props]
    *.kml = svn:mime-type=text/plain;svn:eol-style=native