Commit 9799a079 authored by maruel@chromium.org's avatar maruel@chromium.org

Accept svn:mime-type as a valid svn property.

R=dpranke@chromium.org
BUG=
TEST=


Review URL: http://codereview.chromium.org/9172003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@117133 0039d316-1c4b-4281-b951-d872f2087c98
parent cf602553
# coding=utf8
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Manages a project checkout.
......@@ -489,7 +489,8 @@ class GitCheckoutBase(CheckoutBase):
# TODO(maruel): Read ~/.subversion/config and detect the rules that
# applies here to figure out if the property will be correctly
# handled.
if not prop[0] in ('svn:eol-style', 'svn:executable'):
if not prop[0] in (
'svn:eol-style', 'svn:executable', 'svn:mime-type'):
raise patch.UnsupportedPatchFormat(
p.filename,
'Cannot apply svn property %s to file %s.' % (
......
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Defines class Rietveld to easily access a rietveld instance.
......@@ -198,7 +198,8 @@ class Rietveld(object):
match = re.match(r'^(\w+): (.+)$', action)
if not match or not rietveld_svn_props:
raise patch.UnsupportedPatchFormat(
filename, 'Failed to parse svn properties.')
filename,
'Failed to parse svn properties: %s, %s' % (action, svn_props))
if match.group(2) == 'svn:mergeinfo':
# Silently ignore the content.
......@@ -210,7 +211,7 @@ class Rietveld(object):
raise patch.UnsupportedPatchFormat(
filename, 'Unsupported svn property operation.')
if match.group(2) in ('svn:eol-style', 'svn:executable'):
if match.group(2) in ('svn:eol-style', 'svn:executable', 'svn:mime-type'):
# ' + foo' where foo is the new value. That's fragile.
content = rietveld_svn_props.pop(0)
match2 = re.match(r'^ \+ (.*)$', content)
......
......@@ -289,6 +289,15 @@ class RietveldTest(unittest.TestCase):
' + LF\n',
'foo'))
# http://codereview.chromium.org/api/9139006/7001
self.assertEquals(
[('svn:mime-type', 'image/png')],
rietveld.Rietveld.parse_svn_properties(
'\n'
'Added: svn:mime-type\n'
' + image/png\n',
'foo'))
def test_bad_svn_properties(self):
try:
rietveld.Rietveld.parse_svn_properties(u'\n', 'foo')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment