Merged revisions 64265 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r64265 | martin.v.loewis | 2008-06-14 08:24:44 +0200 (Sa, 14 Jun 2008) | 2 lines

  Conservatively restrict support to format 8 repositories.
........
This commit is contained in:
Martin v. Löwis 2008-06-14 06:25:37 +00:00
parent 95a939cf11
commit 6d291c14b0
1 changed files with 36 additions and 34 deletions

View File

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