Mercurial > hgsubversion
comparison svnwrap/svn_swig_wrapper.py @ 122:04c92c2c4501
SubversionRepo: work around ra.get_files() not releasing input buffer
| author | Patrick Mezard <pmezard@gmail.com> |
|---|---|
| date | Tue, 02 Dec 2008 20:13:13 -0600 |
| parents | 0d3a2a7cefa3 |
| children | ba801f44d240 |
comparison
equal
deleted
inserted
replaced
| 121:5438cc2d7ed7 | 122:04c92c2c4501 |
|---|---|
| 435 file is executable, 'l' if a symlink, the empty string | 435 file is executable, 'l' if a symlink, the empty string |
| 436 otherwise. If the file does not exist at this revision, raise | 436 otherwise. If the file does not exist at this revision, raise |
| 437 IOError. | 437 IOError. |
| 438 """ | 438 """ |
| 439 mode = '' | 439 mode = '' |
| 440 out = cStringIO.StringIO() | |
| 441 try: | 440 try: |
| 441 out = cStringIO.StringIO() | |
| 442 info = ra.get_file(self.ra, path, revision, out) | 442 info = ra.get_file(self.ra, path, revision, out) |
| 443 data = out.getvalue() | |
| 444 out.close() | |
| 443 if isinstance(info, list): | 445 if isinstance(info, list): |
| 444 info = info[-1] | 446 info = info[-1] |
| 445 mode = ("svn:executable" in info) and 'x' or '' | 447 mode = ("svn:executable" in info) and 'x' or '' |
| 446 mode = ("svn:special" in info) and 'l' or mode | 448 mode = ("svn:special" in info) and 'l' or mode |
| 447 except core.SubversionException, e: | 449 except core.SubversionException, e: |
| 448 notfound = (core.SVN_ERR_FS_NOT_FOUND, | 450 notfound = (core.SVN_ERR_FS_NOT_FOUND, |
| 449 core.SVN_ERR_RA_DAV_PATH_NOT_FOUND) | 451 core.SVN_ERR_RA_DAV_PATH_NOT_FOUND) |
| 450 if e.apr_err in notfound: # File not found | 452 if e.apr_err in notfound: # File not found |
| 451 raise IOError() | 453 raise IOError() |
| 452 raise | 454 raise |
| 453 data = out.getvalue() | |
| 454 if mode == 'l': | 455 if mode == 'l': |
| 455 linkprefix = "link " | 456 linkprefix = "link " |
| 456 if data.startswith(linkprefix): | 457 if data.startswith(linkprefix): |
| 457 data = data[len(linkprefix):] | 458 data = data[len(linkprefix):] |
| 458 return data, mode | 459 return data, mode |
