Conservatively restrict support to format 8 repositories.

This commit is contained in:
Martin v. Löwis 2008-06-14 06:24:44 +00:00
parent 49ac5aa2ef
commit a6e02e8406
1 changed files with 36 additions and 34 deletions

View File

@ -33,27 +33,29 @@
import re
import os
def propfile(root, fn):
def propfiles(root, fn):
default = os.path.join(root, ".svn", "props", fn+".svn-work")
try:
format = int(open(os.path.join(root, ".svn", "format")).read().strip())
except IOError:
return default
# XXX I don't know what version uses what format;
# this condition is just anecdotal
if format >= 8:
return os.path.join(root, ".svn", "prop-base", fn+".svn-base")
return default
return []
if format == 8:
# In version 8, committed props are stored in prop-base,
# local modifications in props
return [os.path.join(root, ".svn", "prop-base", fn+".svn-base"),
os.path.join(root, ".svn", "props", fn+".svn-work")]
raise ValueError, "Unknown repository format"
def proplist(root, fn):
"Return a list of property names for file fn in directory root"
path = propfile(root, fn)
result = []
for path in propfiles(root, fn):
try:
f = open(path)
except IOError:
# no properties file: not under version control
return []
result = []
# no properties file: not under version control,
# or no properties set
continue
while 1:
# key-value pairs, of the form
# K <length>