comparison svnwrap/svn_swig_wrapper.py @ 97:0d3a2a7cefa3

hg_delta_editor: fix symlink prefix confusion - SubversionRepo.get_file() strips the symlink prefix - Enforce that hg_delta_editor symlink data always contains the prefix. The alternative was seducing and more consistent with hg content but it makes the code more complicated since svn:special can be set before or after the content is set, and we need it in apply_textdelta() This issue fixes jQuery repository conversion at r3674.
author Patrick Mezard <pmezard@gmail.com>
date Thu, 20 Nov 2008 22:41:15 -0600
parents 7486c6f6cccc
children 04c92c2c4501
comparison
equal deleted inserted replaced
96:9b5e528f67f8 97:0d3a2a7cefa3
429 os.chdir(old_cwd) 429 os.chdir(old_cwd)
430 430
431 def get_file(self, path, revision): 431 def get_file(self, path, revision):
432 """Return content and mode of file at given path and revision. 432 """Return content and mode of file at given path and revision.
433 433
434 Content is raw svn content, symlinks content is still prefixed 434 "link " prefix is dropped from symlink content. Mode is 'x' if
435 by 'link '. Mode is 'x' if file is executable, 'l' if a symlink, 435 file is executable, 'l' if a symlink, the empty string
436 the empty string otherwise. If the file does not exist at this 436 otherwise. If the file does not exist at this revision, raise
437 revision, raise IOError. 437 IOError.
438 """ 438 """
439 mode = '' 439 mode = ''
440 out = cStringIO.StringIO() 440 out = cStringIO.StringIO()
441 try: 441 try:
442 info = ra.get_file(self.ra, path, revision, out) 442 info = ra.get_file(self.ra, path, revision, out)
449 core.SVN_ERR_RA_DAV_PATH_NOT_FOUND) 449 core.SVN_ERR_RA_DAV_PATH_NOT_FOUND)
450 if e.apr_err in notfound: # File not found 450 if e.apr_err in notfound: # File not found
451 raise IOError() 451 raise IOError()
452 raise 452 raise
453 data = out.getvalue() 453 data = out.getvalue()
454 if mode == 'l':
455 linkprefix = "link "
456 if data.startswith(linkprefix):
457 data = data[len(linkprefix):]
454 return data, mode 458 return data, mode
455 459
456 def proplist(self, path, revision, recurse=False): 460 def proplist(self, path, revision, recurse=False):
457 if path[-1] == '/': 461 if path[-1] == '/':
458 path = path[:-1] 462 path = path[:-1]