Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions svn/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ def properties(self, rel_path=None):
# query the proper list of this path
root = xml.etree.ElementTree.fromstring(result)
target_elem = root.find('target')
if not target_elem:
return {}

property_names = [p.attrib["name"]
for p in target_elem.findall('property')]

Expand Down
17 changes: 17 additions & 0 deletions tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@ def __init__(self, *args, **kwargs):
self.maxDiff = None
super(TestCommonClient, self).__init__(*args, **kwargs)

def test_properties(self):
with svn.test_support.temp_repo():
with svn.test_support.temp_checkout() as (working_path, lc):
svn.test_support.populate_bigger_file_changes1()

self.assertEqual(0, len(lc.properties('new_file')))
self.assertEqual(0, len(lc.properties('committed_unchanged')))

binary_file = 'binary.dat'
with open(os.path.join(working_path, binary_file), 'wb') as f:
f.write(bytearray(range(10)))
lc.add(binary_file) # file must be added to have props detected
binary_props = lc.properties(binary_file)
self.assertEqual(1, len(binary_props))
self.assertIsNotNone(binary_props['svn:mime-type'])
self.assertEqual('application/octet-stream', binary_props['svn:mime-type'])

def test_update(self):
with svn.test_support.temp_repo():
with svn.test_support.temp_checkout() as (_, lc):
Expand Down