comparison svnwrap/svn_swig_wrapper.py @ 77:ed3dd5bf45da

fetch_command: bypass export3() and checkout manually This method has several advantages: - export3() does not work very well under Windows, while client.list() and ra.get_file() do - File modes are retrieved from get_file() for free, instead of being read from the filesystem, which does not work under Windows, more generally the filesystem is bypassed completely. - It can be made much smarter by checkouting changed files only, like convert extension does.
author Patrick Mezard <pmezard@gmail.com>
date Sun, 09 Nov 2008 18:08:35 -0600
parents 6c62bd201785
children 85dcea81f22b
comparison
equal deleted inserted replaced
76:6c62bd201785 77:ed3dd5bf45da
431 rev = optrev(revision) 431 rev = optrev(revision)
432 client.export3(self.svn_url+'/'+path, checkout_path, rev, 432 client.export3(self.svn_url+'/'+path, checkout_path, rev,
433 rev, True, True, True, 'LF', # should be 'CRLF' on win32 433 rev, True, True, True, 'LF', # should be 'CRLF' on win32
434 self.client_context, self.pool) 434 self.client_context, self.pool)
435 435
436 def list_files(self, dirpath, revision):
437 """List the content of a directory at a given revision, recursively.
438
439 Yield tuples (path, kind) where 'path' is the entry path relatively to
440 'dirpath' and 'kind' is 'f' if the entry is a file, 'd' if it is a
441 directory. Raise IOError if the directory cannot be found at given
442 revision.
443 """
444 dirpath = dirpath.strip('/')
445 pool = core.Pool()
446 rpath = '/'.join([self.svn_url, dirpath]).strip('/')
447 rev = optrev(revision)
448 types = {
449 core.svn_node_dir: 'd',
450 core.svn_node_file: 'f',
451 }
452 try:
453 entries = client.ls(rpath, rev, True, self.client_context, pool)
454 except core.SubversionException, e:
455 if e.apr_err == core.SVN_ERR_FS_NOT_FOUND:
456 raise IOError('%s cannot be found at r%d' % (dirpath, revision))
457 raise
458 for path, e in entries.iteritems():
459 kind = types.get(e.kind)
460 yield path, kind
461
436 class SubversionRepoCanNotReplay(Exception): 462 class SubversionRepoCanNotReplay(Exception):
437 """Exception raised when the svn server is too old to have replay. 463 """Exception raised when the svn server is too old to have replay.
438 """ 464 """